-
Notifications
You must be signed in to change notification settings - Fork 28.4k
Stack and other multi-child layout renderers should not call markNeedsPaint if they don't actually change their layout #5325
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
Comments
Currently layout calls markNeedsPaint unconditionally, but we could do something smarter here if we knew which render object actually painted content. It's possible that the layout change actually only affects render objects that live in their own repaint boundaries. |
I don't really understand this request. Assuming there's no repaint boundary, if we don't repaint the child, how will the child be visible after the parent's layout's changed? |
If nothing calls markNeedsPaint in this repaint boundary, we'll just use the recording from last time (which will contain the child). If something does call markNeedsPaint, then we'll paint the child again. We're currently calling markNeedsPaint when there's nothing actually dirty about the painting in this repaint boundary. |
If the layout changed, then the paint is dirty, pretty much by definition, no? |
That's currently the definition, but there are situations where that is an over-approximation. The case that Andrew was hitting is the following:
Child2 decides it wants to layout. That causes the stack to layout. The stack decides to put child1 and child2 in exactly the same spots as before. In our current approach, the stack marks itself as needing paint even though it didn't change anything about itself and it doesn't actually have anything new to paint. That causes child1 to repaint, also spuriously even though layout didn't recurse into child1. (In this scenario, child2 did actually change in some meaningful way, but its repainting is contained by its repaint boundary.) There's an opportunity to do better here by not calling markNeedsPaint unconditionally from layout. |
Oh, I see. Sure. |
It's not blocking @apwilson, removing pink. |
@Hixie @tvolkert @HansMuller is there any plan or work in progress for this old issue? (It's currently the oldest in terms of the last update date.) |
I don't know of any active or planned work on this issue. |
This is definitely something we should fix one day. It's not something anyone has looked at yet. |
Example is a Stack with two children, one always changing and the other never changing. The changing child shouldn't cause the non-changing child to repaint.
The text was updated successfully, but these errors were encountered: