Bug 19385

Summary: [Qt] Dragging and dropping an image in edit mode does not work
Product: WebKit Reporter: Jonathon Jongsma (jonner) <jonathon>
Component: HTML EditingAssignee: Nobody <webkit-unassigned>
Severity: Normal CC: ap, benjamin, commit-queue
Priority: P2 Keywords: Qt, QtTriaged
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Description Flags
Possible fix to insert the image into the editable document at the drop location
eric: review-
A simple test case
Patch none

Description Jonathon Jongsma (jonner) 2008-06-03 20:04:25 PDT
Steps to reproduce:
- make page editable
- click on and drag an image
- drop the image in a different spot on the page (e.g. in the middle of a paragraph somewhere)

- the image is deleted from its original position, but it is not inserted into the document at the new position

expected behavior:
- the image should be moved from the old position to the new drop position
Comment 1 Jonathon Jongsma (jonner) 2008-06-03 20:06:41 PDT
Created attachment 21489 [details]
Possible fix to insert the image into the editable document at the drop location

Basically, when dragging an image it was saving the image data to the clipboard, but to move it within an editable html document, we want to save the html fragment in the clipboard and paste that into the new location.  This patch just adds the html fragment as an additional format in the drag clipboard.
Comment 2 Mark Rowe (bdash) 2008-06-03 20:34:18 PDT
This already behaves correctly on the Mac, which suggests to me that the fix should not be in core cross-platform code but in GTK-specific client classes.
Comment 3 Eric Seidel (no email) 2008-07-24 11:43:52 PDT
Comment on attachment 21489 [details]
Possible fix to insert the image into the editable document at the drop location

I just tested:

1.  open "about:blank"
2.  type "javascript:document.designMode="on""
3.  Drag the google.com logo from google.com onto the now-editable about:blank document.

it worked for me on the Mac.  Suggesting that this is a gtk-only issue?  Please provide a test case so we can verify if your fix affects other platforms.
Comment 4 Jonathon Jongsma (jonner) 2008-07-28 07:12:51 PDT
Created attachment 22520 [details]
A simple test case

Thanks for looking at this Eric.  I think your test case might be a slightly different situation than the bug I am seeing, so I'm attaching a simple test case to illustrate the problem I'm seeing (sorry for not attaching this initially).  

By the way, I'm seeing this issue in Qt, and it's possible that it only affects the Qt port, but from my reading of the source code, this seems unlikely to me.
Comment 5 Alexey Proskuryakov 2011-01-07 15:49:15 PST
If I understand what this bug is about, the attached test case also works fine in Safari 5 on Mac OS X. The image is successfully moved, and all attributes (like ALT) are preserved.
Comment 6 Benjamin Poulain 2011-04-06 08:17:36 PDT
Created attachment 88427 [details]
Comment 7 Andreas Kling 2011-04-08 11:23:50 PDT
Comment on attachment 88427 [details]

Comment 8 WebKit Commit Bot 2011-04-08 13:36:39 PDT
Comment on attachment 88427 [details]

Clearing flags on attachment: 88427

Committed r83338: <http://trac.webkit.org/changeset/83338>
Comment 9 WebKit Commit Bot 2011-04-08 13:36:44 PDT
All reviewed patches have been landed.  Closing bug.