diff options
-rw-r--r-- | chrome/browser/browser.cc | 12 | ||||
-rw-r--r-- | chrome/browser/sessions/session_restore.cc | 13 |
2 files changed, 13 insertions, 12 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 9ae8b63..de54ece 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -803,8 +803,18 @@ TabContents* Browser::AddRestoredTab( tabstrip_model_.InsertTabContentsAt(tab_index, new_tab, select, false); if (really_pin) tabstrip_model_.SetTabPinned(tab_index, true); - if (select) + if (select) { window_->Activate(); + } else { + // We set the size of the view here, before WebKit does its initial + // layout. If we don't, the initial layout of background tabs will be + // performed with a view width of 0, which may cause script outputs and + // anchor link location calculations to be incorrect even after a new + // layout with proper view dimensions. TabStripModel::AddTabContents() + // contains similar logic. + new_tab->view()->SizeContents(window_->GetRestoredBounds().size()); + new_tab->HideContents(); + } if (profile_->HasSessionService()) { SessionService* session_service = profile_->GetSessionService(); if (session_service) diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc index dfa65d1..bd9ad1c 100644 --- a/chrome/browser/sessions/session_restore.cc +++ b/chrome/browser/sessions/session_restore.cc @@ -398,22 +398,13 @@ class SessionRestoreImpl : public NotificationObserver { 0, std::min(selected_index, static_cast<int>(tab.navigations.size() - 1))); - TabContents* new_tab = browser->AddRestoredTab(tab.navigations, + tab_loader_->AddTab(&browser->AddRestoredTab(tab.navigations, static_cast<int>(i - window.tabs.begin()), selected_index, tab.app_extension_id, false, tab.pinned, - true); - // We set the size of the view here, before WebKit does its initial - // layout. If we don't, the initial layout of background tabs will be - // performed with a view width of 0, which may cause script outputs and - // anchor link location calculations to be incorrect even after a new - // layout with proper view dimensions. TabStripModel::AddTabContents() - // contains similar logic. - new_tab->view()->SizeContents(window.bounds.size()); - new_tab->HideContents(); - tab_loader_->AddTab(&new_tab->controller()); + true)->controller()); } } |