summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorsky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-03 19:30:59 +0000
committersky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-03 19:30:59 +0000
commitb0cca784f266411d95923589109f84eb6edaa763 (patch)
tree4b1fca6eb509b58e26ab2cfc923bdf8c2afdb9f9 /chrome
parentb99d1d095511a476dce58a230666b11ab9debcb3 (diff)
downloadchromium_src-b0cca784f266411d95923589109f84eb6edaa763.zip
chromium_src-b0cca784f266411d95923589109f84eb6edaa763.tar.gz
chromium_src-b0cca784f266411d95923589109f84eb6edaa763.tar.bz2
Fixes bug in window positioning that resulted in positioning
incorrectly for monitors with an origin < 0 along either axis. BUG=5059 TEST=see bug Review URL: http://codereview.chromium.org/13100 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6300 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/common/win_util.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/chrome/common/win_util.cc b/chrome/common/win_util.cc
index e9a4144..44d3769 100644
--- a/chrome/common/win_util.cc
+++ b/chrome/common/win_util.cc
@@ -625,10 +625,14 @@ void EnsureRectIsVisibleInRect(const gfx::Rect& parent_rect,
// windows in hyperspace.
// TODO(mpcomplete): I don't see what the second check in each 'if' does that
// isn't handled by the LAST set of 'ifs'. Maybe we can remove it.
- if (child_rect->x() < 0 || child_rect->x() > parent_rect.right())
- child_rect->set_x(padding);
- if (child_rect->y() < 0 || child_rect->y() > parent_rect.bottom())
- child_rect->set_y(padding);
+ if (child_rect->x() < parent_rect.x() ||
+ child_rect->x() > parent_rect.right()) {
+ child_rect->set_x(parent_rect.x() + padding);
+ }
+ if (child_rect->y() < parent_rect.y() ||
+ child_rect->y() > parent_rect.bottom()) {
+ child_rect->set_y(parent_rect.y() + padding);
+ }
// LAST, nudge the window back up into the client area if its x,y position is
// within the parent bounds but its width/height place it off-screen.