From f946edc1d03dda4c4fed3ff05b8c317f1b18fa7a Mon Sep 17 00:00:00 2001 From: "pinkerton@chromium.org" Date: Thu, 26 Aug 2010 13:36:08 +0000 Subject: Don't use rapid-close mode when middle-clicking a pinned tab to close it as the calculations get all messed up due to the differences in widths. BUG=51298 TEST=closing tabs and middle-click closing tabs, making sure everything resizes as expected. Review URL: http://codereview.chromium.org/3116037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57511 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/cocoa/tab_strip_controller.mm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'chrome') diff --git a/chrome/browser/cocoa/tab_strip_controller.mm b/chrome/browser/cocoa/tab_strip_controller.mm index fbe48bf..2bc8730 100644 --- a/chrome/browser/cocoa/tab_strip_controller.mm +++ b/chrome/browser/cocoa/tab_strip_controller.mm @@ -619,10 +619,17 @@ private: if (!isClosingLastTab) { // 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). + // However, if the tab being closed is a pinned tab, break out of + // rapid-closure mode since the mouse is almost guaranteed not to be over + // the closebox of the adjacent tab (due to the difference in widths). // TODO(pinkerton): re-visit when handling tab overflow. // http://crbug.com/188 - NSView* penultimateTab = [self viewAtIndex:numberOfOpenTabs - 2]; - availableResizeWidth_ = NSMaxX([penultimateTab frame]); + if (tabStripModel_->IsTabPinned(index)) { + availableResizeWidth_ = kUseFullAvailableWidth; + } else { + NSView* penultimateTab = [self viewAtIndex:numberOfOpenTabs - 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 -- cgit v1.1