Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Unified Diff: chrome/browser/browser.cc

Issue 126290: Force sizing of a new tab as soon as TabContents is created.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/views/tab_contents/tab_contents_view_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browser.cc
===================================================================
--- chrome/browser/browser.cc (revision 21711)
+++ chrome/browser/browser.cc (working copy)
@@ -1464,6 +1464,17 @@
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.
« no previous file with comments | « no previous file | chrome/browser/views/tab_contents/tab_contents_view_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698