Chromium Code Reviews
DescriptionMacViews: Fix child window z-order and SetBounds
The search box in the app list is a child views::Widget (so that it can
animate over WebContents). Its position and z-order were broken on
MacViews.
The z-order issue boils down to a quirk in Cocoa where it is unable to
correctly process a call to -[NSWindow orderWindow:relativeTo:] that is
made in response to a visibility change in the same iteration over the
event loop.
To fix, make use of -[NSWindow addChildWindow:]. However, we must work
around the issues it has. Specifically, it falls apart when we want to
have hidden windows: Adding a child window always shows it, and hiding a
child window detaches it.
To fix that, child windows are removed from -[NSWindow childWindows]
when ordered out and added back when the NSWindow becomes visible again.
Then, to ensure visibility changes not initiated by
BridgedNativeWidget::SetVisibilityState() correctly manage these
children, calls to NotifyVisibilityChangeDown() are moved to a single
call in OnVisibilityChangedTo(), called from the NSWindowDelegate after
the visibility change is fed through to Cocoa.
The x/y position bug was simpler. Mac was just missing the logic in
aura::Window::SetBoundsInternal() that offsets the bounds when there is
a parent.
Cross-platform regression tests are added for these.
The app_list_unittest
AppListViewTestDesktopInstance/AppListViewTestDesktop.SearchResultsTest/2
also passes after this on MacViews.
BUG=378134, 365977
Committed: https://crrev.com/1d11217e72c14e3515a01c016a280dac7e1deb21
Cr-Commit-Position: refs/heads/master@{#310647}
Patch Set 1 #Patch Set 2 : fix linux; #Patch Set 3 : Ditch RunPendingMessages - not needed - and add a hide-show test #Patch Set 4 : Simplify a bit now we no longer try to do our own zorder management #Patch Set 5 : ShowInactive for a more compelling test #
Total comments: 2
Patch Set 6 : fix typo: than->that #
Total comments: 2
Patch Set 7 : rebase maybe #Patch Set 8 : CHECK->EXPECT_TRUE #
Messages
Total messages: 20 (9 generated)
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||