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

Unified Diff: ash/wm/window_util.cc

Issue 161293003: Add test case for updating the bounds of snapped window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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_util.h ('k') | ash/wm/workspace/snap_sizer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « ash/wm/window_util.h ('k') | ash/wm/workspace/snap_sizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698