MacViews: Fix Child window Visibility, implement Hide()
Visibility is managed by BridgedNativeWidget (similar to aura::Window).
BridgedNativeWidget::SetVisible(bool visible, bool activate) is added,
and a `wants_to_be_visible_` tracks the visibility of a child that
is hidden due to having a hidden parent window.
Gets 3 tests passing, and adds 2 new (passing) tests, and regresses 2
tests.
Now passing:
- WidgetTest.TestRootViewHandlersWhenHidden
- WidgetTest.TestWindowVisibilityAfterHide
- WidgetTest.Visibility
InactiveWidgetDoesNotGrabActivation regresses because activation on
desktop properly needs an interactive_ui_test. On linux/win the test
only runs with non-desktop aura windows (which use per-process
wm::IsActiveWindow() rather than desktop_window_tree_host_->
IsActive()).
I need to fix IsActive() anyway, so I'll make sure there is an
equivalent OS-specific test that knows how to wait for activation.
(e.g. Linux uses an X11PropertyChangeWaiter in
desktop_window_tree_host_x11_interactive_uitest).
BubbleDelegateTest.VisibleWhenAnchorWidgetBoundsChanged also regresses.
Bubbles created in BubbleDelegateTest have a parent widget that is never
made visible. But they also have a layer, which IsDrawn().
aura::Window::IsVisible goes
for (const Window* window = this; window; window = window->parent()) {
if (!window->visible_)
return false;
if (window->layer())
return window->layer()->IsDrawn();
}
so returns early when the visible layer is found, before encountering
the non-visible parent. Adding a widget->Show() in BubbleDelegateTest::
CreateTestWidget() would fix it for Mac, and is probably warranted, but
needs more investigation.
BUG=378134
TEST=New/Updated: WidgetObserverTest.ClosingOnHiddenParent,
NativeWidgetMacTest.HideAndShowExternally, WidgetTest.Visibility
views_unittests: 471 tests run. 22 fail. 16 crash.
Review URL: https://codereview.chromium.org/
748693002
Cr-Commit-Position: refs/heads/master@{#306349}