summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser.cc
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-13 17:27:35 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-13 17:27:35 +0000
commite1c41ac26e14a8c4a0c40d07a242da14cad57c1d (patch)
treeda715be637546547407a790bbb727ef44416f89a /chrome/browser/browser.cc
parentd6336a9e8c15b5f3b0be1da2685fcc471e27fbac (diff)
downloadchromium_src-e1c41ac26e14a8c4a0c40d07a242da14cad57c1d.zip
chromium_src-e1c41ac26e14a8c4a0c40d07a242da14cad57c1d.tar.gz
chromium_src-e1c41ac26e14a8c4a0c40d07a242da14cad57c1d.tar.bz2
Fix anchor links opening in background tabs on linux. Also fix
a code path that seems to be missing on Windows (maybe this regressed?). BUG=619 TEST=http://code.google.com/p/chromium/issues/detail?id=619#c6 Review URL: http://codereview.chromium.org/164452 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23317 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser.cc')
-rw-r--r--chrome/browser/browser.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 160be20..5fae3c8 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -1831,6 +1831,18 @@ void Browser::AddNewContents(TabContents* source,
initial_pos, user_gesture);
browser->window()->Show();
} else if (disposition != SUPPRESS_OPEN) {
+ // Ensure that the new TabContentsView begins at the same size as the
+ // previous TabContentsView if it existed. Otherwise, the initial WebKit
+ // layout will be performed based on a width of 0 pixels, causing a
+ // very long, narrow, inaccurate layout. Because some scripts on pages (as
+ // well as WebKit's anchor link location calculation) are run on the
+ // initial layout and not recalculated later, we need to ensure the first
+ // layout is performed with sane view dimensions even when we're opening a
+ // new background tab.
+ if (TabContents* old_contents = tabstrip_model_.GetSelectedTabContents()) {
+ new_contents->view()->SizeContents(
+ old_contents->view()->GetContainerSize());
+ }
tabstrip_model_.AddTabContents(new_contents, -1, false,
PageTransition::LINK,
disposition == NEW_FOREGROUND_TAB);