Index: ash/wm/window_resizer.cc |
diff --git a/ash/wm/window_resizer.cc b/ash/wm/window_resizer.cc |
index 9cc1c2ae73c96871525ba6dfc6c85f1a5bddee13..fbb523ca1241df416bbce85f23ac8221cf7c0a6e 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 { |