summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormohsen@chromium.org <mohsen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-25 06:23:05 +0000
committermohsen@chromium.org <mohsen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-25 06:23:05 +0000
commit0ccc237ac8bbd5403605787a186ff10cefe13c87 (patch)
treed1b1a33c04e488db9c2445453df93251a9ec7486
parent2474db3b20649bfe33d6f265902ee091b9265a00 (diff)
downloadchromium_src-0ccc237ac8bbd5403605787a186ff10cefe13c87.zip
chromium_src-0ccc237ac8bbd5403605787a186ff10cefe13c87.tar.gz
chromium_src-0ccc237ac8bbd5403605787a186ff10cefe13c87.tar.bz2
Enforce minimum visibility only for normal and panel windows
Enforcing minimum visibility is to ensure that the user is always able to interact with the window. This is only needed for normal and panel windows which are positioned by user. Other types of windows are positioned programmatically. BUG=364117 TEST=WorkspaceLayoutManagerTest.NoMinimumVisibilityForPopupWindows Review URL: https://codereview.chromium.org/348943002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@279630 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ash/wm/default_state.cc9
-rw-r--r--ash/wm/workspace/workspace_layout_manager_unittest.cc13
2 files changed, 22 insertions, 0 deletions
diff --git a/ash/wm/default_state.cc b/ash/wm/default_state.cc
index ada7e36..0fd3070 100644
--- a/ash/wm/default_state.cc
+++ b/ash/wm/default_state.cc
@@ -305,6 +305,15 @@ bool DefaultState::ProcessWorkspaceEvents(WindowState* window_state,
if (bounds.IsEmpty())
return true;
+ // Only windows of type WINDOW_TYPE_NORMAL or WINDOW_TYPE_PANEL need to be
+ // adjusted to have minimum visibility, because they are positioned by the
+ // user and user should always be able to interact with them. Other
+ // windows are positioned programmatically.
+ if (window_state->window()->type() != ui::wm::WINDOW_TYPE_NORMAL &&
+ window_state->window()->type() != ui::wm::WINDOW_TYPE_PANEL) {
+ return true;
+ }
+
// Use entire display instead of workarea because the workarea can
// be further shrunk by the docked area. The logic ensures 30%
// visibility which should be enough to see where the window gets
diff --git a/ash/wm/workspace/workspace_layout_manager_unittest.cc b/ash/wm/workspace/workspace_layout_manager_unittest.cc
index 3a9a58a..8dcf3a5 100644
--- a/ash/wm/workspace/workspace_layout_manager_unittest.cc
+++ b/ash/wm/workspace/workspace_layout_manager_unittest.cc
@@ -162,6 +162,19 @@ TEST_F(WorkspaceLayoutManagerTest, KeepMinimumVisibilityInDisplays) {
EXPECT_EQ("10,-500 200x200", window2->GetBoundsInScreen().ToString());
}
+TEST_F(WorkspaceLayoutManagerTest, NoMinimumVisibilityForPopupWindows) {
+ UpdateDisplay("300x400");
+
+ // Create a popup window out of display boundaries and make sure it is not
+ // moved to have minimum visibility.
+ scoped_ptr<aura::Window> window(
+ CreateTestWindowInShellWithDelegateAndType(NULL,
+ ui::wm::WINDOW_TYPE_POPUP,
+ 0,
+ gfx::Rect(400, 100, 50, 50)));
+ EXPECT_EQ("400,100 50x50", window->GetBoundsInScreen().ToString());
+}
+
TEST_F(WorkspaceLayoutManagerTest, KeepRestoredWindowInDisplay) {
if (!SupportsHostWindowResize())
return;