Bug 56486 - [Qt] HTML5 Drag and Drop demos not working
Summary: [Qt] HTML5 Drag and Drop demos not working
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Benjamin Poulain
URL:
Keywords: Qt, QtTriaged
: 52601 (view as bug list)
Depends on:
Blocks: 58206
  Show dependency treegraph
 
Reported: 2011-03-16 13:43 PDT by Aparna Nandyal
Modified: 2011-04-11 07:53 PDT (History)
2 users (show)

See Also:


Attachments
Patch (1.50 KB, patch)
2011-04-05 07:04 PDT, Benjamin Poulain
kling: review+
kling: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Aparna Nandyal 2011-03-16 13:43:21 PDT
Steps to reproduce the problem:

1. Open QtTestBrowser or a sample QWebView program which does (QWebView view; view.show(); view.load(QUrl("any urls given below"));
2. Load any of the URLs - http://html5demos.com/drag, http://html5demos.com/drag-anything, http://shapeshed.com/examples/drag-and-drop/, http://html5tutorial.net/examples/html5-drag-and-drop.html or other popular demos for html5 D&D.
3. Follow the instructions given in the url. All the URLs allow dragging of some content and dropping it off in designated area.

Expected results:
Drag and drop works fine as stated in the URL

Actual result:
Drop is not working as mentioned in the url. Unable to drop the content.
Comment 1 Benjamin Poulain 2011-04-05 07:04:33 PDT
Created attachment 88223 [details]
Patch
Comment 2 Benjamin Poulain 2011-04-05 07:05:29 PDT
Covered by existing tests but the DRT does not yet have support for Drag and Drop unfortunatelly.
Comment 3 Benjamin Poulain 2011-04-05 07:13:26 PDT
*** Bug 52601 has been marked as a duplicate of this bug. ***
Comment 4 Aparna Nandyal 2011-04-05 09:58:43 PDT
This fix does not solve the problem with all D&D urls mentioned below. http://html5tutorial.net/examples/html5-drag-and-drop.html example still fails with this fix. 

I have been working to fix the issue with that.

Analysis:
1. For html5 D&D, preventDefault is used to allow dropping in dragOver.

  addEvent(bin, 'dragover', function (e) {
    if (e.preventDefault) e.preventDefault(); // allows us to drop
    this.className = 'over';
    e.dataTransfer.dropEffect = 'copy';
    alert('Hahaha');
    return false;
  });


2. In some implementations it returns false instead of calling preventDefault (IE expects return false) to allow dropping.

  addEvent(bin, 'dragover', function (e) {
    this.className = 'over';
    e.dataTransfer.dropEffect = 'copy';
    alert('Hahaha');
    return false; //allows us to drop
  });


3. If preventDefault is called on the event, then m_defaultPrevented is set to true and droppping succeeds in webkit.
4. So we need to set, m_defaultPrevented even when false is returned (as in step 2) to let dropping succeed. 
5. setReturnValue of Event.h needs to be called.

Working on a fix for this.
Comment 5 Aparna Nandyal 2011-04-05 10:07:55 PDT
Missed mentioning - Patch given by Benjamin is required, in addition to it we need to make changes mentioned in comment#4.
Comment 6 Andreas Kling 2011-04-08 11:26:30 PDT
Comment on attachment 88223 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=88223&action=review

r=me

> Source/WebKit/qt/ChangeLog:12
> +        what action should take place. To adtop this behavior for Qt, we always accept drag enter events

Typo, s/adtop/adopt/
Comment 7 Benjamin Poulain 2011-04-11 07:53:04 PDT
Committed r83442: <http://trac.webkit.org/changeset/83442>