diff options
author | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-26 15:13:06 +0000 |
---|---|---|
committer | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-26 15:13:06 +0000 |
commit | bf6a46bed6770a7041c222e4505135bd30701576 (patch) | |
tree | 9db14a22dec4b004ebef77ac9a2542731c3c95ea /chrome/browser/cocoa/tab_view.mm | |
parent | c1e5367f145edccb340f1778f26435c70774ef7a (diff) | |
download | chromium_src-bf6a46bed6770a7041c222e4505135bd30701576.zip chromium_src-bf6a46bed6770a7041c222e4505135bd30701576.tar.gz chromium_src-bf6a46bed6770a7041c222e4505135bd30701576.tar.bz2 |
Mac: Make middle-click tab closure cancellable.
When middle-clicking a tab to close it, one should be able to move the mouse off
the tab before releasing to cancel it.
BUG=16019
TEST=Get a 3-button mouse. Make sure middle-clicking tabs to close them still works. Make sure moving the mouse off the tab before releasing the button cancels.
Review URL: http://codereview.chromium.org/333021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30048 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/tab_view.mm')
-rw-r--r-- | chrome/browser/cocoa/tab_view.mm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/chrome/browser/cocoa/tab_view.mm b/chrome/browser/cocoa/tab_view.mm index 626e841..fd8c737 100644 --- a/chrome/browser/cocoa/tab_view.mm +++ b/chrome/browser/cocoa/tab_view.mm @@ -552,7 +552,14 @@ static const CGFloat kRapidCloseDist = 2.5; - (void)otherMouseUp:(NSEvent*)theEvent { // Support middle-click-to-close. if ([theEvent buttonNumber] == 2) { - [controller_ closeTab:self]; + // |-hitTest:| takes a location in the superview's coordinates. + NSPoint upLocation = + [[self superview] convertPoint:[theEvent locationInWindow] + fromView:nil]; + // If the mouse up occurred in our view or over the close button, then + // close. + if ([self hitTest:upLocation]) + [controller_ closeTab:self]; } } |