diff options
author | jonross@chromium.org <jonross@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-26 23:58:41 +0000 |
---|---|---|
committer | jonross@chromium.org <jonross@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-26 23:58:41 +0000 |
commit | 75d5416d69fab472c33b2b9b23e5cc9f211d5c28 (patch) | |
tree | fe0ec9a8e5ef3c73a1542a187b997501e456fcc1 /ash/wm | |
parent | 1c252f0eea18222ffe6bda8a656ec7fc742bdbf4 (diff) | |
download | chromium_src-75d5416d69fab472c33b2b9b23e5cc9f211d5c28.zip chromium_src-75d5416d69fab472c33b2b9b23e5cc9f211d5c28.tar.gz chromium_src-75d5416d69fab472c33b2b9b23e5cc9f211d5c28.tar.bz2 |
Overview Mode Close Buttons Not Rendering on 2nd Display
The bounds of a layer are already mapped to the given display coordinate space.
This makes ScreenUtil::ConvertRectFromScreen redundant on the primary display.
However for other displays this incorrectly changes the coordinate space.
This change switches to use the correct layer bounds for placing the close button.
TEST=WindowSelectorTest.MultipleDisplays
BUG=388848
Review URL: https://codereview.chromium.org/358703005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@280175 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm')
-rw-r--r-- | ash/wm/overview/window_selector_item.cc | 3 | ||||
-rw-r--r-- | ash/wm/overview/window_selector_unittest.cc | 49 |
2 files changed, 32 insertions, 20 deletions
diff --git a/ash/wm/overview/window_selector_item.cc b/ash/wm/overview/window_selector_item.cc index 7b0d872..542f2f6 100644 --- a/ash/wm/overview/window_selector_item.cc +++ b/ash/wm/overview/window_selector_item.cc @@ -172,8 +172,7 @@ void WindowSelectorItem::ButtonPressed(views::Button* sender, void WindowSelectorItem::UpdateCloseButtonBounds(aura::Window* root_window, bool animate) { - gfx::RectF align_bounds(ScreenUtil::ConvertRectFromScreen( - root_window, SelectionWindow()->layer()->bounds())); + gfx::RectF align_bounds(SelectionWindow()->layer()->bounds()); gfx::Transform window_transform; window_transform.Translate(align_bounds.x(), align_bounds.y()); window_transform.PreconcatTransform(SelectionWindow()->layer()-> diff --git a/ash/wm/overview/window_selector_unittest.cc b/ash/wm/overview/window_selector_unittest.cc index d552d78..4ca0713 100644 --- a/ash/wm/overview/window_selector_unittest.cc +++ b/ash/wm/overview/window_selector_unittest.cc @@ -210,6 +210,20 @@ class WindowSelectorTest : public test::AshTestBase { return window->window_label_.get(); } + // Tests that a window is contained within a given WindowSelectorItem, and + // that both the window and its matching close button are within the same + // screen. + void IsWindowAndCloseButtonInScreen(aura::Window* window, + WindowSelectorItem* window_item) { + aura::Window* root_window = window_item->GetRootWindow(); + EXPECT_TRUE(window_item->Contains(window)); + EXPECT_TRUE(root_window->GetBoundsInScreen().Contains( + ToEnclosingRect(GetTransformedTargetBounds(window)))); + EXPECT_TRUE(root_window->GetBoundsInScreen().Contains( + ToEnclosingRect(GetTransformedTargetBounds( + GetCloseButton(window_item)->GetNativeView())))); + } + test::ShelfViewTestAPI* shelf_view_test() { return shelf_view_test_.get(); } @@ -595,7 +609,7 @@ TEST_F(WindowSelectorTest, ClickModalWindowParent) { } // Tests that windows remain on the display they are currently on in overview -// mode. +// mode, and that the close buttons are on matching displays. TEST_F(WindowSelectorTest, MultipleDisplays) { if (!SupportsMultipleDisplays()) return; @@ -634,23 +648,22 @@ TEST_F(WindowSelectorTest, MultipleDisplays) { EXPECT_EQ(root_windows[1], panel3->GetRootWindow()); EXPECT_EQ(root_windows[1], panel4->GetRootWindow()); - EXPECT_TRUE(root_windows[0]->GetBoundsInScreen().Contains( - ToEnclosingRect(GetTransformedTargetBounds(window1.get())))); - EXPECT_TRUE(root_windows[0]->GetBoundsInScreen().Contains( - ToEnclosingRect(GetTransformedTargetBounds(window2.get())))); - EXPECT_TRUE(root_windows[1]->GetBoundsInScreen().Contains( - ToEnclosingRect(GetTransformedTargetBounds(window3.get())))); - EXPECT_TRUE(root_windows[1]->GetBoundsInScreen().Contains( - ToEnclosingRect(GetTransformedTargetBounds(window4.get())))); - - EXPECT_TRUE(root_windows[0]->GetBoundsInScreen().Contains( - ToEnclosingRect(GetTransformedTargetBounds(panel1.get())))); - EXPECT_TRUE(root_windows[0]->GetBoundsInScreen().Contains( - ToEnclosingRect(GetTransformedTargetBounds(panel2.get())))); - EXPECT_TRUE(root_windows[1]->GetBoundsInScreen().Contains( - ToEnclosingRect(GetTransformedTargetBounds(panel3.get())))); - EXPECT_TRUE(root_windows[1]->GetBoundsInScreen().Contains( - ToEnclosingRect(GetTransformedTargetBounds(panel4.get())))); + const std::vector<WindowSelectorItem*>& primary_window_items = + GetWindowItemsForRoot(0); + const std::vector<WindowSelectorItem*>& secondary_window_items = + GetWindowItemsForRoot(1); + + // Window indices are based on top-down order. The reverse of our creation. + IsWindowAndCloseButtonInScreen(window1.get(), primary_window_items[2]); + IsWindowAndCloseButtonInScreen(window2.get(), primary_window_items[1]); + IsWindowAndCloseButtonInScreen(window3.get(), secondary_window_items[2]); + IsWindowAndCloseButtonInScreen(window4.get(), secondary_window_items[1]); + + IsWindowAndCloseButtonInScreen(panel1.get(), primary_window_items[0]); + IsWindowAndCloseButtonInScreen(panel2.get(), primary_window_items[0]); + IsWindowAndCloseButtonInScreen(panel3.get(), secondary_window_items[0]); + IsWindowAndCloseButtonInScreen(panel4.get(), secondary_window_items[0]); + EXPECT_TRUE(WindowsOverlapping(panel1.get(), panel2.get())); EXPECT_TRUE(WindowsOverlapping(panel3.get(), panel4.get())); EXPECT_FALSE(WindowsOverlapping(panel1.get(), panel3.get())); |