summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-13 21:03:44 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-13 21:03:44 +0000
commitaa61d7ed5555ccaa7a5987a4f3fc98bb4f35cf39 (patch)
tree37f5f1069ee09ff8c1eb20c57cd6d13ca2ebe565 /chrome
parent36537d867d8f7c34ed4da00f33ee98b3c47d3ee9 (diff)
downloadchromium_src-aa61d7ed5555ccaa7a5987a4f3fc98bb4f35cf39.zip
chromium_src-aa61d7ed5555ccaa7a5987a4f3fc98bb4f35cf39.tar.gz
chromium_src-aa61d7ed5555ccaa7a5987a4f3fc98bb4f35cf39.tar.bz2
Revert "Better location for setting the size of tab contents. This should"
This reverts commit r23358. TBR=japhet Review URL: http://codereview.chromium.org/165489 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23365 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser.cc23
-rw-r--r--chrome/browser/tabs/tab_strip_model.cc14
2 files changed, 23 insertions, 14 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index c6c7ce6..5fae3c8 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -1503,6 +1503,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.
@@ -1820,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);
diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc
index 2883cd0..6712ec1 100644
--- a/chrome/browser/tabs/tab_strip_model.cc
+++ b/chrome/browser/tabs/tab_strip_model.cc
@@ -16,7 +16,6 @@
#include "chrome/browser/tabs/tab_strip_model_order_controller.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/browser/tab_contents/tab_contents.h"
-#include "chrome/browser/tab_contents/tab_contents_view.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/url_constants.h"
@@ -388,19 +387,6 @@ void TabStripModel::AddTabContents(TabContents* contents,
InsertTabContentsAt(index, contents, foreground, inherit_group);
if (inherit_group && transition == PageTransition::TYPED)
contents_data_.at(index)->reset_group_on_select = true;
-
- // 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 = GetSelectedTabContents()) {
- if (!foreground)
- contents->view()->SizeContents(old_contents->view()->GetContainerSize());
- }
}
void TabStripModel::CloseSelectedTab() {