Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/wm/window_resizer.h" | 5 #include "ash/wm/window_resizer.h" |
| 6 | 6 |
| 7 #include "ash/screen_ash.h" | 7 #include "ash/screen_ash.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/wm/property_util.h" | 9 #include "ash/wm/property_util.h" |
| 10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 317 // for the window origin computation. | 317 // for the window origin computation. |
| 318 if (width < min_width) { | 318 if (width < min_width) { |
| 319 width = min_width; | 319 width = min_width; |
| 320 *delta_x = -x_multiplier * (details.initial_bounds_in_parent.width() - | 320 *delta_x = -x_multiplier * (details.initial_bounds_in_parent.width() - |
| 321 min_width); | 321 min_width); |
| 322 } | 322 } |
| 323 | 323 |
| 324 // And don't let the window go bigger than the display. | 324 // And don't let the window go bigger than the display. |
| 325 int max_width = Shell::GetScreen()->GetDisplayNearestWindow( | 325 int max_width = Shell::GetScreen()->GetDisplayNearestWindow( |
| 326 details.window).bounds().width(); | 326 details.window).bounds().width(); |
| 327 gfx::Size max_size = details.window->delegate()->GetMaximumSize(); | |
| 328 if (!max_size.IsEmpty()) | |
|
jeremya
2012/11/15 01:12:43
Perhaps you only want to check the max width here?
koz (OOO until 15th September)
2012/11/15 02:46:13
Good catch. Fixed here and below.
| |
| 329 max_width = std::min(max_width, max_size.width()); | |
| 327 if (width > max_width) { | 330 if (width > max_width) { |
| 328 width = max_width; | 331 width = max_width; |
| 329 *delta_x = -x_multiplier * (details.initial_bounds_in_parent.width() - | 332 *delta_x = -x_multiplier * (details.initial_bounds_in_parent.width() - |
| 330 max_width); | 333 max_width); |
| 331 } | 334 } |
| 332 } | 335 } |
| 333 return width; | 336 return width; |
| 334 } | 337 } |
| 335 | 338 |
| 336 // static | 339 // static |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 347 // for the window origin computation. | 350 // for the window origin computation. |
| 348 if (height < min_height) { | 351 if (height < min_height) { |
| 349 height = min_height; | 352 height = min_height; |
| 350 *delta_y = -y_multiplier * (details.initial_bounds_in_parent.height() - | 353 *delta_y = -y_multiplier * (details.initial_bounds_in_parent.height() - |
| 351 min_height); | 354 min_height); |
| 352 } | 355 } |
| 353 | 356 |
| 354 // And don't let the window go bigger than the display. | 357 // And don't let the window go bigger than the display. |
| 355 int max_height = Shell::GetScreen()->GetDisplayNearestWindow( | 358 int max_height = Shell::GetScreen()->GetDisplayNearestWindow( |
| 356 details.window).bounds().height(); | 359 details.window).bounds().height(); |
| 360 gfx::Size max_size = details.window->delegate()->GetMaximumSize(); | |
| 361 if (!max_size.IsEmpty()) | |
| 362 max_height = std::min(max_height, max_size.height()); | |
| 357 if (height > max_height) { | 363 if (height > max_height) { |
| 358 height = max_height; | 364 height = max_height; |
| 359 *delta_y = -y_multiplier * (details.initial_bounds_in_parent.height() - | 365 *delta_y = -y_multiplier * (details.initial_bounds_in_parent.height() - |
| 360 max_height); | 366 max_height); |
| 361 } | 367 } |
| 362 } | 368 } |
| 363 return height; | 369 return height; |
| 364 } | 370 } |
| 365 | 371 |
| 366 } // namespace aura | 372 } // namespace aura |
| OLD | NEW |