Bug 24735 - Poor setDragImage support on Windows
: Poor setDragImage support on Windows
Status: RESOLVED FIXED
: WebKit
New Bugs
: 528+ (Nightly build)
: PC Windows Vista
: P2 Normal
Assigned To:
:
:
:
:
  Show dependency treegraph
 
Reported: 2009-03-20 20:35 PST by
Modified: 2009-07-24 17:08 PST (History)


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


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2009-03-20 20:35:29 PST
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 From 2009-06-23 18:45:11 PST -------
<rdar://problem/5015942>
------- Comment #2 From 2009-06-23 18:47:10 PST -------
*** Bug 24734 has been marked as a duplicate of this bug. ***
------- Comment #3 From 2009-06-24 08:52:52 PST -------
Created an attachment (id=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 From 2009-06-24 09:45:53 PST -------
(From update of attachment 31785 [details])
>  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 From 2009-06-24 10:04:34 PST -------
(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 From 2009-06-26 01:37:28 PST -------
Does jberlin have commit-bit or does aroben plan to land this with modifications?
------- Comment #7 From 2009-06-26 08:38:36 PST -------
(In reply to comment #6)
> Does jberlin have commit-bit

Yes. <http://trac.webkit.org/search?q=jberlin&noquickjump=1&changeset=on>
------- Comment #8 From 2009-06-26 08:47:04 PST -------
(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 From 2009-06-26 09:09:51 PST -------
(From update of attachment 31785 [details])
committed with revision 45087
------- Comment #10 From 2009-07-24 17:08:00 PST -------
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.