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

Side by Side Diff: chrome/browser/ui/views/tabs/stacked_tab_strip_layout.cc

Issue 2918653002: Prevent gap when gesture-dragging in stacked tab mode (Closed)
Patch Set: added tests Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/views/tabs/stacked_tab_strip_layout_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/tabs/stacked_tab_strip_layout.h" 5 #include "chrome/browser/ui/views/tabs/stacked_tab_strip_layout.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/user_metrics.h" 10 #include "base/metrics/user_metrics.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 80
81 base::RecordAction(UserMetricsAction("StackedTab_DragActiveTab")); 81 base::RecordAction(UserMetricsAction("StackedTab_DragActiveTab"));
82 int initial_x = ideal_x(active_index()); 82 int initial_x = ideal_x(active_index());
83 // If we're at a particular edge and start dragging, expose all the tabs after 83 // If we're at a particular edge and start dragging, expose all the tabs after
84 // the tab (or before when dragging to the left). 84 // the tab (or before when dragging to the left).
85 if (delta > 0 && initial_x == GetMinX(active_index())) { 85 if (delta > 0 && initial_x == GetMinX(active_index())) {
86 LayoutByTabOffsetAfter(active_index()); 86 LayoutByTabOffsetAfter(active_index());
87 AdjustStackedTabs(); 87 AdjustStackedTabs();
88 } else if (delta < 0 && initial_x == GetMaxX(active_index())) { 88 } else if (delta < 0 && initial_x == GetMaxX(active_index())) {
89 LayoutByTabOffsetBefore(active_index()); 89 LayoutByTabOffsetBefore(active_index());
90 ResetToIdealState(); 90 AdjustStackedTabs();
91 } 91 }
92 int x = delta > 0 ? 92 int x = delta > 0 ?
93 std::min(initial_x + delta, GetMaxDragX(active_index())) : 93 std::min(initial_x + delta, GetMaxDragX(active_index())) :
94 std::max(initial_x + delta, GetMinDragX(active_index())); 94 std::max(initial_x + delta, GetMinDragX(active_index()));
95 if (x != initial_x) { 95 if (x != initial_x) {
96 SetIdealBoundsAt(active_index(), x); 96 SetIdealBoundsAt(active_index(), x);
97 if (delta > 0) { 97 if (delta > 0) {
98 PushTabsAfter(active_index(), (x - initial_x)); 98 PushTabsAfter(active_index(), (x - initial_x));
99 LayoutForDragBefore(active_index()); 99 LayoutForDragBefore(active_index());
100 } else { 100 } else {
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 return width_ - trailing_offset - size_.width(); 565 return width_ - trailing_offset - size_.width();
566 } 566 }
567 567
568 int StackedTabStripLayout::GetMinXCompressed(int index) const { 568 int StackedTabStripLayout::GetMinXCompressed(int index) const {
569 DCHECK_GT(index, active_index()); 569 DCHECK_GT(index, active_index());
570 return std::max( 570 return std::max(
571 width_ - width_for_count(tab_count() - index), 571 width_ - width_for_count(tab_count() - index),
572 ideal_x(active_index()) + 572 ideal_x(active_index()) +
573 stacked_padding_for_count(index - active_index())); 573 stacked_padding_for_count(index - active_index()));
574 } 574 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/tabs/stacked_tab_strip_layout_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698