WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
58206
[Qt] HTML5 drag and drop not working when getData is used
https://bugs.webkit.org/show_bug.cgi?id=58206
Summary
[Qt] HTML5 drag and drop not working when getData is used
Aparna Nandyal
Reported
2011-04-10 10:46:52 PDT
Steps to reproduce the problem: 1. Open QtTestBrowser or any other simple app that with QWebView 2. Load
http://ljouanneau.com/lab/html5/demodragdrop.html
. This page has HTML5 drag and drop. 3. Perform the operations in the page as illustrated - that is drag boxes. Expected result: Dragging and dropping of boxes is possible as illustrated in the page Actual result: Unable to drag the content Other information:
https://bugs.webkit.org/show_bug.cgi?id=56486
has been raised for a similar issue but the problem with other websites mentioned in 56486 is different from this bug, hence raising another bug for this as discussed.
Attachments
Patch for review
(1.38 KB, patch)
2011-04-10 11:11 PDT
,
Aparna Nandyal
kling
: review-
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Aparna Nandyal
Comment 1
2011-04-10 10:59:50 PDT
Analysis: It is found that the value returned by getData in the following script in wrong: function dragOver(ev) { var idelt = ev.dataTransfer.getData("Text"); var id = ev.target.getAttribute('id'); if( (id =='boxB' || id =='boxA') && (idelt == 'drag' || idelt=='drag2')) return false; else if( id =='boxC' && idelt == 'drag3') return false; else return true; } idelt is always undefined. On the other hand if the same web page (
http://ljouanneau.com/lab/html5/demodragdrop.html
) is downloaded and saved as html and opened through the QtTestBrowser, it works fine. Problem in the code: String ClipboardQt::getData(const String& type, bool& success) const { if (policy() != ClipboardReadable) { success = false; return String(); } .... } The policy value is set as ClipboardTypesReadable in this case hence empty string is returned. The policy value is set in DragController::tryDHTMLDrag. If the URL is local, then clipboardReadable is set (which is why it works when the same html page is saved locally and then loaded in QtTestBrowser) else clipboardTypesReadable is set. Additional information: To get this fix working, patch in
https://bugs.webkit.org/show_bug.cgi?id=56486
is a required (which is to get generic HTML5 drag and drop to work)
Aparna Nandyal
Comment 2
2011-04-10 11:11:34 PDT
Created
attachment 88954
[details]
Patch for review getData JavaScript API is an important integral part of HTML5 D&D usage which is always returning an undefined value in this case. Fix rectifies this problem. Existing test cases cover D&D. DRT does not support D&D yet. Also this case is reproducible for pages online only.
Eric Seidel (no email)
Comment 3
2011-04-10 15:40:34 PDT
Comment on
attachment 88954
[details]
Patch for review How do we test this?
Benjamin Poulain
Comment 4
2011-04-11 04:57:45 PDT
(In reply to
comment #3
)
> (From update of
attachment 88954
[details]
) > How do we test this?
That is quite a problem. I looked at testing drag-and-drop last week and we have big issue because of the way Qt handle drag and drop. Currently, we do not run the layout tests. :(
Eric Seidel (no email)
Comment 5
2011-04-11 06:17:34 PDT
In general things which aren't tested are broken. So I think it is probably more worth your time to fix the drag and drop testing on Qt... then at least you'll know what's broken there in comparison to other ports. :)
Andreas Kling
Comment 6
2011-04-26 17:17:45 PDT
Comment on
attachment 88954
[details]
Patch for review Just tested this on Safari and Chromium, and the test doesn't work on either of them. We should not be adding different behavior for QtWebKit.
Aparna Nandyal
Comment 7
2011-05-01 23:19:52 PDT
This is broken on all the ports because, we dont allow getData to be called when drag start or drag over is happening. This is for security reason, that getData can be accessed only during drop event and not before that. This so, because when you are dragging data across documents on your desktop, you do not want getData to be called by intermittent document which is not suppose to have access to data. The real solution to this problem would be to check if the dragging is happening within the same document (if within same domain), then getData can be accessed in drag enter and drag over event too. This is the implementation in other browsers like firefox.
Rhema
Comment 8
2011-10-22 17:15:14 PDT
This is a huge problem for me (see
http://stackoverflow.com/questions/7830249/how-do-you-get-the-selected-items-from-a-dragstart-event-in-chrome-is-datatrans
) this solution makes perfect sense. For example, a dragstart should have the data being dragged available if the event is registered on that document. E.G. Add this to the Chrome Javascript dev console... window.addEventListener("dragstart", function(event) { alert(event.dataTransfer.getData("Text")); }); Returns alerts 'undefined' when selected text is dragged. :( (In reply to
comment #7
)
> This is broken on all the ports because, we dont allow getData to be called when drag start or drag over is happening. This is for security reason, that getData can be accessed only during drop event and not before that. This so, because when you are dragging data across documents on your desktop, you do not want getData to be called by intermittent document which is not suppose to have access to data. The real solution to this problem would be to check if the dragging is happening within the same document (if within same domain), then getData can be accessed in drag enter and drag over event too. This is the implementation in other browsers like firefox.
Jocelyn Turcotte
Comment 9
2014-02-03 03:17:30 PST
=== Bulk closing of Qt bugs === If you believe that this bug report is still relevant for a non-Qt port of webkit.org, please re-open it and remove [Qt] from the summary. If you believe that this is still an important QtWebKit bug, please fill a new report at
https://bugreports.qt-project.org
and add a link to this issue. See
http://qt-project.org/wiki/ReportingBugsInQt
for additional guidelines.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug