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

Unified Diff: chrome/browser/ui/views/tabs/touch_tab_strip_layout.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
Index: chrome/browser/ui/views/tabs/touch_tab_strip_layout.cc
diff --git a/chrome/browser/ui/views/tabs/touch_tab_strip_layout.cc b/chrome/browser/ui/views/tabs/touch_tab_strip_layout.cc
index f41a3136ba68ace240b88f193c029b924ef4a0e0..d15084aba0c664b186317228afd46fb9d449c052 100644
--- a/chrome/browser/ui/views/tabs/touch_tab_strip_layout.cc
+++ b/chrome/browser/ui/views/tabs/touch_tab_strip_layout.cc
@@ -164,6 +164,23 @@ bool TouchTabStripLayout::IsStacked(int index) const {
return ideal_x(index + 1) != ideal_x(index) + tab_offset();
}
+void TouchTabStripLayout::SetActiveTabLocation(int x) {
+ if (!requires_stacking())
+ return;
+
+ const int index = active_index();
+ if (index <= mini_tab_count_)
+ return;
+
+ x = std::min(GetMaxX(index), std::max(x, GetMinX(index)));
+ if (x == ideal_x(index))
+ return;
+
+ SetIdealBoundsAt(index, x);
+ LayoutByTabOffsetBefore(index);
+ LayoutByTabOffsetAfter(index);
+}
+
#if !defined(NDEBUG)
std::string TouchTabStripLayout::BoundsString() const {
std::string result;
« no previous file with comments | « chrome/browser/ui/views/tabs/touch_tab_strip_layout.h ('k') | chrome/browser/ui/views/tabs/touch_tab_strip_layout_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698