diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-25 00:22:21 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-25 00:22:21 +0000 |
commit | 0d00f12856cfd994aa3ddf165a7a53fe033cf860 (patch) | |
tree | 82b684c2636d193b80efad8c5416d8cee4693ad0 /ash/wm/window_resizer.cc | |
parent | c49a4d3c05b2a8160398352d7e94049cc65386bf (diff) | |
download | chromium_src-0d00f12856cfd994aa3ddf165a7a53fe033cf860.zip chromium_src-0d00f12856cfd994aa3ddf165a7a53fe033cf860.tar.gz chromium_src-0d00f12856cfd994aa3ddf165a7a53fe033cf860.tar.bz2 |
Attempt 3: 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
Review URL: https://chromiumcodereview.appspot.com/9467021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123603 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 { |