diff options
-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]; } } |