diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-24 18:57:15 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-24 18:57:15 +0000 |
commit | 12672375aed397f10056ce7aceeae271a532edf5 (patch) | |
tree | f858be52556fc0851cefa2314a61950333429cd5 /ash/wm/window_resizer.cc | |
parent | 0fa70f9feaa68782ed37442ea4def3659913b851 (diff) | |
download | chromium_src-12672375aed397f10056ce7aceeae271a532edf5.zip chromium_src-12672375aed397f10056ce7aceeae271a532edf5.tar.gz chromium_src-12672375aed397f10056ce7aceeae271a532edf5.tar.bz2 |
Makes managed mode constrain the height of windows so they don't
overlap the launcher.
BUG=115581
TEST=see bug, covered by unit tests too
R=ben@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9443045
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123518 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm/window_resizer.cc')
-rw-r--r-- | ash/wm/window_resizer.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/ash/wm/window_resizer.cc b/ash/wm/window_resizer.cc index 9cc1c2a..fbb523c 100644 --- a/ash/wm/window_resizer.cc +++ b/ash/wm/window_resizer.cc @@ -205,13 +205,16 @@ void WindowResizer::Drag(const gfx::Point& location) { void WindowResizer::CompleteDrag() { if (grid_size_ <= 1 || !did_move_or_resize_) return; - const gfx::Rect& bounds(window_->bounds()); - int x = AlignToGrid(bounds.x(), grid_size_); - int y = AlignToGrid(bounds.y(), grid_size_); - gfx::Rect new_bounds(x, y, bounds.width(), bounds.height()); + gfx::Rect new_bounds(GetFinalBounds()); if (new_bounds == window_->bounds()) return; + if (new_bounds.size() != window_->bounds().size()) { + // Don't attempt to animate a size change. + window_->SetBounds(new_bounds); + return; + } + ui::ScopedLayerAnimationSettings scoped_setter( window_->layer()->GetAnimator()); // Use a small duration since the grid is small. @@ -256,6 +259,13 @@ gfx::Rect WindowResizer::GetBoundsForDrag(const gfx::Point& location) { return new_bounds; } +gfx::Rect WindowResizer::GetFinalBounds() { + const gfx::Rect& bounds(window_->bounds()); + int x = AlignToGrid(bounds.x(), grid_size_); + int y = AlignToGrid(bounds.y(), grid_size_); + return gfx::Rect(x, y, bounds.width(), bounds.height()); +} + gfx::Point WindowResizer::GetOriginForDrag( int delta_x, int delta_y) const { |