Bug 24735 - Poor setDragImage support on Windows
: Poor setDragImage support on Windows
Status: RESOLVED FIXED
Product: WebKit
Classification: Unclassified
Component: New Bugs
: 528+ (Nightly build)
: PC Windows Vista
: P2 Normal
Assigned To: Jessie Berlin
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-03-20 20:35 PDT by Sebastian Markbåge
Modified: 2009-07-24 17:08 PDT (History)
3 users (show)

See Also:


Attachments
Adds the ability to set an element as the drag image on Windows (5.11 KB, patch)
2009-06-24 08:52 PDT, Jessie Berlin
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Markbåge 2009-03-20 20:35:29 PDT
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 Mac this is supported for both images and elements.

On Windows Safari has support for only images as the first parameter of setDragImage. It is not supported on <a> and <img> tags that has their own implementations that can't be overridden.

Google Chrome has the function but no graphics shows up around the cursor for any drag operation.

All versions should behave like the Mac version.
Comment 1 Jessie Berlin 2009-06-23 18:45:11 PDT
<rdar://problem/5015942>
Comment 2 Jessie Berlin 2009-06-23 18:47:10 PDT
*** Bug 24734 has been marked as a duplicate of this bug. ***
Comment 3 Jessie Berlin 2009-06-24 08:52:52 PDT
Created attachment 31785 [details]
Adds the ability to set an element as the drag image on Windows

Does not fix the case of dragging a link where the default link image
is still used, even when the -webkit-user-drag is set to "element". This
is the same behavior as is found on OS X.
Comment 4 Adam Roben (:aroben) 2009-06-24 09:45:53 PDT
Comment on attachment 31785 [details]
Adds the ability to set an element as the drag image on Windows

>  DragImageRef ClipboardWin::createDragImage(IntPoint& loc) const
>  {
>      HBITMAP result = 0;
> -    //FIXME: Need to be able to draw element <rdar://problem/5015942>
>      if (m_dragImage) {
>          result = createDragImageFromImage(m_dragImage->image());        
>          loc = m_dragLoc;
> +    } else if (m_dragImageElement) {
> +        Node* node = dragImageElement();
> +        result = node->document()->frame()->nodeImage(node);
> +        loc = m_dragLoc;
>      }

It's strange to use m_dragImageElement on the first line, then dragImageElement() on the second. I don't really have a preference, but using m_dragImageElement consistently would match the code above more closely.

r=me
Comment 5 Jessie Berlin 2009-06-24 10:04:34 PDT
(In reply to comment #4)
> (From update of attachment 31785 [details] [review])
> >  DragImageRef ClipboardWin::createDragImage(IntPoint& loc) const
> >  {
> >      HBITMAP result = 0;
> > -    //FIXME: Need to be able to draw element <rdar://problem/5015942>
> >      if (m_dragImage) {
> >          result = createDragImageFromImage(m_dragImage->image());        
> >          loc = m_dragLoc;
> > +    } else if (m_dragImageElement) {
> > +        Node* node = dragImageElement();
changed to be: Node* node = m_dragImageElement.get();
> > +        result = node->document()->frame()->nodeImage(node);
> > +        loc = m_dragLoc;
> >      }
> 
> It's strange to use m_dragImageElement on the first line, then
> dragImageElement() on the second. I don't really have a preference, but using
> m_dragImageElement consistently would match the code above more closely.
> 
> r=me
> 

Comment 6 Eric Seidel 2009-06-26 01:37:28 PDT
Does jberlin have commit-bit or does aroben plan to land this with modifications?
Comment 7 Adam Roben (:aroben) 2009-06-26 08:38:36 PDT
(In reply to comment #6)
> Does jberlin have commit-bit

Yes. <http://trac.webkit.org/search?q=jberlin&noquickjump=1&changeset=on>
Comment 8 Jessie Berlin 2009-06-26 08:47:04 PDT
(In reply to comment #6)
> Does jberlin have commit-bit or does aroben plan to land this with
> modifications?
> 

I did commit, but I didn't mark it as fixed because the bug mentions the desire to see the link tag be able to be given a custom setDragImage and that is currently not supported on either mac or windows.

Sorry I didn't respond earlier. For some reason I kept getting an "internal error" message when I navigated to this page.
Comment 9 Jessie Berlin 2009-06-26 09:09:51 PDT
Comment on attachment 31785 [details]
Adds the ability to set an element as the drag image on Windows

committed with revision 45087
Comment 10 Jessie Berlin 2009-07-24 17:08:00 PDT
Created a new bug for not being able to set the drag image of a link:

https://bugs.webkit.org/show_bug.cgi?id=27670

Marking this bug as fixed, since the last committed patch addressed all other concerns.