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

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
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());

Powered by Google App Engine
This is Rietveld 408576698