OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/wm/window_util.h" | 5 #include "ash/wm/window_util.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/ash_constants.h" | 9 #include "ash/ash_constants.h" |
10 #include "ash/screen_util.h" | 10 #include "ash/screen_util.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 AdjustBoundsToEnsureWindowVisibility( | 115 AdjustBoundsToEnsureWindowVisibility( |
116 visible_area, kMinimumOnScreenArea, kMinimumOnScreenArea, bounds); | 116 visible_area, kMinimumOnScreenArea, kMinimumOnScreenArea, bounds); |
117 } | 117 } |
118 | 118 |
119 void AdjustBoundsToEnsureWindowVisibility(const gfx::Rect& visible_area, | 119 void AdjustBoundsToEnsureWindowVisibility(const gfx::Rect& visible_area, |
120 int min_width, | 120 int min_width, |
121 int min_height, | 121 int min_height, |
122 gfx::Rect* bounds) { | 122 gfx::Rect* bounds) { |
123 AdjustBoundsSmallerThan(visible_area.size(), bounds); | 123 AdjustBoundsSmallerThan(visible_area.size(), bounds); |
124 | 124 |
125 min_width = std::min(min_width, visible_area.width()); | 125 min_width = |
126 min_height = std::min(min_height, visible_area.height()); | 126 std::min(std::min(min_width, visible_area.width()), bounds->width()); |
| 127 min_height = |
| 128 std::min(std::min(min_height, visible_area.height()), bounds->height()); |
127 | 129 |
128 if (bounds->right() < visible_area.x() + min_width) { | 130 if (bounds->right() < visible_area.x() + min_width) { |
129 bounds->set_x(visible_area.x() + min_width - bounds->width()); | 131 bounds->set_x(visible_area.x() + min_width - bounds->width()); |
130 } else if (bounds->x() > visible_area.right() - min_width) { | 132 } else if (bounds->x() > visible_area.right() - min_width) { |
131 bounds->set_x(visible_area.right() - min_width); | 133 bounds->set_x(visible_area.right() - min_width); |
132 } | 134 } |
133 if (bounds->bottom() < visible_area.y() + min_height) { | 135 if (bounds->bottom() < visible_area.y() + min_height) { |
134 bounds->set_y(visible_area.y() + min_height - bounds->height()); | 136 bounds->set_y(visible_area.y() + min_height - bounds->height()); |
135 } else if (bounds->y() > visible_area.bottom() - min_height) { | 137 } else if (bounds->y() > visible_area.bottom() - min_height) { |
136 bounds->set_y(visible_area.bottom() - min_height); | 138 bounds->set_y(visible_area.bottom() - min_height); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 if (!container->layout_manager()) | 207 if (!container->layout_manager()) |
206 container->SetLayoutManager(new SnapToPixelLayoutManager(container)); | 208 container->SetLayoutManager(new SnapToPixelLayoutManager(container)); |
207 } else { | 209 } else { |
208 InstallSnapLayoutManagerToContainers(container); | 210 InstallSnapLayoutManagerToContainers(container); |
209 } | 211 } |
210 } | 212 } |
211 } | 213 } |
212 | 214 |
213 } // namespace wm | 215 } // namespace wm |
214 } // namespace ash | 216 } // namespace ash |
OLD | NEW |