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

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

Issue 7044061: Fixes bug where closing a pinned tab followed by dragging a tab could (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_strip.h ('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) 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 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/stl_util-inl.h" 10 #include "base/stl_util-inl.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // ideal bounds and we need to know ideal bounds is in a good state. 207 // ideal bounds and we need to know ideal bounds is in a good state.
208 StopAnimating(true); 208 StopAnimating(true);
209 } 209 }
210 210
211 int model_count = GetModelCount(); 211 int model_count = GetModelCount();
212 if (model_index + 1 != model_count && model_count > 1) { 212 if (model_index + 1 != model_count && model_count > 1) {
213 // The user is about to close a tab other than the last tab. Set 213 // The user is about to close a tab other than the last tab. Set
214 // available_width_for_tabs_ so that if we do a layout we don't position a 214 // available_width_for_tabs_ so that if we do a layout we don't position a
215 // tab past the end of the second to last tab. We do this so that as the 215 // tab past the end of the second to last tab. We do this so that as the
216 // user closes tabs with the mouse a tab continues to fall under the mouse. 216 // user closes tabs with the mouse a tab continues to fall under the mouse.
217 available_width_for_tabs_ = GetAvailableWidthForTabs( 217 Tab* last_tab = GetTabAtModelIndex(model_count - 1);
218 GetTabAtModelIndex(model_count - 2)); 218 Tab* tab_being_removed = GetTabAtModelIndex(model_index);
219 available_width_for_tabs_ = last_tab->x() + last_tab->width() -
220 tab_being_removed->width() - kTabHOffset;
221 if (model_index == 0 && tab_being_removed->data().mini &&
222 !GetTabAtModelIndex(1)->data().mini) {
223 available_width_for_tabs_ -= mini_to_non_mini_gap_;
224 }
219 } 225 }
220 226
221 in_tab_close_ = true; 227 in_tab_close_ = true;
222 AddMessageLoopObserver(); 228 AddMessageLoopObserver();
223 } 229 }
224 230
225 void TabStrip::RemoveTabAt(int model_index) { 231 void TabStrip::RemoveTabAt(int model_index) {
226 if (in_tab_close_ && model_index != GetModelCount()) 232 if (in_tab_close_ && model_index != GetModelCount())
227 StartMouseInitiatedRemoveTabAnimation(model_index); 233 StartMouseInitiatedRemoveTabAnimation(model_index);
228 else 234 else
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 int mini_count = 0; 995 int mini_count = 0;
990 for (int i = 0; i < tab_count(); ++i) { 996 for (int i = 0; i < tab_count(); ++i) {
991 if (base_tab_at_tab_index(i)->data().mini) 997 if (base_tab_at_tab_index(i)->data().mini)
992 mini_count++; 998 mini_count++;
993 else 999 else
994 return mini_count; 1000 return mini_count;
995 } 1001 }
996 return mini_count; 1002 return mini_count;
997 } 1003 }
998 1004
999 int TabStrip::GetAvailableWidthForTabs(Tab* last_tab) const {
1000 return last_tab->x() + last_tab->width();
1001 }
1002
1003 bool TabStrip::IsPointInTab(Tab* tab, 1005 bool TabStrip::IsPointInTab(Tab* tab,
1004 const gfx::Point& point_in_tabstrip_coords) { 1006 const gfx::Point& point_in_tabstrip_coords) {
1005 gfx::Point point_in_tab_coords(point_in_tabstrip_coords); 1007 gfx::Point point_in_tab_coords(point_in_tabstrip_coords);
1006 View::ConvertPointToView(this, tab, &point_in_tab_coords); 1008 View::ConvertPointToView(this, tab, &point_in_tab_coords);
1007 return tab->HitTest(point_in_tab_coords); 1009 return tab->HitTest(point_in_tab_coords);
1008 } 1010 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_strip.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698