diff options
author | japhet@chromium.org <japhet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-29 23:12:27 +0000 |
---|---|---|
committer | japhet@chromium.org <japhet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-29 23:12:27 +0000 |
commit | a17a034a71a63dbc8eadaf6d27c647f46b584bd2 (patch) | |
tree | 41fe9c162278670d72ab7c72e0bef15266c28ef1 /chrome/browser/browser.cc | |
parent | 505f03b07b75abe85d28548e3f1878172c25e74e (diff) | |
download | chromium_src-a17a034a71a63dbc8eadaf6d27c647f46b584bd2.zip chromium_src-a17a034a71a63dbc8eadaf6d27c647f46b584bd2.tar.gz chromium_src-a17a034a71a63dbc8eadaf6d27c647f46b584bd2.tar.bz2 |
Force sizing of a new tab as soon as TabContents is created.
BUG=619
BUG=15960
TEST=none
Review URL: http://codereview.chromium.org/126290
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22016 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser.cc')
-rw-r--r-- | chrome/browser/browser.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 6c9c787..9b42d01 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -1465,6 +1465,17 @@ TabContents* Browser::CreateTabContentsForURL( TabContents* contents = new TabContents(profile, instance, MSG_ROUTING_NONE, NULL); + // 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()) + contents->view()->SizeContents(old_contents->view()->GetContainerSize()); + if (!defer_load) { // Load the initial URL before adding the new tab contents to the tab strip // so that the tab contents has navigation state. |