Chromium Code Reviews| Index: chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.mm |
| diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.mm |
| index 3d168310cbb5820ab90d3ccf9d4b9e060d6e76ba..074476a276614c9312140774a33caf325561f25b 100644 |
| --- a/chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.mm |
| +++ b/chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.mm |
| @@ -17,6 +17,7 @@ |
| #include "ui/base/cocoa/cocoa_base_utils.h" |
| #include "ui/gfx/mac/scoped_cocoa_disable_screen_updates.h" |
| +const CGFloat kHorizontalTearDistance = 10.0; // Using the same value as Views. |
| const CGFloat kTearDistance = 36.0; |
| const NSTimeInterval kTearDuration = 0.333; |
| @@ -171,9 +172,17 @@ static BOOL PointIsInsideView(NSPoint screenPoint, NSView* view) { |
| if (draggingWithinTabStrip_) { |
| NSPoint thisPoint = [NSEvent mouseLocation]; |
| CGFloat offset = thisPoint.x - dragOrigin_.x; |
| - [sourceController_ insertPlaceholderForTab:[draggedTab_ tabView] |
| - frame:NSOffsetRect(sourceTabFrame_, |
| - offset, 0)]; |
| + // Only begin dragging the tab horizontally if it's torn out of its dead |
| + // zone. |
| + if (!outOfTabHorizontalDeadZone_ && |
| + fabs(offset) > kHorizontalTearDistance) { |
| + outOfTabHorizontalDeadZone_ = YES; |
| + } |
| + if (outOfTabHorizontalDeadZone_) { |
|
erikchen
2016/11/30 21:07:34
I patched this in and tried tab dragging. It seeme
njagsarran
2016/12/02 16:43:12
I'm seeing that error, too. I undid my changed and
erikchen
2016/12/07 17:53:20
You're right. Tried again and I can reproduce the
|
| + [sourceController_ insertPlaceholderForTab:[draggedTab_ tabView] |
| + frame:NSOffsetRect(sourceTabFrame_, |
| + offset, 0)]; |
| + } |
| // Check that we haven't pulled the tab too far to start a drag. This |
| // can include either pulling it too far down, or off the side of the tab |
| // strip that would cause it to no longer be fully visible. |
| @@ -403,6 +412,7 @@ static BOOL PointIsInsideView(NSPoint screenPoint, NSView* view) { |
| - (void)endDrag:(NSEvent*)event { |
| // Cancel any delayed -continueDrag: requests that may still be pending. |
| [NSObject cancelPreviousPerformRequestsWithTarget:self]; |
| + outOfTabHorizontalDeadZone_ = NO; |
| // Special-case this to keep the logic below simpler. |
| if (moveWindowOnDrag_) { |