OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |