Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/tab_strip.h" | 5 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 961 AnimateToIdealBounds(); | 961 AnimateToIdealBounds(); |
| 962 } | 962 } |
| 963 | 963 |
| 964 void TabStrip::StartMouseInitiatedRemoveTabAnimation(int model_index) { | 964 void TabStrip::StartMouseInitiatedRemoveTabAnimation(int model_index) { |
| 965 // The user initiated the close. We want to persist the bounds of all the | 965 // The user initiated the close. We want to persist the bounds of all the |
| 966 // existing tabs, so we manually shift ideal_bounds then animate. | 966 // existing tabs, so we manually shift ideal_bounds then animate. |
| 967 int tab_data_index = ModelIndexToTabIndex(model_index); | 967 int tab_data_index = ModelIndexToTabIndex(model_index); |
| 968 DCHECK(tab_data_index != tab_count()); | 968 DCHECK(tab_data_index != tab_count()); |
| 969 BaseTab* tab_closing = base_tab_at_tab_index(tab_data_index); | 969 BaseTab* tab_closing = base_tab_at_tab_index(tab_data_index); |
| 970 int delta = tab_closing->width() + kTabHOffset; | 970 int delta = tab_closing->width() + kTabHOffset; |
| 971 if (tab_closing->data().mini && model_index + 1 < GetModelCount() && | 971 // If the tab being closed is a mini-tab next to a non-mini-tab, be sure to |
| 972 !GetBaseTabAtModelIndex(model_index + 1)->data().mini) { | 972 // add the extra padding. |
| 973 int next_tab_data_index = ModelIndexToTabIndex(model_index + 1); | |
| 974 if (tab_closing->data().mini && next_tab_data_index < tab_count() && | |
|
sky
2011/07/06 20:54:56
Insert:
DCHECK_NE(next_tab_index, tab_count())
bet
| |
| 975 !base_tab_at_tab_index(next_tab_data_index)->data().mini) { | |
| 973 delta += mini_to_non_mini_gap_; | 976 delta += mini_to_non_mini_gap_; |
| 974 } | 977 } |
| 975 | 978 |
| 976 for (int i = tab_data_index + 1; i < tab_count(); ++i) { | 979 for (int i = tab_data_index + 1; i < tab_count(); ++i) { |
| 977 BaseTab* tab = base_tab_at_tab_index(i); | 980 BaseTab* tab = base_tab_at_tab_index(i); |
| 978 if (!tab->closing()) { | 981 if (!tab->closing()) { |
| 979 gfx::Rect bounds = ideal_bounds(i); | 982 gfx::Rect bounds = ideal_bounds(i); |
| 980 bounds.set_x(bounds.x() - delta); | 983 bounds.set_x(bounds.x() - delta); |
| 981 set_ideal_bounds(i, bounds); | 984 set_ideal_bounds(i, bounds); |
| 982 } | 985 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1015 } | 1018 } |
| 1016 return mini_count; | 1019 return mini_count; |
| 1017 } | 1020 } |
| 1018 | 1021 |
| 1019 bool TabStrip::IsPointInTab(Tab* tab, | 1022 bool TabStrip::IsPointInTab(Tab* tab, |
| 1020 const gfx::Point& point_in_tabstrip_coords) { | 1023 const gfx::Point& point_in_tabstrip_coords) { |
| 1021 gfx::Point point_in_tab_coords(point_in_tabstrip_coords); | 1024 gfx::Point point_in_tab_coords(point_in_tabstrip_coords); |
| 1022 View::ConvertPointToView(this, tab, &point_in_tab_coords); | 1025 View::ConvertPointToView(this, tab, &point_in_tab_coords); |
| 1023 return tab->HitTest(point_in_tab_coords); | 1026 return tab->HitTest(point_in_tab_coords); |
| 1024 } | 1027 } |
| OLD | NEW |