-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Updates mark needs semantics update logic for overlay portal #151688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| } | ||
|
|
||
| node = node.parent!; | ||
| node = node.semanticsParent!; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this line is the only reason that RenderObject.semanticsParent is needed. Is it possible to change the implementation of markNeedsSemanticsUpdate to a recursive one so we can override _RenderDeferredLayoutBox.markNeedsSemanticsUpdate to propagate the call to its surrogate parent? So that we don't have to change the interface of RenderObject.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cant think of a clean way to do this with the mayProduceSiblingNodes. The requirement is the following:
If a node will produce sibling nodes, it must mark two semantics boundaries above to be dirty
If we were to do this, we have to add additional flag either on renderobject or additional parameter to the markNeedsSemanticsUpdate([int howManyBoundaries]).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The semanticsparent is also used for some look up in _getSemanticsForParent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The semanticsparent is also used for some look up in _getSemanticsForParent.
The call from _getSemanticsForParent only wants to check if the parent is null it seems (so it doesn't matter for OverlayPortal).
If a node will produce sibling nodes, it must mark two semantics boundaries above to be dirty
Ah ok that makes sense. (But at the same time that feels a bit weird, not familiar with semantics tree, but why is the closest semantics boundary invalidated if this has child configurations, but it's fine if parent has child configurations?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the parent is not markNeedsSemanticsUpdate, it won't change its sibling node that get pass on two level up.
If the parent it self is markNeedsSemanticsUpdate it is not the current node's job to mark two level above the parent dirty. It will be when the parent's markNeedsSemanticsUpdate call to mark two level above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for the explanation! Also maybe add @visibleForaoberriding to semanticsParent?
967d5da to
2ecffb4
Compare
…#151688) OverlayPortal attaches its overlaychild's renderobject to overlay directly while keeps its semantics tree under overlayportal. This become a problem when the `overlaychild` markNeedsSemanticsUpdate that it propagate upward the rendering tree. This means instead of marking dirty upward to the OverlayPortal, it directly mark Overlay dirty instead and skip `OverlayPortal`. Currently this does not pose an issue other than unnecessary rebuilds, but it become a problem when I try to optimize the semantics tree compilation flutter#150394. After the optimization it won't rebuild semantics node unless it is marked dirty. Since the OverlayPortal widget does not get marked dirty, it won't update the subtree.
…#151688) OverlayPortal attaches its overlaychild's renderobject to overlay directly while keeps its semantics tree under overlayportal. This become a problem when the `overlaychild` markNeedsSemanticsUpdate that it propagate upward the rendering tree. This means instead of marking dirty upward to the OverlayPortal, it directly mark Overlay dirty instead and skip `OverlayPortal`. Currently this does not pose an issue other than unnecessary rebuilds, but it become a problem when I try to optimize the semantics tree compilation flutter#150394. After the optimization it won't rebuild semantics node unless it is marked dirty. Since the OverlayPortal widget does not get marked dirty, it won't update the subtree.
OverlayPortal attaches its overlaychild's renderobject to overlay directly while keeps its semantics tree under overlayportal.
This become a problem when the
overlaychildmarkNeedsSemanticsUpdate that it propagate upward the rendering tree.This means instead of marking dirty upward to the OverlayPortal, it directly mark Overlay dirty instead and skip
OverlayPortal.Currently this does not pose an issue other than unnecessary rebuilds, but it become a problem when I try to optimize the semantics tree compilation #150394.
After the optimization it won't rebuild semantics node unless it is marked dirty. Since the OverlayPortal widget does not get marked dirty, it won't update the subtree.
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.