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

Unified Diff: ash/common/wm/window_positioning_utils.cc

Issue 2175833002: AdjustBoundsToEnsureMinimumWindowVisibility may cause unwanted shift if window dimension is small (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: AdjustBoundsToEnsureMinimumWindowVisibility Created 4 years, 4 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 | « no previous file | ash/wm/window_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/wm/window_positioning_utils.cc
diff --git a/ash/common/wm/window_positioning_utils.cc b/ash/common/wm/window_positioning_utils.cc
index 37d36061ba0f62b06aad2a20d8ec9acd0eb6699c..e9ddee57c28c343fe1da3d5c98ecd85f072f14a5 100644
--- a/ash/common/wm/window_positioning_utils.cc
+++ b/ash/common/wm/window_positioning_utils.cc
@@ -46,14 +46,17 @@ void AdjustBoundsToEnsureWindowVisibility(const gfx::Rect& visible_area,
min_height = std::min(min_height, visible_area.height());
if (bounds->right() < visible_area.x() + min_width) {
- bounds->set_x(visible_area.x() + min_width - bounds->width());
+ bounds->set_x(visible_area.x() + std::min(bounds->width(), min_width) -
+ bounds->width());
} else if (bounds->x() > visible_area.right() - min_width) {
- bounds->set_x(visible_area.right() - min_width);
+ bounds->set_x(visible_area.right() - std::min(bounds->width(), min_width));
}
if (bounds->bottom() < visible_area.y() + min_height) {
- bounds->set_y(visible_area.y() + min_height - bounds->height());
+ bounds->set_y(visible_area.y() + std::min(bounds->height(), min_height) -
+ bounds->height());
} else if (bounds->y() > visible_area.bottom() - min_height) {
- bounds->set_y(visible_area.bottom() - min_height);
+ bounds->set_y(visible_area.bottom() -
+ std::min(bounds->height(), min_height));
}
if (bounds->y() < visible_area.y())
bounds->set_y(visible_area.y());
« no previous file with comments | « no previous file | ash/wm/window_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698