diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-04 17:58:00 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-04 17:58:00 +0000 |
commit | eb0c1e406f837d590055021a753015feb67b6fc9 (patch) | |
tree | 68cba799e7116f4cae39bf014fe8ded65f705037 /chrome/browser/browser.cc | |
parent | 6d5168ee11a27e4db3047883eddfac80a9f98c9d (diff) | |
download | chromium_src-eb0c1e406f837d590055021a753015feb67b6fc9.zip chromium_src-eb0c1e406f837d590055021a753015feb67b6fc9.tar.gz chromium_src-eb0c1e406f837d590055021a753015feb67b6fc9.tar.bz2 |
Fix several issues with popup window locations:
1) Remove ConstrainedWindow::GenerateInitialBounds(), which is old and crufty and no longer relevant now that there are no unsuppressed, constrained popup windows.
2) Move the browser side positioning logic into Browser::BuildPopupWindow().
3) Fix the window.open() handler so that when we aren't given top=/left= coordinates, we don't set the window origin (allowing the browser to do something more intelligent).
BUG=1290758
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@325 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser.cc')
-rw-r--r-- | chrome/browser/browser.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 2768b65..7a0bbb0 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -85,7 +85,7 @@ static const int kBrowserReleaseMemoryInterval = 30; // In seconds. // How much horizontal and vertical offset there is between newly opened // windows. -static const int kWindowTilePixels = 10; +static const int kWindowTilePixels = 20; // How frequently we check for hung plugin windows. static const int kDefaultHungPluginDetectFrequency = 2000; @@ -1623,15 +1623,22 @@ void Browser::BuildPopupWindow(TabContents* source, browser->AddNewContents(source, new_contents, NEW_FOREGROUND_TAB, gfx::Rect(), true); - // TODO(erg): Need to move all popup sizing logic here, instead of - // having it spread across three files. - // For newly opened popup windows, the incoming width/height // numbers are for the content area, but x/y are for the actual // window position. Thus we can't just call MoveContents(). gfx::Rect window_rect = browser->window()->GetBoundsForContentBounds(initial_pos); window_rect.set_origin(initial_pos.origin()); + + // When we are given x/y coordinates of 0 on a created popup window, + // assume none were given by the window.open() command. + if (window_rect.x() == 0 && window_rect.y() == 0) { + gfx::Point origin = window()->GetNormalBounds().origin(); + origin.set_x(origin.x() + kWindowTilePixels); + origin.set_y(origin.y() + kWindowTilePixels); + window_rect.set_origin(origin); + } + ::SetWindowPos(browser->GetTopLevelHWND(), NULL, window_rect.x(), window_rect.y(), window_rect.width(), window_rect.height(), 0); |