Chromium Code Reviews| 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 |