diff --git a/AppKit/CPDragServer.j b/AppKit/CPDragServer.j index 9d64de97d..1e57c641f 100644 --- a/AppKit/CPDragServer.j +++ b/AppKit/CPDragServer.j @@ -251,7 +251,7 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0, return dragOperation; } -- (void)draggingEndedInPlatformWindow:(CPPlatformWindow)aPlatformWindow globalLocation:(CGPoint)aLocation +- (void)draggingEndedInPlatformWindow:(CPPlatformWindow)aPlatformWindow globalLocation:(CGPoint)aLocation operation:(CPDragOperation)anOperation { [_draggedView removeFromSuperview]; @@ -259,10 +259,10 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0, [_draggedWindow orderOut:self]; if (_implementedDraggingSourceMethods & CPDraggingSource_draggedImage_endAt_operation_) - [_draggingSource draggedImage:[_draggedView image] endedAt:aLocation operation:NO]; + [_draggingSource draggedImage:[_draggedView image] endedAt:aLocation operation:anOperation]; else if (_implementedDraggingSourceMethods & CPDraggingSource_draggedView_endedAt_operation_) - [_draggingSource draggedView:_draggedView endedAt:aLocation operation:NO]; + [_draggingSource draggedView:_draggedView endedAt:aLocation operation:anOperation]; _isDragging = NO; } @@ -386,7 +386,7 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0, if (type === CPLeftMouseUp) { [self performDragOperationInPlatformWindow:platformWindow]; - [self draggingEndedInPlatformWindow:platformWindow globalLocation:platformWindowLocation]; + [self draggingEndedInPlatformWindow:platformWindow globalLocation:platformWindowLocation operation:CPDragOperationNone]; // Stop tracking events. return; diff --git a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j index 84daf8745..75061618f 100644 --- a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j +++ b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j @@ -411,7 +411,20 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop]; } else if (type === "dragend") - [dragServer draggingEndedInPlatformWindow:self globalLocation:[CPPlatform isBrowser] ? location : _CGPointMake(aDOMEvent.screenX, aDOMEvent.screenY)]; + { + var dropEffect = aDOMEvent.dataTransfer.dropEffect; + + if (dropEffect === "move") + dragOperation = CPDragOperationMove; + else if (dropEffect === "copy") + dragOperation = CPDragOperationCopy; + else if (dropEffect === "link") + dragOperation = CPDragOperationLink; + else + dragOperation = CPDragOperationNone; + + [dragServer draggingEndedInPlatformWindow:self globalLocation:[CPPlatform isBrowser] ? location : _CGPointMake(aDOMEvent.screenX, aDOMEvent.screenY) operation:dragOperation]; + } else //if (type === "drop") {