mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Removes elevation and thickness from semantics r2 (#169382)
<!-- Thanks for filing a pull request! Reviewers are typically assigned within a week of filing a request. To learn more about code review, see our documentation on Tree Hygiene: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md --> same as https://github.com/flutter/flutter/pull/168703, but previous pr seems bugged github ## Pre-launch Checklist - [ ] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [ ] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [ ] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [ ] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [ ] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
This commit is contained in:
parent
6dd8814489
commit
3c28bb7a24
@ -213,8 +213,6 @@ void sendSemanticsUpdate() {
|
||||
scrollExtentMax: 0,
|
||||
scrollExtentMin: 0,
|
||||
rect: Rect.fromLTRB(0, 0, 10, 10),
|
||||
elevation: 0,
|
||||
thickness: 0,
|
||||
identifier: identifier,
|
||||
label: label,
|
||||
labelAttributes: labelAttributes,
|
||||
@ -267,8 +265,6 @@ void sendSemanticsUpdateWithRole() {
|
||||
scrollExtentMax: 0,
|
||||
scrollExtentMin: 0,
|
||||
rect: Rect.fromLTRB(0, 0, 10, 10),
|
||||
elevation: 0,
|
||||
thickness: 0,
|
||||
identifier: "identifier",
|
||||
label: "label",
|
||||
labelAttributes: const <StringAttribute>[],
|
||||
|
||||
@ -1633,14 +1633,6 @@ abstract class SemanticsUpdateBuilder {
|
||||
/// The `transform` is a matrix that maps this node's coordinate system into
|
||||
/// its parent's coordinate system.
|
||||
///
|
||||
/// The `elevation` describes the distance in z-direction between this node
|
||||
/// and the `elevation` of the parent.
|
||||
///
|
||||
/// The `thickness` describes how much space this node occupies in the
|
||||
/// z-direction starting at `elevation`. Basically, in the z-direction the
|
||||
/// node starts at `elevation` above the parent and ends at `elevation` +
|
||||
/// `thickness` above the parent.
|
||||
///
|
||||
/// The `headingLevel` describes that this node is a heading and the hierarchy
|
||||
/// level this node represents as a heading. A value of 0 indicates that this
|
||||
/// node is not a heading. A value of 1 or greater indicates that this node is
|
||||
@ -1680,8 +1672,6 @@ abstract class SemanticsUpdateBuilder {
|
||||
required double scrollPosition,
|
||||
required double scrollExtentMax,
|
||||
required double scrollExtentMin,
|
||||
required double elevation,
|
||||
required double thickness,
|
||||
required Rect rect,
|
||||
required String identifier,
|
||||
required String label,
|
||||
@ -1759,8 +1749,6 @@ base class _NativeSemanticsUpdateBuilder extends NativeFieldWrapperClass1
|
||||
required double scrollPosition,
|
||||
required double scrollExtentMax,
|
||||
required double scrollExtentMin,
|
||||
required double elevation,
|
||||
required double thickness,
|
||||
required Rect rect,
|
||||
required String identifier,
|
||||
required String label,
|
||||
@ -1809,8 +1797,6 @@ base class _NativeSemanticsUpdateBuilder extends NativeFieldWrapperClass1
|
||||
rect.top,
|
||||
rect.right,
|
||||
rect.bottom,
|
||||
elevation,
|
||||
thickness,
|
||||
identifier,
|
||||
label,
|
||||
labelAttributes,
|
||||
@ -1857,8 +1843,6 @@ base class _NativeSemanticsUpdateBuilder extends NativeFieldWrapperClass1
|
||||
Double,
|
||||
Double,
|
||||
Double,
|
||||
Double,
|
||||
Double,
|
||||
Handle,
|
||||
Handle,
|
||||
Handle,
|
||||
@ -1902,8 +1886,6 @@ base class _NativeSemanticsUpdateBuilder extends NativeFieldWrapperClass1
|
||||
double top,
|
||||
double right,
|
||||
double bottom,
|
||||
double elevation,
|
||||
double thickness,
|
||||
String? identifier,
|
||||
String label,
|
||||
List<StringAttribute> labelAttributes,
|
||||
|
||||
@ -170,8 +170,6 @@ struct SemanticsNode {
|
||||
double scrollPosition = std::nan("");
|
||||
double scrollExtentMax = std::nan("");
|
||||
double scrollExtentMin = std::nan("");
|
||||
double elevation = 0.0;
|
||||
double thickness = 0.0;
|
||||
std::string identifier;
|
||||
std::string label;
|
||||
StringAttributes labelAttributes;
|
||||
|
||||
@ -74,8 +74,6 @@ void SemanticsUpdateBuilder::updateNode(
|
||||
double top,
|
||||
double right,
|
||||
double bottom,
|
||||
double elevation,
|
||||
double thickness,
|
||||
std::string identifier,
|
||||
std::string label,
|
||||
const std::vector<NativeStringAttribute*>& labelAttributes,
|
||||
@ -118,8 +116,6 @@ void SemanticsUpdateBuilder::updateNode(
|
||||
node.scrollExtentMin = scrollExtentMin;
|
||||
node.rect = SkRect::MakeLTRB(SafeNarrow(left), SafeNarrow(top),
|
||||
SafeNarrow(right), SafeNarrow(bottom));
|
||||
node.elevation = elevation;
|
||||
node.thickness = thickness;
|
||||
node.identifier = std::move(identifier);
|
||||
node.label = std::move(label);
|
||||
pushStringAttributes(node.labelAttributes, labelAttributes);
|
||||
|
||||
@ -47,8 +47,6 @@ class SemanticsUpdateBuilder
|
||||
double top,
|
||||
double right,
|
||||
double bottom,
|
||||
double elevation,
|
||||
double thickness,
|
||||
std::string identifier,
|
||||
std::string label,
|
||||
const std::vector<NativeStringAttribute*>& labelAttributes,
|
||||
|
||||
@ -683,8 +683,6 @@ class SemanticsUpdateBuilder {
|
||||
required double scrollPosition,
|
||||
required double scrollExtentMax,
|
||||
required double scrollExtentMin,
|
||||
required double elevation,
|
||||
required double thickness,
|
||||
required Rect rect,
|
||||
required String identifier,
|
||||
required String label,
|
||||
@ -742,8 +740,6 @@ class SemanticsUpdateBuilder {
|
||||
tooltip: tooltip,
|
||||
textDirection: textDirection,
|
||||
transform: engine.toMatrix32(transform),
|
||||
elevation: elevation,
|
||||
thickness: thickness,
|
||||
childrenInTraversalOrder: childrenInTraversalOrder,
|
||||
childrenInHitTestOrder: childrenInHitTestOrder,
|
||||
additionalActions: additionalActions,
|
||||
|
||||
@ -237,8 +237,6 @@ class SemanticsNodeUpdate {
|
||||
this.tooltip,
|
||||
this.textDirection,
|
||||
required this.transform,
|
||||
required this.elevation,
|
||||
required this.thickness,
|
||||
required this.childrenInTraversalOrder,
|
||||
required this.childrenInHitTestOrder,
|
||||
required this.additionalActions,
|
||||
@ -343,12 +341,6 @@ class SemanticsNodeUpdate {
|
||||
/// See [ui.SemanticsUpdateBuilder.updateNode].
|
||||
final Int32List additionalActions;
|
||||
|
||||
/// See [ui.SemanticsUpdateBuilder.updateNode].
|
||||
final double elevation;
|
||||
|
||||
/// See [ui.SemanticsUpdateBuilder.updateNode].
|
||||
final double thickness;
|
||||
|
||||
/// See [ui.SemanticsUpdateBuilder.updateNode].
|
||||
final int headingLevel;
|
||||
|
||||
|
||||
@ -4996,8 +4996,6 @@ void updateNode(
|
||||
double scrollPosition = 0.0,
|
||||
double scrollExtentMax = 0.0,
|
||||
double scrollExtentMin = 0.0,
|
||||
double elevation = 0.0,
|
||||
double thickness = 0.0,
|
||||
ui.Rect rect = ui.Rect.zero,
|
||||
String identifier = '',
|
||||
String label = '',
|
||||
@ -5041,8 +5039,6 @@ void updateNode(
|
||||
scrollPosition: scrollPosition,
|
||||
scrollExtentMax: scrollExtentMax,
|
||||
scrollExtentMin: scrollExtentMin,
|
||||
elevation: elevation,
|
||||
thickness: thickness,
|
||||
rect: rect,
|
||||
identifier: identifier,
|
||||
label: label,
|
||||
|
||||
@ -98,8 +98,6 @@ class SemanticsTester {
|
||||
double? scrollPosition,
|
||||
double? scrollExtentMax,
|
||||
double? scrollExtentMin,
|
||||
double? elevation,
|
||||
double? thickness,
|
||||
ui.Rect? rect,
|
||||
String? identifier,
|
||||
String? label,
|
||||
@ -336,8 +334,6 @@ class SemanticsTester {
|
||||
decreasedValueAttributes: decreasedValueAttributes ?? const <ui.StringAttribute>[],
|
||||
tooltip: tooltip ?? '',
|
||||
transform: transform != null ? toMatrix32(transform) : Matrix4.identity().storage,
|
||||
elevation: elevation ?? 0,
|
||||
thickness: thickness ?? 0,
|
||||
childrenInTraversalOrder: childIds,
|
||||
childrenInHitTestOrder: childIds,
|
||||
additionalActions: additionalActions ?? Int32List(0),
|
||||
|
||||
@ -596,8 +596,6 @@ AccessibilityBridge::FromFlutterSemanticsNode(
|
||||
result.scroll_position = flutter_node.scroll_position;
|
||||
result.scroll_extent_max = flutter_node.scroll_extent_max;
|
||||
result.scroll_extent_min = flutter_node.scroll_extent_min;
|
||||
result.elevation = flutter_node.elevation;
|
||||
result.thickness = flutter_node.thickness;
|
||||
if (flutter_node.label) {
|
||||
result.label = std::string(flutter_node.label);
|
||||
}
|
||||
|
||||
@ -170,8 +170,6 @@ class AccessibilityBridge
|
||||
double scroll_position;
|
||||
double scroll_extent_max;
|
||||
double scroll_extent_min;
|
||||
double elevation;
|
||||
double thickness;
|
||||
std::string label;
|
||||
std::string hint;
|
||||
std::string value;
|
||||
|
||||
@ -150,8 +150,8 @@ void EmbedderSemanticsUpdate::AddNode(const SemanticsNode& node) {
|
||||
node.scrollPosition,
|
||||
node.scrollExtentMax,
|
||||
node.scrollExtentMin,
|
||||
node.elevation,
|
||||
node.thickness,
|
||||
0.0,
|
||||
0.0,
|
||||
node.label.c_str(),
|
||||
node.hint.c_str(),
|
||||
node.value.c_str(),
|
||||
@ -251,8 +251,8 @@ void EmbedderSemanticsUpdate2::AddNode(const SemanticsNode& node) {
|
||||
node.scrollPosition,
|
||||
node.scrollExtentMax,
|
||||
node.scrollExtentMin,
|
||||
node.elevation,
|
||||
node.thickness,
|
||||
0.0,
|
||||
0.0,
|
||||
node.label.c_str(),
|
||||
node.hint.c_str(),
|
||||
node.value.c_str(),
|
||||
|
||||
@ -185,8 +185,6 @@ Future<void> a11y_main() async {
|
||||
scrollPosition: 0.0,
|
||||
scrollExtentMax: 0.0,
|
||||
scrollExtentMin: 0.0,
|
||||
elevation: 0.0,
|
||||
thickness: 0.0,
|
||||
hint: '',
|
||||
hintAttributes: <StringAttribute>[],
|
||||
value: '',
|
||||
@ -220,8 +218,6 @@ Future<void> a11y_main() async {
|
||||
scrollPosition: 0.0,
|
||||
scrollExtentMax: 0.0,
|
||||
scrollExtentMin: 0.0,
|
||||
elevation: 0.0,
|
||||
thickness: 0.0,
|
||||
hint: '',
|
||||
hintAttributes: <StringAttribute>[],
|
||||
value: '',
|
||||
@ -259,8 +255,6 @@ Future<void> a11y_main() async {
|
||||
scrollPosition: 0.0,
|
||||
scrollExtentMax: 0.0,
|
||||
scrollExtentMin: 0.0,
|
||||
elevation: 0.0,
|
||||
thickness: 0.0,
|
||||
hint: '',
|
||||
hintAttributes: <StringAttribute>[],
|
||||
value: '',
|
||||
@ -295,8 +289,6 @@ Future<void> a11y_main() async {
|
||||
scrollPosition: 0.0,
|
||||
scrollExtentMax: 0.0,
|
||||
scrollExtentMin: 0.0,
|
||||
elevation: 0.0,
|
||||
thickness: 0.0,
|
||||
hint: '',
|
||||
hintAttributes: <StringAttribute>[],
|
||||
value: '',
|
||||
@ -368,8 +360,6 @@ Future<void> a11y_string_attributes() async {
|
||||
scrollPosition: 0.0,
|
||||
scrollExtentMax: 0.0,
|
||||
scrollExtentMin: 0.0,
|
||||
elevation: 0.0,
|
||||
thickness: 0.0,
|
||||
hint: "It's a number",
|
||||
hintAttributes: <StringAttribute>[
|
||||
LocaleStringAttribute(
|
||||
@ -1683,8 +1673,6 @@ Future<void> a11y_main_multi_view() async {
|
||||
scrollPosition: 0.0,
|
||||
scrollExtentMax: 0.0,
|
||||
scrollExtentMin: 0.0,
|
||||
elevation: 0.0,
|
||||
thickness: 0.0,
|
||||
hint: '',
|
||||
hintAttributes: <StringAttribute>[],
|
||||
value: '',
|
||||
|
||||
@ -279,10 +279,8 @@ fuchsia::ui::gfx::BoundingBox AccessibilityBridge::GetNodeLocation(
|
||||
fuchsia::ui::gfx::BoundingBox box;
|
||||
box.min.x = node.rect.fLeft;
|
||||
box.min.y = node.rect.fTop;
|
||||
box.min.z = static_cast<float>(node.elevation);
|
||||
box.max.x = node.rect.fRight;
|
||||
box.max.y = node.rect.fBottom;
|
||||
box.max.z = static_cast<float>(node.thickness);
|
||||
return box;
|
||||
}
|
||||
|
||||
|
||||
@ -446,8 +446,6 @@ Future<void> sendSemanticsTreeInfo() async {
|
||||
scrollExtentMax: 0,
|
||||
scrollExtentMin: 0,
|
||||
rect: const ui.Rect.fromLTRB(0, 0, 10, 10),
|
||||
elevation: 0,
|
||||
thickness: 0,
|
||||
identifier: 'identifier',
|
||||
label: 'label',
|
||||
labelAttributes: const <ui.StringAttribute>[],
|
||||
|
||||
@ -61,8 +61,6 @@ class LocaleInitialization extends Scenario {
|
||||
scrollExtentMax: 0.0,
|
||||
scrollExtentMin: 0.0,
|
||||
transform: Matrix4.identity().storage,
|
||||
elevation: 0.0,
|
||||
thickness: 0.0,
|
||||
hint: '',
|
||||
hintAttributes: <StringAttribute>[],
|
||||
value: '',
|
||||
@ -123,8 +121,6 @@ class LocaleInitialization extends Scenario {
|
||||
scrollExtentMax: 0.0,
|
||||
scrollExtentMin: 0.0,
|
||||
transform: Matrix4.identity().storage,
|
||||
elevation: 0.0,
|
||||
thickness: 0.0,
|
||||
hint: '',
|
||||
hintAttributes: <StringAttribute>[],
|
||||
value: '',
|
||||
|
||||
@ -4872,19 +4872,19 @@ typedef _MergeUpAndSiblingMergeGroups =
|
||||
/// Merge all fragments from [mergeUp] and decide which [_RenderObjectSemantics]
|
||||
/// should form a node, i.e. [shouldFormSemanticsNode] is true. Stores the
|
||||
/// [_RenderObjectSemantics] that should form a node with elevation adjustments
|
||||
/// into [_childrenAndElevationAdjustments].
|
||||
/// into [_children].
|
||||
///
|
||||
/// At this point, walking the [_childrenAndElevationAdjustments] forms a tree
|
||||
/// At this point, walking the [_children] forms a tree
|
||||
/// that exactly resemble the resulting semantics node tree.
|
||||
///
|
||||
/// ### Phase 3
|
||||
///
|
||||
/// Walks the [_childrenAndElevationAdjustments] and calculate their
|
||||
/// Walks the [_children] and calculate their
|
||||
/// [_SemanticsGeometry] based on renderObject relationship.
|
||||
///
|
||||
/// ### Phase 4
|
||||
///
|
||||
/// Walks the [_childrenAndElevationAdjustments] and produce semantics node for
|
||||
/// Walks the [_children] and produce semantics node for
|
||||
/// each [_RenderObjectSemantics] plus the sibling nodes.
|
||||
///
|
||||
/// Phase 2, 3, 4 each depends on previous step to finished updating the the
|
||||
@ -4899,7 +4899,7 @@ class _RenderObjectSemantics extends _SemanticsFragment with DiagnosticableTreeM
|
||||
|
||||
bool _hasSiblingConflict = false;
|
||||
bool? _blocksPreviousSibling;
|
||||
double elevationAdjustment = 0.0;
|
||||
|
||||
// TODO(chunhtai): Figure out what to do when incomplete fragments are asked
|
||||
// to form a semantics node.
|
||||
//
|
||||
@ -4936,10 +4936,9 @@ class _RenderObjectSemantics extends _SemanticsFragment with DiagnosticableTreeM
|
||||
/// Fragments that will merge up to parent rendering object semantics.
|
||||
final List<_SemanticsFragment> mergeUp = <_SemanticsFragment>[];
|
||||
|
||||
/// A map that record immediate child [_RenderObjectSemantics]s that will form
|
||||
/// semantics nodes with their elevation adjustments.
|
||||
final Map<_RenderObjectSemantics, double> _childrenAndElevationAdjustments =
|
||||
<_RenderObjectSemantics, double>{};
|
||||
/// A list to store immediate child [_RenderObjectSemantics]s that will form
|
||||
/// semantics nodes.
|
||||
final List<_RenderObjectSemantics> _children = <_RenderObjectSemantics>[];
|
||||
|
||||
/// Merge groups that will form additional sibling nodes.
|
||||
final List<List<_SemanticsFragment>> siblingMergeGroups = <List<_SemanticsFragment>>[];
|
||||
@ -5056,7 +5055,7 @@ class _RenderObjectSemantics extends _SemanticsFragment with DiagnosticableTreeM
|
||||
|
||||
/// Updates the [parentData] for the [_RenderObjectSemantics]s in the
|
||||
/// rendering subtree and forms a [_RenderObjectSemantics] tree where children
|
||||
/// are stored in [_childrenAndElevationAdjustments].
|
||||
/// are stored in [_children].
|
||||
///
|
||||
/// This method does the the phase 1 and 2 of the four phases documented on
|
||||
/// [_RenderObjectSemantics].
|
||||
@ -5072,7 +5071,7 @@ class _RenderObjectSemantics extends _SemanticsFragment with DiagnosticableTreeM
|
||||
/// Merge all fragments from [mergeUp] and decide which [_RenderObjectSemantics]
|
||||
/// should form a node. i.e. [shouldFormSemanticsNode] is true. Stores the
|
||||
/// [_RenderObjectSemantics] that should form a node with elevation adjustments
|
||||
/// into [_childrenAndElevationAdjustments].
|
||||
/// into [_children].
|
||||
void updateChildren() {
|
||||
assert(parentData != null || isRoot, 'parent data can only be null for root rendering object');
|
||||
configProvider.reset();
|
||||
@ -5106,7 +5105,7 @@ class _RenderObjectSemantics extends _SemanticsFragment with DiagnosticableTreeM
|
||||
siblingMergeGroups.addAll(result.$2);
|
||||
|
||||
// Construct tree for nodes that will form semantics nodes.
|
||||
_childrenAndElevationAdjustments.clear();
|
||||
_children.clear();
|
||||
if (contributesToSemanticsTree) {
|
||||
_marksConflictsInMergeGroup(mergeUp, isMergeUp: true);
|
||||
siblingMergeGroups.forEach(_marksConflictsInMergeGroup);
|
||||
@ -5126,16 +5125,9 @@ class _RenderObjectSemantics extends _SemanticsFragment with DiagnosticableTreeM
|
||||
in result.$1.whereType<_RenderObjectSemantics>()) {
|
||||
assert(childSemantics.contributesToSemanticsTree);
|
||||
if (childSemantics.shouldFormSemanticsNode) {
|
||||
_childrenAndElevationAdjustments[childSemantics] = 0.0;
|
||||
_children.add(childSemantics);
|
||||
} else {
|
||||
final Map<_RenderObjectSemantics, double> passUpChildren =
|
||||
childSemantics._childrenAndElevationAdjustments;
|
||||
for (final _RenderObjectSemantics passUpChild in passUpChildren.keys) {
|
||||
final double passUpElevationAdjustment =
|
||||
passUpChildren[passUpChild]! + childSemantics.configProvider.original.elevation;
|
||||
_childrenAndElevationAdjustments[passUpChild] = passUpElevationAdjustment;
|
||||
passUpChild.elevationAdjustment = passUpElevationAdjustment;
|
||||
}
|
||||
_children.addAll(childSemantics._children);
|
||||
siblingMergeGroups.addAll(childSemantics.siblingMergeGroups);
|
||||
}
|
||||
}
|
||||
@ -5315,7 +5307,7 @@ class _RenderObjectSemantics extends _SemanticsFragment with DiagnosticableTreeM
|
||||
}
|
||||
|
||||
/// Updates the [geometry] for this [_RenderObjectSemantics]s and its subtree
|
||||
/// in [_childrenAndElevationAdjustments].
|
||||
/// in [_children].
|
||||
///
|
||||
/// This method does the the phase 3 of the four phases documented on
|
||||
/// [_RenderObjectSemantics].
|
||||
@ -5336,7 +5328,7 @@ class _RenderObjectSemantics extends _SemanticsFragment with DiagnosticableTreeM
|
||||
|
||||
void _updateChildGeometry() {
|
||||
assert(geometry != null);
|
||||
for (final _RenderObjectSemantics child in _childrenAndElevationAdjustments.keys) {
|
||||
for (final _RenderObjectSemantics child in _children) {
|
||||
final _SemanticsGeometry childGeometry = _SemanticsGeometry.computeChildGeometry(
|
||||
parentPaintClipRect: geometry!.paintClipRect,
|
||||
parentSemanticsClipRect: geometry!.semanticsClipRect,
|
||||
@ -5385,7 +5377,7 @@ class _RenderObjectSemantics extends _SemanticsFragment with DiagnosticableTreeM
|
||||
// update for semantics nodes generated in this render object semantics.
|
||||
//
|
||||
// Therefore, we only need to update the subtree.
|
||||
_buildSemanticsSubtree(usedSemanticsIds: <int>{}, elevationAdjustment: 0.0);
|
||||
_buildSemanticsSubtree(usedSemanticsIds: <int>{});
|
||||
}
|
||||
}
|
||||
|
||||
@ -5435,11 +5427,10 @@ class _RenderObjectSemantics extends _SemanticsFragment with DiagnosticableTreeM
|
||||
/// Builds the semantics subtree under the [cachedSemanticsNode].
|
||||
void _buildSemanticsSubtree({
|
||||
required Set<int> usedSemanticsIds,
|
||||
required double elevationAdjustment,
|
||||
List<SemanticsNode>? semanticsNodes,
|
||||
}) {
|
||||
final List<SemanticsNode> children = <SemanticsNode>[];
|
||||
for (final _RenderObjectSemantics child in _childrenAndElevationAdjustments.keys) {
|
||||
for (final _RenderObjectSemantics child in _children) {
|
||||
assert(child.shouldFormSemanticsNode);
|
||||
// Cached semantics node may be part of sibling merging group prior
|
||||
// to this update. In this case, the semantics node may continue to
|
||||
@ -5474,11 +5465,7 @@ class _RenderObjectSemantics extends _SemanticsFragment with DiagnosticableTreeM
|
||||
_updateSemanticsNodeGeometry();
|
||||
|
||||
_mergeSiblingGroup(usedSemanticsIds);
|
||||
_buildSemanticsSubtree(
|
||||
semanticsNodes: semanticsNodes,
|
||||
usedSemanticsIds: usedSemanticsIds,
|
||||
elevationAdjustment: elevationAdjustment,
|
||||
);
|
||||
_buildSemanticsSubtree(semanticsNodes: semanticsNodes, usedSemanticsIds: usedSemanticsIds);
|
||||
}
|
||||
|
||||
SemanticsNode _createSemanticsNode() {
|
||||
@ -5556,12 +5543,6 @@ class _RenderObjectSemantics extends _SemanticsFragment with DiagnosticableTreeM
|
||||
void _updateSemanticsNodeGeometry() {
|
||||
final SemanticsNode node = cachedSemanticsNode!;
|
||||
final _SemanticsGeometry nodeGeometry = geometry!;
|
||||
node.elevationAdjustment = elevationAdjustment;
|
||||
if (elevationAdjustment != 0.0) {
|
||||
configProvider.updateConfig((SemanticsConfiguration config) {
|
||||
config.elevation = configProvider.original.elevation + elevationAdjustment;
|
||||
});
|
||||
}
|
||||
final bool isSemanticsHidden =
|
||||
configProvider.original.isHidden ||
|
||||
(!(parentData?.mergeIntoParent ?? false) && nodeGeometry.hidden);
|
||||
@ -5661,7 +5642,6 @@ class _RenderObjectSemantics extends _SemanticsFragment with DiagnosticableTreeM
|
||||
node._semantics.geometry = null;
|
||||
node._semantics.parentData = null;
|
||||
node._semantics._blocksPreviousSibling = null;
|
||||
node._semantics.elevationAdjustment = 0.0;
|
||||
// Since this node is a semantics boundary, the produced sibling nodes will
|
||||
// be attached to the parent semantics boundary. Thus, these sibling nodes
|
||||
// will not be carried to the next loop.
|
||||
@ -5737,7 +5717,6 @@ class _RenderObjectSemantics extends _SemanticsFragment with DiagnosticableTreeM
|
||||
/// Removes any cache stored in this object as if it is newly created.
|
||||
void clear() {
|
||||
built = false;
|
||||
elevationAdjustment = 0.0;
|
||||
cachedSemanticsNode = null;
|
||||
parentData = null;
|
||||
geometry = null;
|
||||
@ -5745,7 +5724,7 @@ class _RenderObjectSemantics extends _SemanticsFragment with DiagnosticableTreeM
|
||||
_containsIncompleteFragment = false;
|
||||
mergeUp.clear();
|
||||
siblingMergeGroups.clear();
|
||||
_childrenAndElevationAdjustments.clear();
|
||||
_children.clear();
|
||||
semanticsNodes.clear();
|
||||
configProvider.clear();
|
||||
}
|
||||
|
||||
@ -2048,12 +2048,6 @@ abstract class _RenderPhysicalModelBase<T> extends _RenderCustomClip<T> {
|
||||
markNeedsPaint();
|
||||
}
|
||||
|
||||
@override
|
||||
void describeSemanticsConfiguration(SemanticsConfiguration config) {
|
||||
super.describeSemanticsConfiguration(config);
|
||||
config.elevation = elevation;
|
||||
}
|
||||
|
||||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder description) {
|
||||
super.debugFillProperties(description);
|
||||
|
||||
@ -724,8 +724,6 @@ class SemanticsData with Diagnosticable {
|
||||
required this.tooltip,
|
||||
required this.textDirection,
|
||||
required this.rect,
|
||||
required this.elevation,
|
||||
required this.thickness,
|
||||
required this.textSelection,
|
||||
required this.scrollIndex,
|
||||
required this.scrollChildCount,
|
||||
@ -980,21 +978,6 @@ class SemanticsData with Diagnosticable {
|
||||
/// parent).
|
||||
final Matrix4? transform;
|
||||
|
||||
/// The elevation of this node relative to the parent semantics node.
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [SemanticsConfiguration.elevation] for a detailed discussion regarding
|
||||
/// elevation and semantics.
|
||||
final double elevation;
|
||||
|
||||
/// The extent of this node along the z-axis beyond its [elevation]
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [SemanticsConfiguration.thickness] for a more detailed definition.
|
||||
final double thickness;
|
||||
|
||||
/// The identifiers for the custom semantics actions and standard action
|
||||
/// overrides for this node.
|
||||
///
|
||||
@ -1037,8 +1020,6 @@ class SemanticsData with Diagnosticable {
|
||||
super.debugFillProperties(properties);
|
||||
properties.add(DiagnosticsProperty<Rect>('rect', rect, showName: false));
|
||||
properties.add(TransformProperty('transform', transform, showName: false, defaultValue: null));
|
||||
properties.add(DoubleProperty('elevation', elevation, defaultValue: 0.0));
|
||||
properties.add(DoubleProperty('thickness', thickness, defaultValue: 0.0));
|
||||
final List<String> actionSummary = <String>[
|
||||
for (final SemanticsAction action in SemanticsAction.values)
|
||||
if ((actions & action.index) != 0) action.name,
|
||||
@ -1119,8 +1100,6 @@ class SemanticsData with Diagnosticable {
|
||||
other.maxValueLength == maxValueLength &&
|
||||
other.currentValueLength == currentValueLength &&
|
||||
other.transform == transform &&
|
||||
other.elevation == elevation &&
|
||||
other.thickness == thickness &&
|
||||
other.headingLevel == headingLevel &&
|
||||
other.linkUrl == linkUrl &&
|
||||
other.role == role &&
|
||||
@ -1155,8 +1134,6 @@ class SemanticsData with Diagnosticable {
|
||||
maxValueLength,
|
||||
currentValueLength,
|
||||
transform,
|
||||
elevation,
|
||||
thickness,
|
||||
headingLevel,
|
||||
linkUrl,
|
||||
customSemanticsActionIds == null ? null : Object.hashAll(customSemanticsActionIds!),
|
||||
@ -2373,27 +2350,6 @@ class SemanticsNode with DiagnosticableTreeMixin {
|
||||
/// If this rect is null [parentSemanticsClipRect] also has to be null.
|
||||
Rect? parentPaintClipRect;
|
||||
|
||||
/// The elevation adjustment that the parent imposes on this node.
|
||||
///
|
||||
/// The [elevation] property is relative to the elevation of the parent
|
||||
/// [SemanticsNode]. However, as [SemanticsConfiguration]s from various
|
||||
/// ascending [RenderObject]s are merged into each other to form that
|
||||
/// [SemanticsNode] the parent’s elevation may change. This requires an
|
||||
/// adjustment of the child’s relative elevation which is represented by this
|
||||
/// value.
|
||||
///
|
||||
/// The value is rarely accessed directly. Instead, for most use cases the
|
||||
/// [elevation] value should be used, which includes this adjustment.
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [elevation], the actual elevation of this [SemanticsNode].
|
||||
@Deprecated(
|
||||
'This was a cache for internal calculations and is no longer needed. '
|
||||
'This feature was deprecated after v3.29.0-0.0.pre.',
|
||||
)
|
||||
double? elevationAdjustment;
|
||||
|
||||
/// The index of this node within the parent's list of semantic children.
|
||||
///
|
||||
/// This includes all semantic nodes, not just those currently in the
|
||||
@ -2802,8 +2758,6 @@ class SemanticsNode with DiagnosticableTreeMixin {
|
||||
bool _isDifferentFromCurrentSemanticAnnotation(SemanticsConfiguration config) {
|
||||
return _attributedLabel != config.attributedLabel ||
|
||||
_attributedHint != config.attributedHint ||
|
||||
_elevation != config.elevation ||
|
||||
_thickness != config.thickness ||
|
||||
_attributedValue != config.attributedValue ||
|
||||
_attributedIncreasedValue != config.attributedIncreasedValue ||
|
||||
_attributedDecreasedValue != config.attributedDecreasedValue ||
|
||||
@ -2964,75 +2918,6 @@ class SemanticsNode with DiagnosticableTreeMixin {
|
||||
String get tooltip => _tooltip;
|
||||
String _tooltip = _kEmptyConfig.tooltip;
|
||||
|
||||
/// The elevation along the z-axis at which the [rect] of this [SemanticsNode]
|
||||
/// is located above its parent.
|
||||
///
|
||||
/// The value is relative to the parent's [elevation]. The sum of the
|
||||
/// [elevation]s of all ancestor node plus this value determines the absolute
|
||||
/// elevation of this [SemanticsNode].
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [thickness], which describes how much space in z-direction this
|
||||
/// [SemanticsNode] occupies starting at this [elevation].
|
||||
/// * [elevationAdjustment], which has been used to calculate this value.
|
||||
@Deprecated(
|
||||
'This was a feature added for 3D rendering, but the feature was deprecated. '
|
||||
'This feature was deprecated after v3.29.0-0.0.pre.',
|
||||
)
|
||||
double get elevation => _elevation;
|
||||
double _elevation = _kEmptyConfig.elevation;
|
||||
|
||||
/// Describes how much space the [SemanticsNode] takes up along the z-axis.
|
||||
///
|
||||
/// A [SemanticsNode] represents multiple [RenderObject]s, which can be
|
||||
/// located at various elevations in 3D. The [thickness] is the difference
|
||||
/// between the absolute elevations of the lowest and highest [RenderObject]
|
||||
/// represented by this [SemanticsNode]. In other words, the thickness
|
||||
/// describes how high the box is that this [SemanticsNode] occupies in three
|
||||
/// dimensional space. The two other dimensions are defined by [rect].
|
||||
///
|
||||
/// {@tool snippet}
|
||||
/// The following code stacks three [PhysicalModel]s on top of each other
|
||||
/// separated by non-zero elevations.
|
||||
///
|
||||
/// [PhysicalModel] C is elevated 10.0 above [PhysicalModel] B, which in turn
|
||||
/// is elevated 5.0 above [PhysicalModel] A. The side view of this
|
||||
/// constellation looks as follows:
|
||||
///
|
||||
/// 
|
||||
///
|
||||
/// In this example the [RenderObject]s for [PhysicalModel] C and B share one
|
||||
/// [SemanticsNode] Y. Given the elevations of those [RenderObject]s, this
|
||||
/// [SemanticsNode] has a [thickness] of 10.0 and an elevation of 5.0 over
|
||||
/// its parent [SemanticsNode] X.
|
||||
/// ```dart
|
||||
/// PhysicalModel( // A
|
||||
/// color: Colors.amber,
|
||||
/// child: Semantics(
|
||||
/// explicitChildNodes: true,
|
||||
/// child: const PhysicalModel( // B
|
||||
/// color: Colors.brown,
|
||||
/// elevation: 5.0,
|
||||
/// child: PhysicalModel( // C
|
||||
/// color: Colors.cyan,
|
||||
/// elevation: 10.0,
|
||||
/// child: Placeholder(),
|
||||
/// ),
|
||||
/// ),
|
||||
/// ),
|
||||
/// )
|
||||
/// ```
|
||||
/// {@end-tool}
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [elevation], which describes the elevation of the box defined by
|
||||
/// [thickness] and [rect] relative to the parent of this [SemanticsNode].
|
||||
double get thickness => _thickness;
|
||||
double _thickness = _kEmptyConfig.thickness;
|
||||
|
||||
/// Provides hint values which override the default hints on supported
|
||||
/// platforms.
|
||||
SemanticsHintOverrides? get hintOverrides => _hintOverrides;
|
||||
@ -3229,8 +3114,6 @@ class SemanticsNode with DiagnosticableTreeMixin {
|
||||
_attributedHint = config.attributedHint;
|
||||
_tooltip = config.tooltip;
|
||||
_hintOverrides = config.hintOverrides;
|
||||
_elevation = config.elevation;
|
||||
_thickness = config.thickness;
|
||||
_flags = config._flags;
|
||||
_textDirection = config.textDirection;
|
||||
_sortKey = config.sortKey;
|
||||
@ -3304,8 +3187,6 @@ class SemanticsNode with DiagnosticableTreeMixin {
|
||||
int? maxValueLength = _maxValueLength;
|
||||
int? currentValueLength = _currentValueLength;
|
||||
int headingLevel = _headingLevel;
|
||||
final double elevation = _elevation;
|
||||
double thickness = _thickness;
|
||||
Uri? linkUrl = _linkUrl;
|
||||
SemanticsRole role = _role;
|
||||
Set<String>? controlsNodes = _controlsNodes;
|
||||
@ -3410,8 +3291,6 @@ class SemanticsNode with DiagnosticableTreeMixin {
|
||||
otherTextDirection: node._textDirection,
|
||||
);
|
||||
|
||||
thickness = math.max(thickness, node._thickness + node._elevation);
|
||||
|
||||
if (controlsNodes == null) {
|
||||
controlsNodes = node._controlsNodes;
|
||||
} else if (node._controlsNodes != null) {
|
||||
@ -3446,8 +3325,6 @@ class SemanticsNode with DiagnosticableTreeMixin {
|
||||
textDirection: textDirection,
|
||||
rect: rect,
|
||||
transform: transform,
|
||||
elevation: elevation,
|
||||
thickness: thickness,
|
||||
tags: mergedTags,
|
||||
textSelection: textSelection,
|
||||
scrollChildCount: scrollChildCount,
|
||||
@ -3542,8 +3419,6 @@ class SemanticsNode with DiagnosticableTreeMixin {
|
||||
scrollExtentMax: data.scrollExtentMax ?? double.nan,
|
||||
scrollExtentMin: data.scrollExtentMin ?? double.nan,
|
||||
transform: data.transform?.storage ?? _kIdentityTransform,
|
||||
elevation: data.elevation,
|
||||
thickness: data.thickness,
|
||||
childrenInTraversalOrder: childrenInTraversalOrder,
|
||||
childrenInHitTestOrder: childrenInHitTestOrder,
|
||||
additionalActions: customSemanticsActionIds ?? _kEmptyCustomSemanticsActionsList,
|
||||
@ -3741,8 +3616,6 @@ class SemanticsNode with DiagnosticableTreeMixin {
|
||||
properties.add(DoubleProperty('scrollPosition', scrollPosition, defaultValue: null));
|
||||
properties.add(DoubleProperty('scrollExtentMax', scrollExtentMax, defaultValue: null));
|
||||
properties.add(IntProperty('indexInParent', indexInParent, defaultValue: null));
|
||||
properties.add(DoubleProperty('elevation', elevation, defaultValue: 0.0));
|
||||
properties.add(DoubleProperty('thickness', thickness, defaultValue: 0.0));
|
||||
properties.add(IntProperty('headingLevel', _headingLevel, defaultValue: 0));
|
||||
if (_inputType != SemanticsInputType.none) {
|
||||
properties.add(EnumProperty<SemanticsInputType>('inputType', _inputType));
|
||||
@ -5302,40 +5175,6 @@ class SemanticsConfiguration {
|
||||
_hasBeenAnnotated = true;
|
||||
}
|
||||
|
||||
/// The elevation in z-direction at which the owning [RenderObject] is
|
||||
/// located relative to its parent.
|
||||
@Deprecated(
|
||||
'This was a feature added for 3D rendering, but the feature was deprecated. '
|
||||
'This feature was deprecated after v3.29.0-0.0.pre.',
|
||||
)
|
||||
double get elevation => _elevation;
|
||||
double _elevation = 0.0;
|
||||
set elevation(double value) {
|
||||
assert(value >= 0.0);
|
||||
if (value == _elevation) {
|
||||
return;
|
||||
}
|
||||
_elevation = value;
|
||||
_hasBeenAnnotated = true;
|
||||
}
|
||||
|
||||
/// The extend that the owning [RenderObject] occupies in z-direction starting
|
||||
/// at [elevation].
|
||||
///
|
||||
/// It's extremely rare to set this value directly. Instead, it is calculated
|
||||
/// implicitly when other [SemanticsConfiguration]s are merged into this one
|
||||
/// via [absorb].
|
||||
double get thickness => _thickness;
|
||||
double _thickness = 0.0;
|
||||
set thickness(double value) {
|
||||
assert(value >= 0.0);
|
||||
if (value == _thickness) {
|
||||
return;
|
||||
}
|
||||
_thickness = value;
|
||||
_hasBeenAnnotated = true;
|
||||
}
|
||||
|
||||
/// Whether the semantics node is the root of a subtree for which values
|
||||
/// should be announced.
|
||||
///
|
||||
@ -5927,8 +5766,6 @@ class SemanticsConfiguration {
|
||||
_tooltip = child._tooltip;
|
||||
}
|
||||
|
||||
_thickness = math.max(_thickness, child._thickness + child._elevation);
|
||||
|
||||
if (_controlsNodes == null) {
|
||||
_controlsNodes = child._controlsNodes;
|
||||
} else if (child._controlsNodes != null) {
|
||||
@ -5965,8 +5802,6 @@ class SemanticsConfiguration {
|
||||
.._attributedHint = _attributedHint
|
||||
.._hintOverrides = _hintOverrides
|
||||
.._tooltip = _tooltip
|
||||
.._elevation = _elevation
|
||||
.._thickness = _thickness
|
||||
.._flags = _flags
|
||||
.._tagsForChildren = _tagsForChildren
|
||||
.._textSelection = _textSelection
|
||||
|
||||
@ -2538,35 +2538,25 @@ void main() {
|
||||
flags: <SemanticsFlag>[SemanticsFlag.scopesRoute],
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isButton,
|
||||
SemanticsFlag.isFocusable,
|
||||
SemanticsFlag.hasSelectedState,
|
||||
SemanticsFlag.isSelected,
|
||||
],
|
||||
actions: <SemanticsAction>[
|
||||
SemanticsAction.tap,
|
||||
SemanticsAction.focus,
|
||||
],
|
||||
label: 'A\nTab 1 of 2',
|
||||
textDirection: TextDirection.ltr,
|
||||
),
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isButton,
|
||||
SemanticsFlag.isFocusable,
|
||||
SemanticsFlag.hasSelectedState,
|
||||
],
|
||||
actions: <SemanticsAction>[
|
||||
SemanticsAction.tap,
|
||||
SemanticsAction.focus,
|
||||
],
|
||||
label: 'B\nTab 2 of 2',
|
||||
textDirection: TextDirection.ltr,
|
||||
),
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isButton,
|
||||
SemanticsFlag.isFocusable,
|
||||
SemanticsFlag.hasSelectedState,
|
||||
SemanticsFlag.isSelected,
|
||||
],
|
||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
||||
label: 'A\nTab 1 of 2',
|
||||
textDirection: TextDirection.ltr,
|
||||
),
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isButton,
|
||||
SemanticsFlag.isFocusable,
|
||||
SemanticsFlag.hasSelectedState,
|
||||
],
|
||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
||||
label: 'B\nTab 2 of 2',
|
||||
textDirection: TextDirection.ltr,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@ -1100,16 +1100,9 @@ void main() {
|
||||
flags: <SemanticsFlag>[SemanticsFlag.scopesRoute, SemanticsFlag.namesRoute],
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[SemanticsFlag.hasImplicitScrolling],
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[SemanticsFlag.hasImplicitScrolling],
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
label: 'BottomSheet',
|
||||
textDirection: TextDirection.ltr,
|
||||
),
|
||||
],
|
||||
),
|
||||
TestSemantics(label: 'BottomSheet', textDirection: TextDirection.ltr),
|
||||
],
|
||||
),
|
||||
],
|
||||
@ -1174,17 +1167,12 @@ void main() {
|
||||
flags: <SemanticsFlag>[SemanticsFlag.scopesRoute, SemanticsFlag.namesRoute],
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
label: 'BottomSheet',
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isButton],
|
||||
actions: <SemanticsAction>[SemanticsAction.tap],
|
||||
label: 'Dismiss',
|
||||
textDirection: TextDirection.ltr,
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isButton],
|
||||
actions: <SemanticsAction>[SemanticsAction.tap],
|
||||
label: 'Dismiss',
|
||||
textDirection: TextDirection.ltr,
|
||||
),
|
||||
],
|
||||
),
|
||||
TestSemantics(label: 'BottomSheet', textDirection: TextDirection.ltr),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@ -101,25 +101,18 @@ void main() {
|
||||
hasSemantics(
|
||||
TestSemantics.root(
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(id: 1, label: 'I am text!', textDirection: TextDirection.ltr),
|
||||
TestSemantics(id: 2, label: 'Moar text!!1', textDirection: TextDirection.ltr),
|
||||
TestSemantics(
|
||||
id: 1,
|
||||
elevation: 1.0,
|
||||
thickness: 0.0,
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(id: 2, label: 'I am text!', textDirection: TextDirection.ltr),
|
||||
TestSemantics(id: 3, label: 'Moar text!!1', textDirection: TextDirection.ltr),
|
||||
TestSemantics(
|
||||
id: 4,
|
||||
label: 'Button',
|
||||
textDirection: TextDirection.ltr,
|
||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isButton,
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isFocusable,
|
||||
],
|
||||
),
|
||||
id: 3,
|
||||
label: 'Button',
|
||||
textDirection: TextDirection.ltr,
|
||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isButton,
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isFocusable,
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@ -1,284 +0,0 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../widgets/semantics_tester.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('SemanticsNodes overlapping in z', (WidgetTester tester) async {
|
||||
// Cards are semantic boundaries that always own their own SemanticNode,
|
||||
// PhysicalModels merge their semantics information into parent.
|
||||
//
|
||||
// Side view of the widget tree:
|
||||
//
|
||||
// Card('abs. elevation: 30') ---------------
|
||||
// | 8 ----------- Card('abs. elevation 25')
|
||||
// Card('abs. elevation: 22') --------------- |
|
||||
// | 7 |
|
||||
// PhysicalModel('abs. elevation: 15') --------------- | 15
|
||||
// | 5 |
|
||||
// --------------------------------------- Card('abs. elevation: 10')
|
||||
// | 10
|
||||
// |
|
||||
// --------------------------------------- 'ground'
|
||||
final SemanticsTester semantics = SemanticsTester(tester);
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: Column(
|
||||
children: <Widget>[
|
||||
Text('ground'),
|
||||
Card(
|
||||
elevation: 10.0,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Text('absolute elevation: 10'),
|
||||
PhysicalModel(
|
||||
elevation: 5.0,
|
||||
color: Colors.black,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Text('absolute elevation: 15'),
|
||||
Card(
|
||||
elevation: 7.0,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Text('absolute elevation: 22'),
|
||||
Card(elevation: 8.0, child: Text('absolute elevation: 30')),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Card(elevation: 15.0, child: Text('absolute elevation: 25')),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
final SemanticsNode ground = tester.getSemantics(find.text('ground'));
|
||||
expect(ground.thickness, 0.0);
|
||||
expect(ground.elevation, 0.0);
|
||||
expect(ground.label, 'ground');
|
||||
|
||||
final SemanticsNode elevation10 = tester.getSemantics(find.text('absolute elevation: 10'));
|
||||
final SemanticsNode elevation15 = tester.getSemantics(find.text('absolute elevation: 15'));
|
||||
expect(elevation10, same(elevation15)); // configs got merged into each other.
|
||||
expect(elevation10.thickness, 15.0);
|
||||
expect(elevation10.elevation, 0.0);
|
||||
expect(elevation10.label, 'absolute elevation: 10\nabsolute elevation: 15');
|
||||
|
||||
final SemanticsNode elevation22 = tester.getSemantics(find.text('absolute elevation: 22'));
|
||||
expect(elevation22.thickness, 7.0);
|
||||
expect(elevation22.elevation, 15.0);
|
||||
expect(elevation22.label, 'absolute elevation: 22');
|
||||
|
||||
final SemanticsNode elevation25 = tester.getSemantics(find.text('absolute elevation: 25'));
|
||||
expect(elevation25.thickness, 15.0);
|
||||
expect(elevation25.elevation, 10.0);
|
||||
expect(elevation22.label, 'absolute elevation: 22');
|
||||
|
||||
final SemanticsNode elevation30 = tester.getSemantics(find.text('absolute elevation: 30'));
|
||||
expect(elevation30.thickness, 8.0);
|
||||
expect(elevation30.elevation, 7.0);
|
||||
expect(elevation30.label, 'absolute elevation: 30');
|
||||
|
||||
semantics.dispose();
|
||||
});
|
||||
|
||||
testWidgets('SemanticsNodes overlapping in z with switched children', (
|
||||
WidgetTester tester,
|
||||
) async {
|
||||
// Same as 'SemanticsNodes overlapping in z', but the order of children
|
||||
// is reversed
|
||||
|
||||
final SemanticsTester semantics = SemanticsTester(tester);
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: Column(
|
||||
children: <Widget>[
|
||||
Text('ground'),
|
||||
Card(
|
||||
elevation: 10.0,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Card(elevation: 15.0, child: Text('absolute elevation: 25')),
|
||||
PhysicalModel(
|
||||
elevation: 5.0,
|
||||
color: Colors.black,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Text('absolute elevation: 15'),
|
||||
Card(
|
||||
elevation: 7.0,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Text('absolute elevation: 22'),
|
||||
Card(elevation: 8.0, child: Text('absolute elevation: 30')),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Text('absolute elevation: 10'),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
final SemanticsNode ground = tester.getSemantics(find.text('ground'));
|
||||
expect(ground.thickness, 0.0);
|
||||
expect(ground.elevation, 0.0);
|
||||
expect(ground.label, 'ground');
|
||||
|
||||
final SemanticsNode elevation10 = tester.getSemantics(find.text('absolute elevation: 10'));
|
||||
final SemanticsNode elevation15 = tester.getSemantics(find.text('absolute elevation: 15'));
|
||||
expect(elevation10, same(elevation15)); // configs got merged into each other.
|
||||
expect(elevation10.thickness, 15.0);
|
||||
expect(elevation10.elevation, 0.0);
|
||||
expect(elevation10.label, 'absolute elevation: 15\nabsolute elevation: 10');
|
||||
|
||||
final SemanticsNode elevation22 = tester.getSemantics(find.text('absolute elevation: 22'));
|
||||
expect(elevation22.thickness, 7.0);
|
||||
expect(elevation22.elevation, 15.0);
|
||||
expect(elevation22.label, 'absolute elevation: 22');
|
||||
|
||||
final SemanticsNode elevation25 = tester.getSemantics(find.text('absolute elevation: 25'));
|
||||
expect(elevation25.thickness, 15.0);
|
||||
expect(elevation25.elevation, 10.0);
|
||||
expect(elevation22.label, 'absolute elevation: 22');
|
||||
|
||||
final SemanticsNode elevation30 = tester.getSemantics(find.text('absolute elevation: 30'));
|
||||
expect(elevation30.thickness, 8.0);
|
||||
expect(elevation30.elevation, 7.0);
|
||||
expect(elevation30.label, 'absolute elevation: 30');
|
||||
|
||||
semantics.dispose();
|
||||
});
|
||||
|
||||
testWidgets('single node thickness', (WidgetTester tester) async {
|
||||
final SemanticsTester semantics = SemanticsTester(tester);
|
||||
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(home: Center(child: Material(elevation: 24.0, child: Text('Hello')))),
|
||||
);
|
||||
|
||||
final SemanticsNode node = tester.getSemantics(find.text('Hello'));
|
||||
expect(node.thickness, 0.0);
|
||||
expect(node.elevation, 24.0);
|
||||
expect(node.label, 'Hello');
|
||||
|
||||
semantics.dispose();
|
||||
});
|
||||
|
||||
testWidgets('force-merge', (WidgetTester tester) async {
|
||||
final SemanticsTester semantics = SemanticsTester(tester);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Card(
|
||||
elevation: 10.0,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
const Text('abs. elevation: 10.0'),
|
||||
MergeSemantics(
|
||||
child: Semantics(
|
||||
explicitChildNodes:
|
||||
true, // just to be sure that it's going to be an explicit merge
|
||||
child: const Column(
|
||||
children: <Widget>[
|
||||
Card(elevation: 15.0, child: Text('abs. elevation 25.0')),
|
||||
Card(elevation: 5.0, child: Text('abs. elevation 15.0')),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
final SemanticsNode elevation10 = tester.getSemantics(find.text('abs. elevation: 10.0'));
|
||||
expect(elevation10.thickness, 10.0);
|
||||
expect(elevation10.elevation, 0.0);
|
||||
expect(elevation10.label, 'abs. elevation: 10.0');
|
||||
expect(elevation10.childrenCount, 1);
|
||||
|
||||
// TODO(goderbauer): remove awkward workaround when accessing force-merged
|
||||
// SemanticsData becomes easier, https://github.com/flutter/flutter/issues/25669
|
||||
SemanticsData? mergedChildData;
|
||||
elevation10.visitChildren((SemanticsNode child) {
|
||||
expect(mergedChildData, isNull);
|
||||
mergedChildData = child.getSemanticsData();
|
||||
return true;
|
||||
});
|
||||
|
||||
expect(mergedChildData!.thickness, 15.0);
|
||||
expect(mergedChildData!.elevation, 10.0);
|
||||
expect(mergedChildData!.label, 'abs. elevation 25.0\nabs. elevation 15.0');
|
||||
|
||||
semantics.dispose();
|
||||
});
|
||||
|
||||
testWidgets('force-merge with inversed children', (WidgetTester tester) async {
|
||||
final SemanticsTester semantics = SemanticsTester(tester);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Card(
|
||||
elevation: 10.0,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
const Text('abs. elevation: 10.0'),
|
||||
MergeSemantics(
|
||||
child: Semantics(
|
||||
explicitChildNodes:
|
||||
true, // just to be sure that it's going to be an explicit merge
|
||||
child: const Column(
|
||||
children: <Widget>[
|
||||
Card(elevation: 5.0, child: Text('abs. elevation 15.0')),
|
||||
Card(elevation: 15.0, child: Text('abs. elevation 25.0')),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
final SemanticsNode elevation10 = tester.getSemantics(find.text('abs. elevation: 10.0'));
|
||||
expect(elevation10.thickness, 10.0);
|
||||
expect(elevation10.elevation, 0.0);
|
||||
expect(elevation10.label, 'abs. elevation: 10.0');
|
||||
expect(elevation10.childrenCount, 1);
|
||||
|
||||
// TODO(goderbauer): remove awkward workaround when accessing force-merged
|
||||
// SemanticsData becomes easier, https://github.com/flutter/flutter/issues/25669
|
||||
SemanticsData? mergedChildData;
|
||||
elevation10.visitChildren((SemanticsNode child) {
|
||||
expect(mergedChildData, isNull);
|
||||
mergedChildData = child.getSemanticsData();
|
||||
return true;
|
||||
});
|
||||
|
||||
expect(mergedChildData!.thickness, 15.0);
|
||||
expect(mergedChildData!.elevation, 10.0);
|
||||
expect(mergedChildData!.label, 'abs. elevation 15.0\nabs. elevation 25.0');
|
||||
|
||||
semantics.dispose();
|
||||
});
|
||||
}
|
||||
@ -731,8 +731,6 @@ void main() {
|
||||
' scrollPosition: null\n'
|
||||
' scrollExtentMax: null\n'
|
||||
' indexInParent: null\n'
|
||||
' elevation: 0.0\n'
|
||||
' thickness: 0.0\n'
|
||||
' headingLevel: 0\n',
|
||||
);
|
||||
|
||||
@ -867,8 +865,6 @@ void main() {
|
||||
' scrollPosition: null\n'
|
||||
' scrollExtentMax: null\n'
|
||||
' indexInParent: null\n'
|
||||
' elevation: 0.0\n'
|
||||
' thickness: 0.0\n'
|
||||
' headingLevel: 0\n',
|
||||
);
|
||||
});
|
||||
|
||||
@ -206,8 +206,6 @@ class SemanticsUpdateBuilderSpy extends Fake implements ui.SemanticsUpdateBuilde
|
||||
required double scrollPosition,
|
||||
required double scrollExtentMax,
|
||||
required double scrollExtentMin,
|
||||
required double elevation,
|
||||
required double thickness,
|
||||
required Rect rect,
|
||||
required String identifier,
|
||||
required String label,
|
||||
|
||||
@ -48,8 +48,6 @@ class TestSemantics {
|
||||
this.textDirection,
|
||||
this.rect,
|
||||
this.transform,
|
||||
this.elevation,
|
||||
this.thickness,
|
||||
this.textSelection,
|
||||
this.children = const <TestSemantics>[],
|
||||
this.scrollIndex,
|
||||
@ -100,8 +98,6 @@ class TestSemantics {
|
||||
assert(flags is int || flags is List<SemanticsFlag>),
|
||||
assert(actions is int || actions is List<SemanticsAction>),
|
||||
rect = TestSemantics.rootRect,
|
||||
elevation = 0.0,
|
||||
thickness = 0.0,
|
||||
tags = tags?.toSet() ?? <SemanticsTag>{};
|
||||
|
||||
/// Creates an object with some test semantics data, with the [id] and [rect]
|
||||
@ -128,8 +124,6 @@ class TestSemantics {
|
||||
this.textDirection,
|
||||
this.rect,
|
||||
Matrix4? transform,
|
||||
this.elevation,
|
||||
this.thickness,
|
||||
this.textSelection,
|
||||
this.children = const <TestSemantics>[],
|
||||
this.scrollIndex,
|
||||
@ -233,21 +227,6 @@ class TestSemantics {
|
||||
/// parent).
|
||||
final Matrix4? transform;
|
||||
|
||||
/// The elevation of this node relative to the parent node.
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [SemanticsConfiguration.elevation] for a detailed discussion regarding
|
||||
/// elevation and semantics.
|
||||
final double? elevation;
|
||||
|
||||
/// The extend that this node occupies in z-direction starting at [elevation].
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [SemanticsConfiguration.thickness] for a more detailed definition.
|
||||
final double? thickness;
|
||||
|
||||
/// The index of the first visible semantic node within a scrollable.
|
||||
final int? scrollIndex;
|
||||
|
||||
@ -419,16 +398,6 @@ class TestSemantics {
|
||||
'expected node id $id to have transform $transform but found transform:\n${nodeData.transform}.',
|
||||
);
|
||||
}
|
||||
if (elevation != null && elevation != nodeData.elevation) {
|
||||
return fail(
|
||||
'expected node id $id to have elevation $elevation but found elevation:\n${nodeData.elevation}.',
|
||||
);
|
||||
}
|
||||
if (thickness != null && thickness != nodeData.thickness) {
|
||||
return fail(
|
||||
'expected node id $id to have thickness $thickness but found thickness:\n${nodeData.thickness}.',
|
||||
);
|
||||
}
|
||||
if (textSelection?.baseOffset != nodeData.textSelection?.baseOffset ||
|
||||
textSelection?.extentOffset != nodeData.textSelection?.extentOffset) {
|
||||
return fail(
|
||||
@ -583,12 +552,6 @@ class TestSemantics {
|
||||
'$indent transform:\n${transform.toString().trim().split('\n').map<String>((String line) => '$indent $line').join('\n')},',
|
||||
);
|
||||
}
|
||||
if (elevation != null) {
|
||||
buf.writeln('$indent elevation: $elevation,');
|
||||
}
|
||||
if (thickness != null) {
|
||||
buf.writeln('$indent thickness: $thickness,');
|
||||
}
|
||||
if (inputType != SemanticsInputType.none) {
|
||||
buf.writeln('$indent inputType: $inputType,');
|
||||
}
|
||||
|
||||
@ -97,11 +97,9 @@ void main() {
|
||||
TestSemantics(
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
thickness: 0,
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
label: 'Hello',
|
||||
elevation: 0,
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isHeader, SemanticsFlag.namesRoute],
|
||||
textDirection: TextDirection.ltr,
|
||||
),
|
||||
|
||||
@ -762,8 +762,6 @@ Matcher matchesSemantics({
|
||||
textDirection: textDirection,
|
||||
rect: rect,
|
||||
size: size,
|
||||
elevation: elevation,
|
||||
thickness: thickness,
|
||||
platformViewId: platformViewId,
|
||||
customActions: customActions,
|
||||
maxValueLength: maxValueLength,
|
||||
@ -960,8 +958,6 @@ Matcher containsSemantics({
|
||||
textDirection: textDirection,
|
||||
rect: rect,
|
||||
size: size,
|
||||
elevation: elevation,
|
||||
thickness: thickness,
|
||||
platformViewId: platformViewId,
|
||||
customActions: customActions,
|
||||
maxValueLength: maxValueLength,
|
||||
@ -2392,8 +2388,6 @@ class _MatchesSemanticsData extends Matcher {
|
||||
required this.textDirection,
|
||||
required this.rect,
|
||||
required this.size,
|
||||
required this.elevation,
|
||||
required this.thickness,
|
||||
required this.platformViewId,
|
||||
required this.maxValueLength,
|
||||
required this.currentValueLength,
|
||||
@ -2547,8 +2541,6 @@ class _MatchesSemanticsData extends Matcher {
|
||||
final TextDirection? textDirection;
|
||||
final Rect? rect;
|
||||
final Size? size;
|
||||
final double? elevation;
|
||||
final double? thickness;
|
||||
final int? platformViewId;
|
||||
final int? maxValueLength;
|
||||
final int? currentValueLength;
|
||||
@ -2650,12 +2642,6 @@ class _MatchesSemanticsData extends Matcher {
|
||||
if (size != null) {
|
||||
description.add(' with size: $size');
|
||||
}
|
||||
if (elevation != null) {
|
||||
description.add(' with elevation: $elevation');
|
||||
}
|
||||
if (thickness != null) {
|
||||
description.add(' with thickness: $thickness');
|
||||
}
|
||||
if (platformViewId != null) {
|
||||
description.add(' with platformViewId: $platformViewId');
|
||||
}
|
||||
@ -2795,12 +2781,6 @@ class _MatchesSemanticsData extends Matcher {
|
||||
if (size != null && size != data.rect.size) {
|
||||
return failWithDescription(matchState, 'size was: ${data.rect.size}');
|
||||
}
|
||||
if (elevation != null && elevation != data.elevation) {
|
||||
return failWithDescription(matchState, 'elevation was: ${data.elevation}');
|
||||
}
|
||||
if (thickness != null && thickness != data.thickness) {
|
||||
return failWithDescription(matchState, 'thickness was: ${data.thickness}');
|
||||
}
|
||||
if (platformViewId != null && platformViewId != data.platformViewId) {
|
||||
return failWithDescription(matchState, 'platformViewId was: ${data.platformViewId}');
|
||||
}
|
||||
|
||||
@ -746,8 +746,6 @@ void main() {
|
||||
tooltip: 'f',
|
||||
textDirection: TextDirection.ltr,
|
||||
rect: const Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
|
||||
elevation: 3.0,
|
||||
thickness: 4.0,
|
||||
textSelection: null,
|
||||
scrollIndex: null,
|
||||
scrollChildCount: null,
|
||||
@ -1048,8 +1046,6 @@ void main() {
|
||||
tooltip: 'f',
|
||||
textDirection: TextDirection.ltr,
|
||||
rect: const Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
|
||||
elevation: 3.0,
|
||||
thickness: 4.0,
|
||||
textSelection: null,
|
||||
scrollIndex: null,
|
||||
scrollChildCount: null,
|
||||
@ -1150,8 +1146,6 @@ void main() {
|
||||
tooltip: 'f',
|
||||
textDirection: TextDirection.ltr,
|
||||
rect: const Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
|
||||
elevation: 3.0,
|
||||
thickness: 4.0,
|
||||
textSelection: null,
|
||||
scrollIndex: null,
|
||||
scrollChildCount: null,
|
||||
@ -1256,8 +1250,6 @@ void main() {
|
||||
tooltip: 'f',
|
||||
textDirection: TextDirection.ltr,
|
||||
rect: const Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
|
||||
elevation: 3.0,
|
||||
thickness: 4.0,
|
||||
textSelection: null,
|
||||
scrollIndex: null,
|
||||
scrollChildCount: null,
|
||||
@ -1289,8 +1281,6 @@ void main() {
|
||||
tooltip: 'f',
|
||||
textDirection: TextDirection.ltr,
|
||||
rect: const Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
|
||||
elevation: 3.0,
|
||||
thickness: 4.0,
|
||||
textSelection: null,
|
||||
scrollIndex: null,
|
||||
scrollChildCount: null,
|
||||
@ -1379,8 +1369,6 @@ void main() {
|
||||
tooltip: 'f',
|
||||
textDirection: TextDirection.ltr,
|
||||
rect: const Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
|
||||
elevation: 3.0,
|
||||
thickness: 4.0,
|
||||
textSelection: null,
|
||||
scrollIndex: null,
|
||||
scrollChildCount: null,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user