summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa
diff options
context:
space:
mode:
authorjrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-11 23:21:05 +0000
committerjrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-11 23:21:05 +0000
commitf28316f0fa06f6b7d3919d41d4e6cef61105cc99 (patch)
tree05430e4f03fbba031d62f81dc3b37409d46a77a9 /chrome/browser/cocoa
parent0c13f8540e98ff5fdd11076d0158edc0fa142f0e (diff)
downloadchromium_src-f28316f0fa06f6b7d3919d41d4e6cef61105cc99.zip
chromium_src-f28316f0fa06f6b7d3919d41d4e6cef61105cc99.tar.gz
chromium_src-f28316f0fa06f6b7d3919d41d4e6cef61105cc99.tar.bz2
Fix "drag cancel" semantics.
BUG=37967 TEST=\ 1) make sure bookmark buttons still work (click to open) 2) make sure basic DnD of bookmark buttons still works 3) In Debug build, drag a bookmark button. ESC to cancel. Then mouse up. Make sure no crash. Review URL: http://codereview.chromium.org/871002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41340 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r--chrome/browser/cocoa/draggable_button.mm16
1 files changed, 7 insertions, 9 deletions
diff --git a/chrome/browser/cocoa/draggable_button.mm b/chrome/browser/cocoa/draggable_button.mm
index ff8270d..4ede10e 100644
--- a/chrome/browser/cocoa/draggable_button.mm
+++ b/chrome/browser/cocoa/draggable_button.mm
@@ -38,14 +38,6 @@ const CGFloat kWebDragStartHysteresisY = 5.0;
// Make sure that we can't start a drag until we see a mouse down again.
mayDragStart_ = NO;
- // This conditional is never true (DnD loops in Cocoa eat the mouse
- // up) but I added it in case future versions of Cocoa do unexpected
- // things.
- if (beingDragged_) {
- NOTREACHED();
- return [super mouseUp:theEvent];
- }
-
// There are non-drag cases where a mouseUp: may happen
// (e.g. mouse-down, cmd-tab to another application, move mouse,
// mouse-up). So we check.
@@ -54,7 +46,12 @@ const CGFloat kWebDragStartHysteresisY = 5.0;
if (NSPointInRect(viewLocal, [self bounds])) {
[self performClick:self];
} else {
- [self endDrag];
+ // Make sure an ESC to end a drag doesn't trigger 2 endDrags.
+ if (beingDragged_) {
+ [self endDrag];
+ } else {
+ [super mouseUp:theEvent];
+ }
}
}
@@ -88,6 +85,7 @@ const CGFloat kWebDragStartHysteresisY = 5.0;
[self hasCrossedDragThreshold:theEvent]) {
// Starting drag. Never start another drag until another mouse down.
mayDragStart_ = NO;
+ beingDragged_ = YES;
[self beginDrag:theEvent];
}
}