summaryrefslogtreecommitdiffstats
path: root/ash/wm/workspace
diff options
context:
space:
mode:
authorvarkha@chromium.org <varkha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-29 15:17:40 +0000
committervarkha@chromium.org <varkha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-29 15:17:40 +0000
commitfe57f395f65539fae741e2765e371358d13239bc (patch)
tree76be99fd2d09bb702c324a38e85aa934329e6ee0 /ash/wm/workspace
parentd554c4a02c581725b18c6d086c2895cfb855ef60 (diff)
downloadchromium_src-fe57f395f65539fae741e2765e371358d13239bc.zip
chromium_src-fe57f395f65539fae741e2765e371358d13239bc.tar.gz
chromium_src-fe57f395f65539fae741e2765e371358d13239bc.tar.bz2
Allow a window to get all the way to the bottom of work area for small windows. Previously restricted with a margin of WorkspaceWindowResizer::kMinOnscreenHeight (32) so short windows could not be dragged all the way to the bottom of the work area.
BUG=None TEST=ash_unittests --gtest_filter=*DontDragOffBottomWithMultiDisplay* Review URL: https://codereview.chromium.org/25005003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@225886 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm/workspace')
-rw-r--r--ash/wm/workspace/workspace_window_resizer.cc6
-rw-r--r--ash/wm/workspace/workspace_window_resizer_unittest.cc17
2 files changed, 21 insertions, 2 deletions
diff --git a/ash/wm/workspace/workspace_window_resizer.cc b/ash/wm/workspace/workspace_window_resizer.cc
index 18fe6ba..ca7ca3f 100644
--- a/ash/wm/workspace/workspace_window_resizer.cc
+++ b/ash/wm/workspace/workspace_window_resizer.cc
@@ -773,8 +773,10 @@ void WorkspaceWindowResizer::AdjustBoundsForMainWindow(
ScreenAsh::ConvertRectFromScreen(window()->parent(), display.work_area());
if (details_.window_component == HTCAPTION) {
// Adjust the bounds to the work area where the mouse cursor is located.
- // Always keep kMinOnscreenHeight on the bottom.
- int max_y = work_area.bottom() - kMinOnscreenHeight;
+ // Always keep kMinOnscreenHeight or the window height (whichever is less)
+ // on the bottom.
+ int max_y = work_area.bottom() - std::min(kMinOnscreenHeight,
+ bounds->height());
if (bounds->y() > max_y) {
bounds->set_y(max_y);
} else if (bounds->y() <= work_area.y()) {
diff --git a/ash/wm/workspace/workspace_window_resizer_unittest.cc b/ash/wm/workspace/workspace_window_resizer_unittest.cc
index 51de51b7..fcad68a 100644
--- a/ash/wm/workspace/workspace_window_resizer_unittest.cc
+++ b/ash/wm/workspace/workspace_window_resizer_unittest.cc
@@ -723,6 +723,23 @@ TEST_F(WorkspaceWindowResizerTest, DontDragOffBottomWithMultiDisplay) {
ash::DisplayLayout(ash::DisplayLayout::BOTTOM, 0));
{
+ window_->SetBounds(gfx::Rect(100, 200, 300, 20));
+ DCHECK_LT(window_->bounds().height(),
+ WorkspaceWindowResizer::kMinOnscreenHeight);
+ scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create(
+ window_.get(), gfx::Point(), HTCAPTION,
+ aura::client::WINDOW_MOVE_SOURCE_MOUSE, empty_windows()));
+ ASSERT_TRUE(resizer.get());
+ resizer->Drag(CalculateDragPoint(*resizer, 0, 400), 0);
+ int expected_y = kRootHeight - window_->bounds().height() - 10;
+ // When the mouse cursor is in the primary display, the window cannot move
+ // on non-work area but can get all the way towards the bottom,
+ // restricted only by the window height.
+ EXPECT_EQ("100," + base::IntToString(expected_y) + " 300x20",
+ window_->bounds().ToString());
+ }
+
+ {
window_->SetBounds(gfx::Rect(100, 200, 300, 400));
scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create(
window_.get(), gfx::Point(), HTCAPTION,