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) { |