diff options
author | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-07 01:03:38 +0000 |
---|---|---|
committer | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-07 01:03:38 +0000 |
commit | a45a84fa3d8005703a3cdbd204b25d40297599da (patch) | |
tree | 505a6f33b12520f2bcc96df269dd1897ea715a0a | |
parent | dd31528ce2728b82a3ab8600c78d119ee9fb81a0 (diff) | |
download | chromium_src-a45a84fa3d8005703a3cdbd204b25d40297599da.zip chromium_src-a45a84fa3d8005703a3cdbd204b25d40297599da.tar.gz chromium_src-a45a84fa3d8005703a3cdbd204b25d40297599da.tar.bz2 |
Mac: fix tab closure problem when close tab buttons not shown.
BUG=26889
TEST=See bug description.
Review URL: http://codereview.chromium.org/373020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31347 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/cocoa/tab_view.mm | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/chrome/browser/cocoa/tab_view.mm b/chrome/browser/cocoa/tab_view.mm index 5900ac1..4da590b 100644 --- a/chrome/browser/cocoa/tab_view.mm +++ b/chrome/browser/cocoa/tab_view.mm @@ -221,11 +221,15 @@ static const CGFloat kRapidCloseDist = 2.5; NSPoint downLocation = [theEvent locationInWindow]; + // Record the state of the close button here, because selecting the tab will + // unhide it. + BOOL closeButtonActive = [closeButton_ isHidden] ? NO : YES; + // During the tab closure animation (in particular, during rapid tab closure), // we may get incorrectly hit with a mouse down. If it should have gone to the // close button, we send it there -- it should then track the mouse, so we // don't have to worry about mouse ups. - if ([controller_ inRapidClosureMode]) { + if (closeButtonActive && [controller_ inRapidClosureMode]) { NSPoint hitLocation = [[self superview] convertPoint:downLocation fromView:nil]; if ([self hitTest:hitLocation] == closeButton_) { @@ -292,7 +296,8 @@ static const CGFloat kRapidCloseDist = 2.5; // During rapid tab closure (mashing tab close buttons), we may get hit // with a mouse down. As long as the mouse up is over the close button, // and the mouse hasn't moved too much, we close the tab. - if ((dx*dx + dy*dy) <= kRapidCloseDist*kRapidCloseDist && + if (closeButtonActive && + (dx*dx + dy*dy) <= kRapidCloseDist*kRapidCloseDist && [controller_ inRapidClosureMode]) { NSPoint hitLocation = [[self superview] convertPoint:[theEvent locationInWindow] |