Index: ui/base/win/hwnd_util.cc |
=================================================================== |
--- ui/base/win/hwnd_util.cc (revision 129350) |
+++ ui/base/win/hwnd_util.cc (working copy) |
@@ -13,7 +13,7 @@ |
namespace { |
-// Adjust the window to fit, returning true if the window was resized or moved. |
+// Adjust the window to fit. |
void AdjustWindowToFit(HWND hwnd, const RECT& bounds, bool fit_to_monitor) { |
if (fit_to_monitor) { |
// Get the monitor. |
@@ -134,11 +134,19 @@ |
NOTREACHED() << "Unable to get default monitor"; |
} |
} |
- window_bounds.left = center_bounds.left + |
- (center_bounds.right - center_bounds.left - pref.width()) / 2; |
+ |
+ window_bounds.left = center_bounds.left; |
+ if (pref.width() < (center_bounds.right - center_bounds.left)) { |
+ window_bounds.left += |
+ (center_bounds.right - center_bounds.left - pref.width()) / 2; |
+ } |
window_bounds.right = window_bounds.left + pref.width(); |
- window_bounds.top = center_bounds.top + |
- (center_bounds.bottom - center_bounds.top - pref.height()) / 2; |
+ |
+ window_bounds.top = center_bounds.top; |
+ if (pref.height() < (center_bounds.bottom - center_bounds.top)) { |
+ window_bounds.top += |
+ (center_bounds.bottom - center_bounds.top - pref.height()) / 2; |
+ } |
window_bounds.bottom = window_bounds.top + pref.height(); |
// If we're centering a child window, we are positioning in client |