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

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

Issue 10407110: Adds clipping to the tabs when stacked. This is necessary so we don't (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_unittest.cc ('k') | no next file » | 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/touch_tab_strip_layout.h" 5 #include "chrome/browser/ui/views/tabs/touch_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/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 ResetToIdealState(); 149 ResetToIdealState();
150 return; 150 return;
151 } 151 }
152 SetIdealBoundsAt(active_index(), ConstrainActiveX(ideal_x(active_index()))); 152 SetIdealBoundsAt(active_index(), ConstrainActiveX(ideal_x(active_index())));
153 LayoutByTabOffsetAfter(active_index()); 153 LayoutByTabOffsetAfter(active_index());
154 LayoutByTabOffsetBefore(active_index()); 154 LayoutByTabOffsetBefore(active_index());
155 AdjustStackedTabs(); 155 AdjustStackedTabs();
156 } 156 }
157 157
158 bool TouchTabStripLayout::IsStacked(int index) const { 158 bool TouchTabStripLayout::IsStacked(int index) const {
159 if (index == active_index() || tab_count() == mini_tab_count_) 159 if (index == active_index() || tab_count() == mini_tab_count_ ||
160 index < mini_tab_count_)
160 return false; 161 return false;
161 if (index > active_index()) 162 if (index > active_index())
162 return ideal_x(index) != ideal_x(index - 1) + tab_offset(); 163 return ideal_x(index) != ideal_x(index - 1) + tab_offset();
163 return ideal_x(index + 1) != ideal_x(index) + tab_offset(); 164 return ideal_x(index + 1) != ideal_x(index) + tab_offset();
164 } 165 }
165 166
166 #if !defined(NDEBUG) 167 #if !defined(NDEBUG)
167 std::string TouchTabStripLayout::BoundsString() const { 168 std::string TouchTabStripLayout::BoundsString() const {
168 std::string result; 169 std::string result;
169 for (int i = 0; i < view_model_->view_size(); ++i) { 170 for (int i = 0; i < view_model_->view_size(); ++i) {
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 } 434 }
434 435
435 int TouchTabStripLayout::GetMinXCompressed(int index) const { 436 int TouchTabStripLayout::GetMinXCompressed(int index) const {
436 DCHECK_GT(index, active_index()); 437 DCHECK_GT(index, active_index());
437 return std::max( 438 return std::max(
438 width_ - width_for_count(tab_count() - index), 439 width_ - width_for_count(tab_count() - index),
439 ideal_x(active_index()) + 440 ideal_x(active_index()) +
440 stacked_padding_for_count(index - active_index())); 441 stacked_padding_for_count(index - active_index()));
441 442
442 } 443 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698