mirror of
https://github.com/flutter/flutter
synced 2024-10-13 11:42:54 +00:00
Roll engine; pass semantics child orders (#16970)
* pass semantics children in traversal and hit test orders * explain why we are inverting _children * Roll engine
This commit is contained in:
parent
7471ff8c89
commit
4beb57c324
|
@ -1 +1 @@
|
|||
d2448888a11ab958beece5ef6df99c8d069d09db
|
||||
f876bd57106b527cf6ddc8c9a97d0beb4190f868
|
||||
|
|
|
@ -1346,15 +1346,23 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin {
|
|||
void _addToUpdate(ui.SemanticsUpdateBuilder builder) {
|
||||
assert(_dirty);
|
||||
final SemanticsData data = getSemanticsData();
|
||||
Int32List children;
|
||||
Int32List childrenInTraversalOrder;
|
||||
Int32List childrenInHitTestOrder;
|
||||
if (!hasChildren || mergeAllDescendantsIntoThisNode) {
|
||||
children = _kEmptyChildList;
|
||||
childrenInTraversalOrder = _kEmptyChildList;
|
||||
childrenInHitTestOrder = _kEmptyChildList;
|
||||
} else {
|
||||
final int childCount = _children.length;
|
||||
final List<SemanticsNode> sortedChildren = _childrenInTraversalOrder();
|
||||
final int childCount = sortedChildren.length;
|
||||
children = new Int32List(childCount);
|
||||
for (int i = 0; i < childCount; ++i) {
|
||||
children[i] = sortedChildren[i].id;
|
||||
childrenInTraversalOrder = new Int32List(childCount);
|
||||
for (int i = 0; i < childCount; i += 1) {
|
||||
childrenInTraversalOrder[i] = sortedChildren[i].id;
|
||||
}
|
||||
// _children is sorted in paint order, so we invert it to get the hit test
|
||||
// order.
|
||||
childrenInHitTestOrder = new Int32List(childCount);
|
||||
for (int i = childCount - 1; i >= 0; i -= 1) {
|
||||
childrenInHitTestOrder[i] = _children[i].id;
|
||||
}
|
||||
}
|
||||
builder.updateNode(
|
||||
|
@ -1374,7 +1382,8 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin {
|
|||
scrollExtentMax: data.scrollExtentMax != null ? data.scrollExtentMax : double.nan,
|
||||
scrollExtentMin: data.scrollExtentMin != null ? data.scrollExtentMin : double.nan,
|
||||
transform: data.transform?.storage ?? _kIdentityTransform,
|
||||
children: children,
|
||||
childrenInTraversalOrder: childrenInTraversalOrder,
|
||||
childrenInHitTestOrder: childrenInHitTestOrder,
|
||||
);
|
||||
_dirty = false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue