remove _AbortingSemanticsFragment (#88067)
This commit is contained in:
@@ -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<SemanticsNode> 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
|
||||
|
||||
Reference in New Issue
Block a user