summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorflackr@chromium.org <flackr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-02 17:09:24 +0000
committerflackr@chromium.org <flackr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-02 17:09:24 +0000
commita5bf57878f2c41af6a6e065a37d2d73f56d6a7a0 (patch)
treeff67ee464d1e0ab63d30fc88253454585baf6825 /ash
parent2b1189ce3b4e77b42e121143797a16531fe9c2bf (diff)
downloadchromium_src-a5bf57878f2c41af6a6e065a37d2d73f56d6a7a0.zip
chromium_src-a5bf57878f2c41af6a6e065a37d2d73f56d6a7a0.tar.gz
chromium_src-a5bf57878f2c41af6a6e065a37d2d73f56d6a7a0.tar.bz2
Always use transient parent container if window has a transient parent.
The overflow bubble has a transient parent but is not window modal. This resulted in the stacking controller putting it in the default container which is below many window types. This parents any window with a transient parent in the transient parent's container. BUG=166873 TEST=Open enough windows and panels to see an overflow arrow. Clicking on overflow arrow, overflow bubble is visible above panel windows. Review URL: https://chromiumcodereview.appspot.com/12361002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185714 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/ash.gyp1
-rw-r--r--ash/wm/stacking_controller.cc6
-rw-r--r--ash/wm/stacking_controller_unittest.cc64
3 files changed, 68 insertions, 3 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp
index 6429ed472..5a36d0a 100644
--- a/ash/ash.gyp
+++ b/ash/ash.gyp
@@ -637,6 +637,7 @@
'wm/screen_dimmer_unittest.cc',
'wm/session_state_controller_impl2_unittest.cc',
'wm/shelf_layout_manager_unittest.cc',
+ 'wm/stacking_controller_unittest.cc',
'wm/system_gesture_event_filter_unittest.cc',
'wm/system_modal_container_layout_manager_unittest.cc',
'wm/toplevel_window_event_handler_unittest.cc',
diff --git a/ash/wm/stacking_controller.cc b/ash/wm/stacking_controller.cc
index 18b87fb..bbafab48 100644
--- a/ash/wm/stacking_controller.cc
+++ b/ash/wm/stacking_controller.cc
@@ -44,9 +44,9 @@ bool IsSystemModal(aura::Window* window) {
return window->GetProperty(aura::client::kModalKey) == ui::MODAL_TYPE_SYSTEM;
}
-bool IsWindowModal(aura::Window* window) {
+bool HasTransientParentWindow(aura::Window* window) {
return window->transient_parent() &&
- window->GetProperty(aura::client::kModalKey) == ui::MODAL_TYPE_WINDOW;
+ window->transient_parent()->type() != aura::client::WINDOW_TYPE_UNKNOWN;
}
bool IsPanelAttached(aura::Window* window) {
@@ -83,7 +83,7 @@ aura::Window* StackingController::GetDefaultParent(aura::Window* context,
case aura::client::WINDOW_TYPE_POPUP:
if (IsSystemModal(window))
return GetSystemModalContainer(target_root, window);
- else if (IsWindowModal(window))
+ else if (HasTransientParentWindow(window))
return GetContainerForWindow(window->transient_parent());
return GetAlwaysOnTopController(target_root)->GetContainer(window);
case aura::client::WINDOW_TYPE_CONTROL:
diff --git a/ash/wm/stacking_controller_unittest.cc b/ash/wm/stacking_controller_unittest.cc
new file mode 100644
index 0000000..bf4d1fd
--- /dev/null
+++ b/ash/wm/stacking_controller_unittest.cc
@@ -0,0 +1,64 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/shell.h"
+#include "ash/shell_window_ids.h"
+#include "ash/test/ash_test_base.h"
+#include "ash/wm/property_util.h"
+#include "ash/wm/window_properties.h"
+#include "ash/wm/window_util.h"
+#include "ui/aura/client/aura_constants.h"
+#include "ui/aura/root_window.h"
+#include "ui/aura/window.h"
+
+using aura::Window;
+
+namespace ash {
+namespace internal {
+
+class StackingControllerTest : public test::AshTestBase {
+ public:
+ StackingControllerTest() {}
+ virtual ~StackingControllerTest() {}
+
+ aura::Window* CreateTestWindow() {
+ aura::Window* window = new aura::Window(NULL);
+ window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
+ window->SetType(aura::client::WINDOW_TYPE_NORMAL);
+ window->Init(ui::LAYER_TEXTURED);
+ return window;
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(StackingControllerTest);
+};
+
+// Verifies a window with a transient parent is in the same container as its
+// transient parent.
+TEST_F(StackingControllerTest, TransientParent) {
+ // Normal window .
+ scoped_ptr<Window> w2(CreateTestWindow());
+ w2->SetBounds(gfx::Rect(10, 11, 250, 251));
+ aura::Window* launcher = Shell::GetContainer(Shell::GetPrimaryRootWindow(),
+ kShellWindowId_LauncherContainer);
+ launcher->AddChild(w2.get());
+ w2->Show();
+
+ wm::ActivateWindow(w2.get());
+
+ // Window with a transient parent.
+ scoped_ptr<Window> w1(CreateTestWindow());
+ w2->AddTransientChild(w1.get());
+ w1->SetBounds(gfx::Rect(10, 11, 250, 251));
+ SetDefaultParentByPrimaryRootWindow(w1.get());
+ w1->Show();
+ wm::ActivateWindow(w1.get());
+
+ // The window with the transient parent should get added to the same container
+ // as its transient parent.
+ EXPECT_EQ(launcher, w1->parent());
+}
+
+} // namespace internal
+} // namespace ash