diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-25 22:30:50 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-25 22:30:50 +0000 |
commit | 5ae18725d3bba85f251f6d0f76453c2d891290ff (patch) | |
tree | dddb996f5538c201b840b2cc6965dbc61714ef5f /ash/wm/window_resizer.cc | |
parent | 0239e8694892e4ad603f77f758bbff30b3aff216 (diff) | |
download | chromium_src-5ae18725d3bba85f251f6d0f76453c2d891290ff.zip chromium_src-5ae18725d3bba85f251f6d0f76453c2d891290ff.tar.gz chromium_src-5ae18725d3bba85f251f6d0f76453c2d891290ff.tar.bz2 |
Attempt 4:
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
TBR=ben@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9466032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123674 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 { |