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

Unified Diff: ash/wm/window_util.cc

Issue 106303005: Fix AdjustBoundsToEnsureWindowVisibility to work with non primary display bounds (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update bounds without removing Created 6 years, 11 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/system_gesture_event_filter_unittest.cc ('k') | 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/wm/window_util.cc
diff --git a/ash/wm/window_util.cc b/ash/wm/window_util.cc
index 2985f663b64222c10926d654dd3a252a589ebb74..cc131d13fa9b7e09885f2da62f6e26f4a830cd85 100644
--- a/ash/wm/window_util.cc
+++ b/ash/wm/window_util.cc
@@ -94,18 +94,18 @@ void AdjustBoundsToEnsureWindowVisibility(const gfx::Rect& visible_area,
min_width = std::min(min_width, visible_area.width());
min_height = std::min(min_height, visible_area.height());
- if (bounds->x() + min_width > visible_area.right()) {
+ if (bounds->right() < visible_area.x() + min_width) {
+ bounds->set_x(visible_area.x() + min_width - bounds->width());
+ } else if (bounds->x() > visible_area.right() - min_width) {
bounds->set_x(visible_area.right() - min_width);
- } else if (bounds->right() - min_width < 0) {
- bounds->set_x(min_width - bounds->width());
}
- if (bounds->y() + min_height > visible_area.bottom()) {
+ if (bounds->bottom() < visible_area.y() + min_height) {
+ bounds->set_y(visible_area.y() + min_height - bounds->height());
+ } else if (bounds->y() > visible_area.bottom() - min_height) {
bounds->set_y(visible_area.bottom() - min_height);
- } else if (bounds->bottom() - min_height < 0) {
- bounds->set_y(min_height - bounds->height());
}
- if (bounds->y() < 0)
- bounds->set_y(0);
+ if (bounds->y() < visible_area.y())
+ bounds->set_y(visible_area.y());
}
bool MoveWindowToEventRoot(aura::Window* window, const ui::Event& event) {
« no previous file with comments | « ash/wm/system_gesture_event_filter_unittest.cc ('k') | ash/wm/window_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698