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() { |