Repository navigation
Commit 20c755d
authored
Fixes OverlayPortal semantics bounds corruption (flutter#192139)
fixes flutter#182604
Historically, the configuration/order of children and parents for
widgets is identical across both traversal and hit test order. However,
with introduction over OverlayPortal,
flutter@fccfa97,
this is no longer always the case.
For example when traversing, the actual portal child, eg, a floating
drop down box, is a child of the `OverlayPortal`. However when hit
testing, the portal child is a child of the `Overlay`.
Prior to this pr, both setChildrenInHitTestOrder and setChildren have
identical implementations.
```
for (SemanticsObject* child in _childrenInHitTestOrder) {
if (child.parent == self) {
child.parent = nil;
}
}
_childrenInHitTestOrder = [childrenInHitTestOrder copy];
for (SemanticsObject* child in _childrenInHitTestOrder) {
child.parent = self;
}
```
On every frame, setChildren and setChildrenInHitTestOrder is run
sequentially on every widget.
So first, when setChildren is run for `OverlayPortal`, it sets
`portalChild.parent = overlayPortal`. This is the correct traversal
order.
Then, sometime later, it runs setChildrenInHitTestOrder for `Overlay`,
which sets portalChild.parent = overlay`. This is incorrect.
This is why in the bug the accessibility nodes still exist, just weirdly
offset - because its now anchored to 0, 0 of `Overlay` instead of the
the position over `OverlayPortal`.
Because hittest order strictly walks top down (parent isnt ever
accessed), we don't actually have to do any mutation to the parents.
https://github.com/user-attachments/assets/df093797-7482-42ba-ba4c-b9a1724840311 parent aa36805 commit 20c755d
2 files changed
Lines changed: 18 additions & 8 deletions
File tree
- engine/src/flutter/shell/platform/darwin/ios/framework/Source
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | 334 | | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | 335 | | |
344 | 336 | | |
345 | 337 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
91 | 109 | | |
92 | 110 | | |
93 | 111 | | |
| |||
0 commit comments