Bug 27670

Summary: Unable to set drag image for a link using setDragImage
Product: WebKit Reporter: Jessie Berlin <jberlin>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: ap, dtrebbien, sebastian, zajec5
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Windows 7   
Attachments:
Description Flags
Test case for setting the dragImage for a link.
none
Screenshot from Google Chrome 14.0.835.187 none

Description Jessie Berlin 2009-07-24 17:05:29 PDT
Created attachment 33477 [details]
Test case for setting the dragImage for a link.

At the start of a drag operation you can use event.dataTransfer.setDragImage(...) to change the graphic to display by the cursor during the operation.

On Windows Safari it is not supported on <a> tags, which uses the default drag image for the link instead of whatever image is specified in by setDragImage.

(Breaking up https://bugs.webkit.org/show_bug.cgi?id=24735)
Comment 1 Rafał Miłecki 2011-09-30 23:42:53 PDT
Created attachment 109399 [details]
Screenshot from Google Chrome 14.0.835.187

It works fine here.
Comment 2 Rafał Miłecki 2011-09-30 23:49:21 PDT
Jessie: first of all your test case is invalid:
1) It doesn't have DOCTYPE (like HTML5's <!DOCTYPE html>)
2) You don't pass "event" in "ondragstart"
3) In "dragLinkAndSeeDivDragged" you use undefined event

Webkit recovers from last two issues by silently magically setting "event" inside the function. Thanks to that this test case *works* in my Google Chrome 14.0.835.187.

If you fix the issues I have mentioned, the test case starts working also in Firefox.


Please, re-test this bug, it seems to be fixes now.
Comment 3 Alexey Proskuryakov 2011-10-01 22:28:41 PDT
The behavior has improved since this bug was filed, the fix was in <http://trac.webkit.org/changeset/86472>.

But the drag image is still misplaced in WebKit nigtlies.

> Webkit recovers from last two issues by silently magically setting "event" inside the function.

It's not so magical, see <http://www.quirksmode.org/js/events_access.html> for a description of window.event. Besides, it's completely unrelated to this bug, so let's not discuss that here.