From b860982938199af9007bfaec0581cb541bfe1043 Mon Sep 17 00:00:00 2001 From: chunhtai <47866232+chunhtai@users.noreply.github.com> Date: Thu, 12 Aug 2021 17:32:03 -0700 Subject: [PATCH] remove _AbortingSemanticsFragment (#88067) --- .../flutter/lib/src/rendering/object.dart | 64 +------------------ 1 file changed, 1 insertion(+), 63 deletions(-) diff --git a/packages/flutter/lib/src/rendering/object.dart b/packages/flutter/lib/src/rendering/object.dart index 52e49e5b53..d60c8b684c 100644 --- a/packages/flutter/lib/src/rendering/object.dart +++ b/packages/flutter/lib/src/rendering/object.dart @@ -2754,25 +2754,11 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im final Set<_InterestingSemanticsFragment> toBeMarkedExplicit = <_InterestingSemanticsFragment>{}; final bool childrenMergeIntoParent = mergeIntoParent || config.isMergingSemanticsOfDescendants; - // When set to true there's currently not enough information in this subtree - // to compute semantics. In this case the walk needs to be aborted and no - // SemanticsNodes in the subtree should be updated. - // This will be true for subtrees that are currently kept alive by a - // viewport but not laid out. - bool abortWalk = false; - visitChildrenForSemantics((RenderObject renderChild) { - if (abortWalk || _needsLayout) { - abortWalk = true; - return; - } + assert(!_needsLayout); final _SemanticsFragment parentFragment = renderChild._getSemanticsForParent( mergeIntoParent: childrenMergeIntoParent, ); - if (parentFragment.abortsWalk) { - abortWalk = true; - return; - } if (parentFragment.dropsSemanticsOfPreviousSiblings) { fragments.clear(); toBeMarkedExplicit.clear(); @@ -2803,10 +2789,6 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im } }); - if (abortWalk) { - return _AbortingSemanticsFragment(owner: this); - } - for (final _InterestingSemanticsFragment fragment in toBeMarkedExplicit) fragment.markAsExplicit(); @@ -3535,17 +3517,6 @@ abstract class _SemanticsFragment { /// Returns [_InterestingSemanticsFragment] describing the actual semantic /// information that this fragment wants to add to the parent. List<_InterestingSemanticsFragment> get interestingFragments; - - /// Whether this fragment wants to abort the semantics walk because the - /// information in the tree are not sufficient to calculate semantics. - /// - /// This happens for subtrees that are currently kept alive by a viewport but - /// not laid out. - /// - /// See also: - /// - /// * [_AbortingSemanticsFragment], which sets this to true. - bool get abortsWalk => false; } /// A container used when a [RenderObject] wants to add multiple independent @@ -3859,39 +3830,6 @@ class _SwitchableSemanticsFragment extends _InterestingSemanticsFragment { bool get _needsGeometryUpdate => _ancestorChain.length > 1; } - -/// [_SemanticsFragment] used to indicate that the current information in this -/// subtree is not sufficient to update semantics. -/// -/// Anybody processing this [_SemanticsFragment] should abort the walk of the -/// current subtree without updating any [SemanticsNode]s as there is no semantic -/// information to compute. As a result, this fragment also doesn't carry any -/// semantics information either. -class _AbortingSemanticsFragment extends _InterestingSemanticsFragment { - _AbortingSemanticsFragment({required RenderObject owner}) : super(owner: owner, dropsSemanticsOfPreviousSiblings: false); - - @override - bool get abortsWalk => true; - - @override - SemanticsConfiguration? get config => null; - - @override - void addAll(Iterable<_InterestingSemanticsFragment> fragments) { - assert(false); - } - - @override - void compileChildren({ Rect? parentSemanticsClipRect, Rect? parentPaintClipRect, required double elevationAdjustment, required List result }) { - result.add(owner._semantics!); - } - - @override - void markAsExplicit() { - // Is never explicit. - } -} - /// Helper class that keeps track of the geometry of a [SemanticsNode]. /// /// It is used to annotate a [SemanticsNode] with the current information for