diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-19 20:47:10 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-19 20:47:10 +0000 |
commit | 0453d0de15cf8aad24b4a15ab0e664163dc5530b (patch) | |
tree | 7ddad8d92c09899d21b6319e1c42faa8444dc588 /ui/views/widget | |
parent | a4a6bdd1b407ab712a04eacc2feddc1b1df61dfd (diff) | |
download | chromium_src-0453d0de15cf8aad24b4a15ab0e664163dc5530b.zip chromium_src-0453d0de15cf8aad24b4a15ab0e664163dc5530b.tar.gz chromium_src-0453d0de15cf8aad24b4a15ab0e664163dc5530b.tar.bz2 |
We need to call aura::Window::Show from the DesktopNativeWidgetAura::ShowMaximizedWithBounds and ShowWithWindowState functions.
This is specifically important if the underlying Widget was hidden and then made visible via Widget::Show. The visibility state of
the aura Window object remains as hidden, which results in the compositor not painting this window.
Fixes bug http://code.google.com/p/chromium/issues/detail?id=229913 where the composited panel window would turn black on Windows 8 if we
switched to the metro screen and back.
R=ben@chromium.org
BUG=229913
TEST=Covered by new views unit test TestWindowVisibilityAfterHide
Review URL: https://chromiumcodereview.appspot.com/13849012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195270 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/widget')
-rw-r--r-- | ui/views/widget/desktop_aura/desktop_native_widget_aura.cc | 2 | ||||
-rw-r--r-- | ui/views/widget/widget_unittest.cc | 23 |
2 files changed, 25 insertions, 0 deletions
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc index 3c1d4c6..39b862e 100644 --- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc +++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc @@ -458,10 +458,12 @@ void DesktopNativeWidgetAura::Hide() { void DesktopNativeWidgetAura::ShowMaximizedWithBounds( const gfx::Rect& restored_bounds) { desktop_root_window_host_->ShowMaximizedWithBounds(restored_bounds); + window_->Show(); } void DesktopNativeWidgetAura::ShowWithWindowState(ui::WindowShowState state) { desktop_root_window_host_->ShowWindowWithState(state); + window_->Show(); } bool DesktopNativeWidgetAura::IsVisible() const { diff --git a/ui/views/widget/widget_unittest.cc b/ui/views/widget/widget_unittest.cc index e4376ca..de7fd52 100644 --- a/ui/views/widget/widget_unittest.cc +++ b/ui/views/widget/widget_unittest.cc @@ -1444,6 +1444,29 @@ TEST_F(WidgetTest, DesktopAuraFullscreenChildParentDestroyed) { RunPendingMessages(); } +// Test to ensure that the aura Window's visiblity state is set to visible if +// the underlying widget is hidden and then shown. +TEST_F(WidgetTest, TestWindowVisibilityAfterHide) { + // Create a widget. + Widget widget; + Widget::InitParams init_params = + CreateParams(Widget::InitParams::TYPE_WINDOW); + init_params.show_state = ui::SHOW_STATE_NORMAL; + gfx::Rect initial_bounds(0, 0, 300, 400); + init_params.bounds = initial_bounds; + init_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; + init_params.native_widget = new DesktopNativeWidgetAura(&widget); + widget.Init(init_params); + NonClientView* non_client_view = widget.non_client_view(); + NonClientFrameView* frame_view = new MinimumSizeFrameView(&widget); + non_client_view->SetFrameView(frame_view); + + widget.Hide(); + EXPECT_FALSE(widget.GetNativeView()->IsVisible()); + widget.Show(); + EXPECT_TRUE(widget.GetNativeView()->IsVisible()); +} + #endif // !defined(OS_CHROMEOS) // Tests that wheel events generted from scroll events are targetted to the |