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

Unified Diff: chrome/browser/ui/views/tabs/tab_strip.cc

Issue 10910005: Makes the tabstrip center the active tab when transitioning from (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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/ui/views/tabs/touch_tab_strip_layout.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/tabs/tab_strip.cc
diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc
index 10d92de52c9a1b0d99591f9f931ac8a5c32161ad..fee20d087f481ec11bc721038924f2ec1abfac5d 100644
--- a/chrome/browser/ui/views/tabs/tab_strip.cc
+++ b/chrome/browser/ui/views/tabs/tab_strip.cc
@@ -618,9 +618,21 @@ void TabStrip::SetLayoutType(TabStripLayoutType layout_type,
if (layout_type == layout_type_)
return;
+ const int active_index = controller_->GetActiveIndex();
+ int active_center = 0;
+ if (active_index != -1) {
+ active_center = ideal_bounds(active_index).x() +
+ ideal_bounds(active_index).width() / 2;
+ }
layout_type_ = layout_type;
SetResetToShrinkOnExit(false);
SwapLayoutIfNecessary();
+ // When transitioning to stacked try to keep the active tab centered.
+ if (touch_layout_.get() && active_index != -1) {
+ touch_layout_->SetActiveTabLocation(
+ active_center - ideal_bounds(active_index).width() / 2);
+ AnimateToIdealBounds();
+ }
}
gfx::Rect TabStrip::GetNewTabButtonBounds() {
« no previous file with comments | « no previous file | chrome/browser/ui/views/tabs/touch_tab_strip_layout.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698