Chromium Code Reviews| Index: chrome/browser/ui/cocoa/tabs/tab_view.mm |
| diff --git a/chrome/browser/ui/cocoa/tabs/tab_view.mm b/chrome/browser/ui/cocoa/tabs/tab_view.mm |
| index 45f042013cd4c9b18d629a8d4f8176810d1b274c..05da4d9060455c966d60edba1320898e02a26db1 100644 |
| --- a/chrome/browser/ui/cocoa/tabs/tab_view.mm |
| +++ b/chrome/browser/ui/cocoa/tabs/tab_view.mm |
| @@ -47,10 +47,6 @@ const NSTimeInterval kAlertHideDuration = 0.4; |
| // increasing/decreasing). |
| const NSTimeInterval kGlowUpdateInterval = 0.025; |
| -// This is used to judge whether the mouse has moved during rapid closure; if it |
| -// has moved less than the threshold, we want to close the tab. |
| -const CGFloat kRapidCloseDist = 2.5; |
| - |
| // This class contains the logic for drawing Material Design tab images. The |
| // |setTabEdgeStrokeColor| method is overridden by |TabHeavyImageMaker| to draw |
| // high-contrast tabs. |
| @@ -344,37 +340,13 @@ CGFloat LineWidthFromContext(CGContextRef context) { |
| } |
| - (void)mouseUp:(NSEvent*)theEvent { |
| - // Check for rapid tab closure. |
| - if ([theEvent type] == NSLeftMouseUp) { |
| - NSPoint upLocation = [theEvent locationInWindow]; |
| - CGFloat dx = upLocation.x - mouseDownPoint_.x; |
| - CGFloat dy = upLocation.y - mouseDownPoint_.y; |
| - |
| - // During rapid tab closure (mashing tab close buttons), we may get hit |
|
Robert Sesek
2016/09/08 15:15:12
Why is this no longer necesary?
erikchen
2016/09/08 17:09:46
Whoops, still needed.
|
| - // 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 (![closeButton_ isHidden] && |
| - (dx*dx + dy*dy) <= kRapidCloseDist*kRapidCloseDist && |
| - [controller_ inRapidClosureMode]) { |
| - NSPoint hitLocation = |
| - [[self superview] convertPoint:[theEvent locationInWindow] |
| - fromView:nil]; |
| - if ([self hitTest:hitLocation] == closeButton_) { |
| - [controller_ closeTab:self]; |
| - return; |
| - } |
| - } |
| - } |
| - |
| - // Fire the action to select the tab. |
| - [controller_ selectTab:self]; |
|
Robert Sesek
2016/09/08 15:15:12
This is no longer necessary because the super trig
erikchen
2016/09/08 17:09:46
The nested run loop in -[TabStripDragController ma
|
| - |
| - // Messaging the drag controller with |-endDrag:| would seem like the right |
| - // thing to do here. But, when a tab has been detached, the controller's |
| - // target is nil until the drag is finalized. Since |-mouseUp:| gets called |
| - // via the manual event loop inside -[TabStripDragController |
| - // maybeStartDrag:forTab:], the drag controller can end the dragging session |
| - // itself directly after calling this. |
| + // This method intentionally forwards to the super implementation without |
| + // doing anything. mouseDown: triggers a nested run loop that swallows the |
| + // mouseUp: event, so we never expect a meaningful mouseUp: on a TabView. |
| + // There's a bug in AppKit that triggers mouseUp: callbacks on inappropriate |
| + // views, so it's doubly important that this method doesn't do anything. |
| + // https://crbug.com/511095. |
| + [super mouseUp:theEvent]; |
| } |
| - (void)otherMouseUp:(NSEvent*)theEvent { |