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

Unified Diff: chrome/browser/cocoa/tab_strip_controller.mm

Issue 196137: Improve tab-closability of right-most tab. (Closed)
Patch Set: Created 11 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/tab_strip_controller.mm
diff --git a/chrome/browser/cocoa/tab_strip_controller.mm b/chrome/browser/cocoa/tab_strip_controller.mm
index 8c47c8e6e3dcb2a075f8a9e0d5175e72d3e1238f..9b4ec081b1703c792b25aea1e32f9cacf7a373a4 100644
--- a/chrome/browser/cocoa/tab_strip_controller.mm
+++ b/chrome/browser/cocoa/tab_strip_controller.mm
@@ -288,11 +288,19 @@ static const float kIndentLeavingSpaceForControls = 64.0;
if (contents)
UserMetrics::RecordAction(L"CloseTab_Mouse", contents->profile());
if ([self numberOfTabViews] > 1) {
- // Limit the width available for laying out tabs so that tabs are not
- // resized until a later time (when the mouse leaves the tab strip).
- // TODO(pinkerton): re-visit when handling tab overflow.
- NSView* penultimateTab = [self viewAtIndex:[tabArray_ count] - 2];
- availableResizeWidth_ = NSMaxX([penultimateTab frame]);
+ if (static_cast<size_t>(index) != [tabArray_ count] - 1) {
pink (ping after 24hrs) 2009/09/16 14:37:16 i'd reverse the if/else cases here. check for the
+ // Limit the width available for laying out tabs so that tabs are not
+ // resized until a later time (when the mouse leaves the tab strip).
+ // TODO(pinkerton): re-visit when handling tab overflow.
+ NSView* penultimateTab = [self viewAtIndex:[tabArray_ count] - 2];
+ availableResizeWidth_ = NSMaxX([penultimateTab frame]);
+ } else {
+ // If the rightmost tab is closed, change the available width so that
+ // another tab's close button lands below the cursor (assuming the tabs
+ // are currently below their maximum width and can grow).
+ NSView* lastTab = [self viewAtIndex:[tabArray_ count] - 1];
+ availableResizeWidth_ = NSMaxX([lastTab frame]);
+ }
tabModel_->CloseTabContentsAt(index);
} else {
// Use the standard window close if this is the last tab
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698