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
fix: propagate layout call to all children of InspectableWebContentsViewViews
#39994
fix: propagate layout call to all children of InspectableWebContentsViewViews
#39994
Conversation
…ews. When BrowserView bounds are set from js, those might not trigger layout immediately, sometimes propagating InvalidateLayout call to parent. View is marked as needing layout, expecting to receive it from parent on next layout call. The problem is that BrowserView's view is added as child of InspectableWebContentsViews which does not call setBounds (which would trigger layout) on all of it's children when doing it's layout, so it skips propagating Layout call to its children BrowserViews views, even though those were marked as needing layout. Call base class View::Layout which will iterate over views' children and call Layout on those that were marked as needing them. Fixes electron#39993.
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.
It looks like this is considered a best practice upstream in overridden View::Layout()
implementations in Chromium so this looks good to me. Verified to address the problem on non-macOS platforms with the gist in the originating issue.
I think it might be possible to test this with desktopCapturer
screenshot color matching but I won't block on it because it's likely to be a pain and likely faster done by someone more familiar with that zone of the codebase.
InspectableWebContentsViewViews
I tried doing this, unfortunately this test passes without a fix while the gist does not work properly, so there must be more to it:
|
Release Notes Persisted
|
I have automatically backported this PR to "25-x-y", please check out #40035 |
I have automatically backported this PR to "26-x-y", please check out #40036 |
I have automatically backported this PR to "27-x-y", please check out #40037 |
Just wanted to add, that this also fixes: #35149 |
…ViewViews` (electron#39994) Propagate layout call to all children of InspectableWebContentsViewViews. When BrowserView bounds are set from js, those might not trigger layout immediately, sometimes propagating InvalidateLayout call to parent. View is marked as needing layout, expecting to receive it from parent on next layout call. The problem is that BrowserView's view is added as child of InspectableWebContentsViews which does not call setBounds (which would trigger layout) on all of it's children when doing it's layout, so it skips propagating Layout call to its children BrowserViews views, even though those were marked as needing layout. Call base class View::Layout which will iterate over views' children and call Layout on those that were marked as needing them. Fixes electron#39993.
When BrowserView bounds are set from js, those might not trigger layout immediately, sometimes propagating InvalidateLayout call to parent. View is marked as needing layout, expecting to receive it from parent on next layout call. The problem is that BrowserView's view is added as child of InspectableWebContentsViews which does not call setBounds (which would trigger layout) on all of it's children when doing it's layout, so it skips propagating Layout call to its children BrowserViews views, even though those were marked as needing layout.
Call base class View::Layout which will iterate over views' children and call Layout on those that were marked as needing them.
Unfortunately I failed to create a spec test that would repro this behavior. It seems user click on button (like in gist in bug) might be needed to repro correctly.
Fixes #39993.
Checklist
npm test
passesRelease Notes
Notes: Fixed
BrowserView.setBounds()
calls not painting view in new bounds in some cases.