Index: chrome/browser/cocoa/tab_view.mm |
diff --git a/chrome/browser/cocoa/tab_view.mm b/chrome/browser/cocoa/tab_view.mm |
index 626e841088e4d7e3426a0ed7e7b47a5d80ab90f4..fd8c737fe5bd5637bdce5a68b82fb76737567836 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]; |
} |
} |