DescriptionMacViews: Fix positioning of top-level Widgets with parents
In doing so, consolidate calls to `SetBounds` for MacViews.
In toolkit-views, a Widget is considered "top-level" if it it doesn't
have the "child" flag set on InitParams. All widgets (both top-level and
not) can have their lifetime controlled by a "parent" window. Parented,
but "non-child", windows are positioned with coordinates relative to the
screen, not relative to the parent window that owns them.
For Aura, the logic that does this is in a wm::ScreenPositionClient.
MacViews is currently missing the logic in
DesktopScreenPositionClient::SetBounds(..). This CL adds the same logic
to BridgedNativeWidget::SetBounds(), and moves tests from
widget/desktop_aura/desktop_screen_position_client_unittest.cc to
widget/desktop_widget_unittest.cc since they are cross-platform.
The initial NSWindow bounds also needs to consider this logic, so bounds
setting for Widgets that specify InitParams::bounds changes to use
SetBounds(). A TODO that checked for a valid (according to OSX) window
size there is resolved by adding a DCHECK to
BridgedNativeWidget::SetBounds().
- Gets the following unit tests passing on MacViews:
DesktopScreenPositionClientTest.PositionDialog
DesktopScreenPositionClientTest.PositionControlWithNonRootParent
BUG=378134
Committed: https://crrev.com/ff4479f1e616d7fc5af1355201614a5b333bcd03
Cr-Commit-Position: refs/heads/master@{#317967}
Patch Set 1 #Patch Set 2 : OK on Mac but.. not elsewhere #Patch Set 3 : found some existing unittests #Patch Set 4 : fix gn #Patch Set 5 : Use kWindowSizeDeterminedLater #
Total comments: 2
Patch Set 6 : Use GetAuraWindowTypeForWidgetType #Patch Set 7 : Added comment to BridgedNativeWidget #
Messages
Total messages: 17 (6 generated)
|