Index: ash/wm/window_util.cc |
diff --git a/ash/wm/window_util.cc b/ash/wm/window_util.cc |
index e6907384ccc762adbe3cf7aac2d17e090531bb10..883a4ae537ab7b0fb08c5e63db2753e8b6fd1845 100644 |
--- a/ash/wm/window_util.cc |
+++ b/ash/wm/window_util.cc |
@@ -18,6 +18,7 @@ |
#include "ui/gfx/display.h" |
#include "ui/gfx/rect.h" |
#include "ui/gfx/screen.h" |
+#include "ui/gfx/size.h" |
#include "ui/views/corewm/window_util.h" |
#include "ui/views/view.h" |
#include "ui/views/widget/widget.h" |
@@ -78,6 +79,11 @@ void CenterWindow(aura::Window* window) { |
} |
} |
+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( |
@@ -88,8 +94,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()); |