diff --git a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j index 53b93dbe6..062f41254 100644 --- a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j +++ b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j @@ -1221,6 +1221,9 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop]; else if (type === "mousedown") { + var button = aDOMEvent.button; + _mouseDownIsRightClick = button == 2 || (button == 0 && modifierFlags & CPControlKeyMask); + if (sourceElement.tagName === "INPUT" && sourceElement != _DOMFocusElement) { if ([CPPlatform supportsDragAndDrop]) @@ -1233,11 +1236,11 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop]; _mouseIsDown = YES; //fake a down and up event so that event tracking mode will work correctly - [CPApp sendEvent:[CPEvent mouseEventWithType:CPLeftMouseDown location:location modifierFlags:modifierFlags + [CPApp sendEvent:[CPEvent mouseEventWithType:_mouseDownIsRightClick ? CPRightMouseDown : CPLeftMouseDown location:location modifierFlags:modifierFlags timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:-1 clickCount:CPDOMEventGetClickCount(_lastMouseDown, timestamp, location) pressure:0]]; - [CPApp sendEvent:[CPEvent mouseEventWithType:CPLeftMouseUp location:location modifierFlags:modifierFlags + [CPApp sendEvent:[CPEvent mouseEventWithType:_mouseDownIsRightClick ? CPRightMouseUp : CPLeftMouseUp location:location modifierFlags:modifierFlags timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:-1 clickCount:CPDOMEventGetClickCount(_lastMouseDown, timestamp, location) pressure:0]]; @@ -1249,9 +1252,6 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop]; _DOMBodyElement.style["-khtml-user-drag"] = "element"; } - var button = aDOMEvent.button; - _mouseDownIsRightClick = button == 2 || (button == 0 && modifierFlags & CPControlKeyMask); - StopContextMenuDOMEventPropagation = YES; event = _CPEventFromNativeMouseEvent(aDOMEvent, _mouseDownIsRightClick ? CPRightMouseDown : CPLeftMouseDown, location, modifierFlags, timestamp, windowNumber, nil, -1, CPDOMEventGetClickCount(_lastMouseDown, timestamp, location), 0);