Chromium Code Reviews| Index: ash/wm/window_util.cc |
| diff --git a/ash/wm/window_util.cc b/ash/wm/window_util.cc |
| index 985039735fbbc2bb4d9ba0c1fa8e6cec95cf7c9b..ef9b0de3d4b2b724757a18457280863d5ea0bf17 100644 |
| --- a/ash/wm/window_util.cc |
| +++ b/ash/wm/window_util.cc |
| @@ -77,6 +77,12 @@ void CenterWindow(aura::Window* window) { |
| } |
| } |
| +// Adjust bounds so that the size does not exceeds |max_size|. |
|
pkotwicz
2014/02/13 02:26:16
Nit: You have a comment in the .h file. It is unne
|
| +void AdjustBoundsSmallerThan(const gfx::Size& max_size, gfx::Rect* bounds) { |
| + bounds->set_width(std::min(bounds->width(), max_size.width())); |
| + bounds->set_height(std::min(bounds->height(), max_size.height())); |
| +} |
| + |
| void AdjustBoundsToEnsureMinimumWindowVisibility(const gfx::Rect& visible_area, |
| gfx::Rect* bounds) { |
| AdjustBoundsToEnsureWindowVisibility( |
| @@ -87,8 +93,7 @@ void AdjustBoundsToEnsureWindowVisibility(const gfx::Rect& visible_area, |
| int min_width, |
| int min_height, |
| gfx::Rect* bounds) { |
| - bounds->set_width(std::min(bounds->width(), visible_area.width())); |
| - bounds->set_height(std::min(bounds->height(), visible_area.height())); |
| + AdjustBoundsSmallerThan(visible_area.size(), bounds); |
| min_width = std::min(min_width, visible_area.width()); |
| min_height = std::min(min_height, visible_area.height()); |