Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2623)

Unified Diff: ash/wm/window_resizer.cc

Issue 9467021: Attempt 3: Makes managed mode constrain the height of windows so they don't (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Da fix Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/window_resizer.h ('k') | ash/wm/workspace/workspace_event_filter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
« no previous file with comments | « ash/wm/window_resizer.h ('k') | ash/wm/workspace/workspace_event_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698