diff --git a/engine/src/flutter/lib/ui/fixtures/ui_test.dart b/engine/src/flutter/lib/ui/fixtures/ui_test.dart index fc920d608e7..0b3273db91d 100644 --- a/engine/src/flutter/lib/ui/fixtures/ui_test.dart +++ b/engine/src/flutter/lib/ui/fixtures/ui_test.dart @@ -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 [], diff --git a/engine/src/flutter/lib/ui/semantics.dart b/engine/src/flutter/lib/ui/semantics.dart index eeb6d903772..e1370039033 100644 --- a/engine/src/flutter/lib/ui/semantics.dart +++ b/engine/src/flutter/lib/ui/semantics.dart @@ -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 labelAttributes, diff --git a/engine/src/flutter/lib/ui/semantics/semantics_node.h b/engine/src/flutter/lib/ui/semantics/semantics_node.h index f1f410cbb0c..b4454eafbd7 100644 --- a/engine/src/flutter/lib/ui/semantics/semantics_node.h +++ b/engine/src/flutter/lib/ui/semantics/semantics_node.h @@ -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; diff --git a/engine/src/flutter/lib/ui/semantics/semantics_update_builder.cc b/engine/src/flutter/lib/ui/semantics/semantics_update_builder.cc index f7bb621ed21..8e4ba6884f8 100644 --- a/engine/src/flutter/lib/ui/semantics/semantics_update_builder.cc +++ b/engine/src/flutter/lib/ui/semantics/semantics_update_builder.cc @@ -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& 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); diff --git a/engine/src/flutter/lib/ui/semantics/semantics_update_builder.h b/engine/src/flutter/lib/ui/semantics/semantics_update_builder.h index 88139bcdcde..bbb3c3fb3c4 100644 --- a/engine/src/flutter/lib/ui/semantics/semantics_update_builder.h +++ b/engine/src/flutter/lib/ui/semantics/semantics_update_builder.h @@ -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& labelAttributes, diff --git a/engine/src/flutter/lib/web_ui/lib/semantics.dart b/engine/src/flutter/lib/web_ui/lib/semantics.dart index 26ca9e70850..7a847457459 100644 --- a/engine/src/flutter/lib/web_ui/lib/semantics.dart +++ b/engine/src/flutter/lib/web_ui/lib/semantics.dart @@ -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, diff --git a/engine/src/flutter/lib/web_ui/lib/src/engine/semantics/semantics.dart b/engine/src/flutter/lib/web_ui/lib/src/engine/semantics/semantics.dart index 825c96f8aa9..d571e631c88 100644 --- a/engine/src/flutter/lib/web_ui/lib/src/engine/semantics/semantics.dart +++ b/engine/src/flutter/lib/web_ui/lib/src/engine/semantics/semantics.dart @@ -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; diff --git a/engine/src/flutter/lib/web_ui/test/engine/semantics/semantics_test.dart b/engine/src/flutter/lib/web_ui/test/engine/semantics/semantics_test.dart index fe7099c0f45..a6671c15d4a 100644 --- a/engine/src/flutter/lib/web_ui/test/engine/semantics/semantics_test.dart +++ b/engine/src/flutter/lib/web_ui/test/engine/semantics/semantics_test.dart @@ -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, diff --git a/engine/src/flutter/lib/web_ui/test/engine/semantics/semantics_tester.dart b/engine/src/flutter/lib/web_ui/test/engine/semantics/semantics_tester.dart index 24e742249b7..266dce45845 100644 --- a/engine/src/flutter/lib/web_ui/test/engine/semantics/semantics_tester.dart +++ b/engine/src/flutter/lib/web_ui/test/engine/semantics/semantics_tester.dart @@ -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 [], tooltip: tooltip ?? '', transform: transform != null ? toMatrix32(transform) : Matrix4.identity().storage, - elevation: elevation ?? 0, - thickness: thickness ?? 0, childrenInTraversalOrder: childIds, childrenInHitTestOrder: childIds, additionalActions: additionalActions ?? Int32List(0), diff --git a/engine/src/flutter/shell/platform/common/accessibility_bridge.cc b/engine/src/flutter/shell/platform/common/accessibility_bridge.cc index 1913a580c50..b471da88178 100644 --- a/engine/src/flutter/shell/platform/common/accessibility_bridge.cc +++ b/engine/src/flutter/shell/platform/common/accessibility_bridge.cc @@ -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); } diff --git a/engine/src/flutter/shell/platform/common/accessibility_bridge.h b/engine/src/flutter/shell/platform/common/accessibility_bridge.h index 8126c1ce7b6..6b6f5758379 100644 --- a/engine/src/flutter/shell/platform/common/accessibility_bridge.h +++ b/engine/src/flutter/shell/platform/common/accessibility_bridge.h @@ -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; diff --git a/engine/src/flutter/shell/platform/embedder/embedder_semantics_update.cc b/engine/src/flutter/shell/platform/embedder/embedder_semantics_update.cc index 76f4d32680e..6376d49eedb 100644 --- a/engine/src/flutter/shell/platform/embedder/embedder_semantics_update.cc +++ b/engine/src/flutter/shell/platform/embedder/embedder_semantics_update.cc @@ -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(), diff --git a/engine/src/flutter/shell/platform/embedder/fixtures/main.dart b/engine/src/flutter/shell/platform/embedder/fixtures/main.dart index c83292dc23d..027923df8e5 100644 --- a/engine/src/flutter/shell/platform/embedder/fixtures/main.dart +++ b/engine/src/flutter/shell/platform/embedder/fixtures/main.dart @@ -185,8 +185,6 @@ Future a11y_main() async { scrollPosition: 0.0, scrollExtentMax: 0.0, scrollExtentMin: 0.0, - elevation: 0.0, - thickness: 0.0, hint: '', hintAttributes: [], value: '', @@ -220,8 +218,6 @@ Future a11y_main() async { scrollPosition: 0.0, scrollExtentMax: 0.0, scrollExtentMin: 0.0, - elevation: 0.0, - thickness: 0.0, hint: '', hintAttributes: [], value: '', @@ -259,8 +255,6 @@ Future a11y_main() async { scrollPosition: 0.0, scrollExtentMax: 0.0, scrollExtentMin: 0.0, - elevation: 0.0, - thickness: 0.0, hint: '', hintAttributes: [], value: '', @@ -295,8 +289,6 @@ Future a11y_main() async { scrollPosition: 0.0, scrollExtentMax: 0.0, scrollExtentMin: 0.0, - elevation: 0.0, - thickness: 0.0, hint: '', hintAttributes: [], value: '', @@ -368,8 +360,6 @@ Future 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: [ LocaleStringAttribute( @@ -1683,8 +1673,6 @@ Future a11y_main_multi_view() async { scrollPosition: 0.0, scrollExtentMax: 0.0, scrollExtentMin: 0.0, - elevation: 0.0, - thickness: 0.0, hint: '', hintAttributes: [], value: '', diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/accessibility_bridge.cc b/engine/src/flutter/shell/platform/fuchsia/flutter/accessibility_bridge.cc index e7c9ecf825a..e67ce3264e2 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/accessibility_bridge.cc +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/accessibility_bridge.cc @@ -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(node.elevation); box.max.x = node.rect.fRight; box.max.y = node.rect.fBottom; - box.max.z = static_cast(node.thickness); return box; } diff --git a/engine/src/flutter/shell/platform/windows/fixtures/main.dart b/engine/src/flutter/shell/platform/windows/fixtures/main.dart index a9d341cee05..b811fab5b03 100644 --- a/engine/src/flutter/shell/platform/windows/fixtures/main.dart +++ b/engine/src/flutter/shell/platform/windows/fixtures/main.dart @@ -446,8 +446,6 @@ Future 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 [], diff --git a/engine/src/flutter/testing/ios_scenario_app/lib/src/locale_initialization.dart b/engine/src/flutter/testing/ios_scenario_app/lib/src/locale_initialization.dart index c482f49d32c..bbee88f0c8c 100644 --- a/engine/src/flutter/testing/ios_scenario_app/lib/src/locale_initialization.dart +++ b/engine/src/flutter/testing/ios_scenario_app/lib/src/locale_initialization.dart @@ -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: [], 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: [], value: '', diff --git a/packages/flutter/lib/src/rendering/object.dart b/packages/flutter/lib/src/rendering/object.dart index 9e560d4532f..63abf78de61 100644 --- a/packages/flutter/lib/src/rendering/object.dart +++ b/packages/flutter/lib/src/rendering/object.dart @@ -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> siblingMergeGroups = >[]; @@ -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: {}, elevationAdjustment: 0.0); + _buildSemanticsSubtree(usedSemanticsIds: {}); } } @@ -5435,11 +5427,10 @@ class _RenderObjectSemantics extends _SemanticsFragment with DiagnosticableTreeM /// Builds the semantics subtree under the [cachedSemanticsNode]. void _buildSemanticsSubtree({ required Set usedSemanticsIds, - required double elevationAdjustment, List? semanticsNodes, }) { final List children = []; - 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(); } diff --git a/packages/flutter/lib/src/rendering/proxy_box.dart b/packages/flutter/lib/src/rendering/proxy_box.dart index 9e927b9df3e..a16bdad8113 100644 --- a/packages/flutter/lib/src/rendering/proxy_box.dart +++ b/packages/flutter/lib/src/rendering/proxy_box.dart @@ -2048,12 +2048,6 @@ abstract class _RenderPhysicalModelBase extends _RenderCustomClip { markNeedsPaint(); } - @override - void describeSemanticsConfiguration(SemanticsConfiguration config) { - super.describeSemanticsConfiguration(config); - config.elevation = elevation; - } - @override void debugFillProperties(DiagnosticPropertiesBuilder description) { super.debugFillProperties(description); diff --git a/packages/flutter/lib/src/semantics/semantics.dart b/packages/flutter/lib/src/semantics/semantics.dart index 7c36ae16499..3c62c1c2157 100644 --- a/packages/flutter/lib/src/semantics/semantics.dart +++ b/packages/flutter/lib/src/semantics/semantics.dart @@ -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, 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 actionSummary = [ 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: - /// - /// ![A diagram illustrating the elevations of three PhysicalModels and their - /// corresponding SemanticsNodes.](https://flutter.github.io/assets-for-api-docs/assets/semantics/SemanticsNode.thickness.png) - /// - /// 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? 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('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 diff --git a/packages/flutter/test/material/bottom_navigation_bar_test.dart b/packages/flutter/test/material/bottom_navigation_bar_test.dart index fb4a8c4c192..f61208979fd 100644 --- a/packages/flutter/test/material/bottom_navigation_bar_test.dart +++ b/packages/flutter/test/material/bottom_navigation_bar_test.dart @@ -2538,35 +2538,25 @@ void main() { flags: [SemanticsFlag.scopesRoute], children: [ TestSemantics( - children: [ - TestSemantics( - flags: [ - SemanticsFlag.isButton, - SemanticsFlag.isFocusable, - SemanticsFlag.hasSelectedState, - SemanticsFlag.isSelected, - ], - actions: [ - SemanticsAction.tap, - SemanticsAction.focus, - ], - label: 'A\nTab 1 of 2', - textDirection: TextDirection.ltr, - ), - TestSemantics( - flags: [ - SemanticsFlag.isButton, - SemanticsFlag.isFocusable, - SemanticsFlag.hasSelectedState, - ], - actions: [ - SemanticsAction.tap, - SemanticsAction.focus, - ], - label: 'B\nTab 2 of 2', - textDirection: TextDirection.ltr, - ), + flags: [ + SemanticsFlag.isButton, + SemanticsFlag.isFocusable, + SemanticsFlag.hasSelectedState, + SemanticsFlag.isSelected, ], + actions: [SemanticsAction.tap, SemanticsAction.focus], + label: 'A\nTab 1 of 2', + textDirection: TextDirection.ltr, + ), + TestSemantics( + flags: [ + SemanticsFlag.isButton, + SemanticsFlag.isFocusable, + SemanticsFlag.hasSelectedState, + ], + actions: [SemanticsAction.tap, SemanticsAction.focus], + label: 'B\nTab 2 of 2', + textDirection: TextDirection.ltr, ), ], ), diff --git a/packages/flutter/test/material/bottom_sheet_test.dart b/packages/flutter/test/material/bottom_sheet_test.dart index 3a4dad84a7c..b462b07b647 100644 --- a/packages/flutter/test/material/bottom_sheet_test.dart +++ b/packages/flutter/test/material/bottom_sheet_test.dart @@ -1100,16 +1100,9 @@ void main() { flags: [SemanticsFlag.scopesRoute, SemanticsFlag.namesRoute], children: [ TestSemantics( + flags: [SemanticsFlag.hasImplicitScrolling], children: [ - TestSemantics( - flags: [SemanticsFlag.hasImplicitScrolling], - children: [ - TestSemantics( - label: 'BottomSheet', - textDirection: TextDirection.ltr, - ), - ], - ), + TestSemantics(label: 'BottomSheet', textDirection: TextDirection.ltr), ], ), ], @@ -1174,17 +1167,12 @@ void main() { flags: [SemanticsFlag.scopesRoute, SemanticsFlag.namesRoute], children: [ TestSemantics( - label: 'BottomSheet', + flags: [SemanticsFlag.isButton], + actions: [SemanticsAction.tap], + label: 'Dismiss', textDirection: TextDirection.ltr, - children: [ - TestSemantics( - flags: [SemanticsFlag.isButton], - actions: [SemanticsAction.tap], - label: 'Dismiss', - textDirection: TextDirection.ltr, - ), - ], ), + TestSemantics(label: 'BottomSheet', textDirection: TextDirection.ltr), ], ), ], diff --git a/packages/flutter/test/material/card_test.dart b/packages/flutter/test/material/card_test.dart index d049d87d049..770e2cc4ba6 100644 --- a/packages/flutter/test/material/card_test.dart +++ b/packages/flutter/test/material/card_test.dart @@ -101,25 +101,18 @@ void main() { hasSemantics( TestSemantics.root( children: [ + 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(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.tap, SemanticsAction.focus], - flags: [ - SemanticsFlag.hasEnabledState, - SemanticsFlag.isButton, - SemanticsFlag.isEnabled, - SemanticsFlag.isFocusable, - ], - ), + id: 3, + label: 'Button', + textDirection: TextDirection.ltr, + actions: [SemanticsAction.tap, SemanticsAction.focus], + flags: [ + SemanticsFlag.hasEnabledState, + SemanticsFlag.isButton, + SemanticsFlag.isEnabled, + SemanticsFlag.isFocusable, ], ), ], diff --git a/packages/flutter/test/semantics/semantics_elevation_test.dart b/packages/flutter/test/semantics/semantics_elevation_test.dart deleted file mode 100644 index e6a3a86fd2b..00000000000 --- a/packages/flutter/test/semantics/semantics_elevation_test.dart +++ /dev/null @@ -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: [ - Text('ground'), - Card( - elevation: 10.0, - child: Column( - children: [ - Text('absolute elevation: 10'), - PhysicalModel( - elevation: 5.0, - color: Colors.black, - child: Column( - children: [ - Text('absolute elevation: 15'), - Card( - elevation: 7.0, - child: Column( - children: [ - 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: [ - Text('ground'), - Card( - elevation: 10.0, - child: Column( - children: [ - Card(elevation: 15.0, child: Text('absolute elevation: 25')), - PhysicalModel( - elevation: 5.0, - color: Colors.black, - child: Column( - children: [ - Text('absolute elevation: 15'), - Card( - elevation: 7.0, - child: Column( - children: [ - 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: [ - 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: [ - 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: [ - 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: [ - 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(); - }); -} diff --git a/packages/flutter/test/semantics/semantics_test.dart b/packages/flutter/test/semantics/semantics_test.dart index b7129d95667..ae9bb8e104a 100644 --- a/packages/flutter/test/semantics/semantics_test.dart +++ b/packages/flutter/test/semantics/semantics_test.dart @@ -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', ); }); diff --git a/packages/flutter/test/semantics/semantics_update_test.dart b/packages/flutter/test/semantics/semantics_update_test.dart index 8f6c7d6c3d4..02e9804f464 100644 --- a/packages/flutter/test/semantics/semantics_update_test.dart +++ b/packages/flutter/test/semantics/semantics_update_test.dart @@ -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, diff --git a/packages/flutter/test/widgets/semantics_tester.dart b/packages/flutter/test/widgets/semantics_tester.dart index 6f526ea43a0..e782072b953 100644 --- a/packages/flutter/test/widgets/semantics_tester.dart +++ b/packages/flutter/test/widgets/semantics_tester.dart @@ -48,8 +48,6 @@ class TestSemantics { this.textDirection, this.rect, this.transform, - this.elevation, - this.thickness, this.textSelection, this.children = const [], this.scrollIndex, @@ -100,8 +98,6 @@ class TestSemantics { assert(flags is int || flags is List), assert(actions is int || actions is List), rect = TestSemantics.rootRect, - elevation = 0.0, - thickness = 0.0, tags = tags?.toSet() ?? {}; /// 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 [], 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 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,'); } diff --git a/packages/flutter/test/widgets/slivers_appbar_floating_pinned_test.dart b/packages/flutter/test/widgets/slivers_appbar_floating_pinned_test.dart index 01218603b30..052e8846306 100644 --- a/packages/flutter/test/widgets/slivers_appbar_floating_pinned_test.dart +++ b/packages/flutter/test/widgets/slivers_appbar_floating_pinned_test.dart @@ -97,11 +97,9 @@ void main() { TestSemantics( children: [ TestSemantics( - thickness: 0, children: [ TestSemantics( label: 'Hello', - elevation: 0, flags: [SemanticsFlag.isHeader, SemanticsFlag.namesRoute], textDirection: TextDirection.ltr, ), diff --git a/packages/flutter_test/lib/src/matchers.dart b/packages/flutter_test/lib/src/matchers.dart index e1079c816ca..a6ca25b3d08 100644 --- a/packages/flutter_test/lib/src/matchers.dart +++ b/packages/flutter_test/lib/src/matchers.dart @@ -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}'); } diff --git a/packages/flutter_test/test/matchers_test.dart b/packages/flutter_test/test/matchers_test.dart index 56b9a6ae09d..d337b3fcda6 100644 --- a/packages/flutter_test/test/matchers_test.dart +++ b/packages/flutter_test/test/matchers_test.dart @@ -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,