Bug 19385 - [Qt] Dragging and dropping an image in edit mode does not work
Summary: [Qt] Dragging and dropping an image in edit mode does not work
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: Qt, QtTriaged
Depends on:
Blocks:
 
Reported: 2008-06-03 20:04 PDT by Jonathon Jongsma (jonner)
Modified: 2011-04-08 13:36 PDT (History)
3 users (show)

See Also:


Attachments
Possible fix to insert the image into the editable document at the drop location (2.03 KB, patch)
2008-06-03 20:06 PDT, Jonathon Jongsma (jonner)
eric: review-
Details | Formatted Diff | Diff
A simple test case (925 bytes, text/html)
2008-07-28 07:12 PDT, Jonathon Jongsma (jonner)
no flags Details
Patch (1.49 KB, patch)
2011-04-06 08:17 PDT, Benjamin Poulain
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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)

results:
- 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]
Patch
Comment 7 Andreas Kling 2011-04-08 11:23:50 PDT
Comment on attachment 88427 [details]
Patch

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

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.