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

Unified Diff: ui/base/win/hwnd_util.cc

Issue 9784012: Windows: Don't try to center a popup over a parent window when the popup is bigger than the parent. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698