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

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

Issue 10267023: Gets tab dragging to work in touch mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup Created 8 years, 8 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 c96c37faa0085c26d4e011230378bd7f84216590..01da1d2c127fbf063d9f79e4d8b8c1940cd371fb 100644
--- a/chrome/browser/ui/views/tabs/touch_tab_strip_layout.cc
+++ b/chrome/browser/ui/views/tabs/touch_tab_strip_layout.cc
@@ -109,7 +109,7 @@ void TouchTabStripLayout::AddTab(int index,
void TouchTabStripLayout::RemoveTab(int index, int start_x, int old_x) {
if (index == active_index_)
active_index_ = std::min(active_index_, tab_count() - 1);
- else if (index > active_index_)
+ else if (index < active_index_)
active_index_--;
bool removed_mini_tab = index < mini_tab_count_;
if (removed_mini_tab) {
@@ -138,12 +138,24 @@ void TouchTabStripLayout::MoveTab(int from,
x_ = start_x;
mini_tab_count_ = mini_tab_count;
active_index_ = new_active_index;
+ if (!requires_stacking() || tab_count() == mini_tab_count_) {
+ ResetToIdealState();
+ return;
+ }
SetIdealBoundsAt(active_index(), ConstrainActiveX(ideal_x(active_index())));
LayoutByTabOffsetAfter(active_index());
LayoutByTabOffsetBefore(active_index());
AdjustStackedTabs();
}
+bool TouchTabStripLayout::IsStacked(int index) const {
+ if (index == active_index() || tab_count() == mini_tab_count_)
+ return false;
+ if (index > active_index())
+ return ideal_x(index) != ideal_x(index - 1) + tab_offset();
+ return ideal_x(index + 1) != ideal_x(index) + tab_offset();
+}
+
void TouchTabStripLayout::Reset(int x,
int width,
int mini_tab_count,
« 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