Title: [89369] trunk/Source/WebKit/qt
Revision
89369
Author
[email protected]
Date
2011-06-21 12:18:11 -0700 (Tue, 21 Jun 2011)

Log Message

2011-06-21  Yael Aharon  <[email protected]>

        Reviewed by Andreas Kling.

        [Qt] Regression(60942) wrong default action for drag-and-drop.
        https://bugs.webkit.org/show_bug.cgi?id=63004

        Added special handling for the case that dragOperation is not initialized.
        Save the last dropOperation and pass it to the dropEvent, so that it can
        be accepted by QDrag.
        Call event->accepted() and not event->acceptProposedAction(), because the
        later ignores the dropAction specified in _javascript_.

        Tested with the test page attached to https://bugs.webkit.org/show_bug.cgi?id=40401
        and did not see any issue.
        Also manually tested all combinations of LayoutTests/fast/events/drag-and-drop.html
        and they all pass.

        * Api/qwebpage.cpp:
        (dropActionToDragOp):
        (QWebPagePrivate::dragMoveEvent):
        (QWebPagePrivate::dropEvent):

Modified Paths

Diff

Modified: trunk/Source/WebKit/qt/Api/qwebpage.cpp (89368 => 89369)


--- trunk/Source/WebKit/qt/Api/qwebpage.cpp	2011-06-21 18:16:35 UTC (rev 89368)
+++ trunk/Source/WebKit/qt/Api/qwebpage.cpp	2011-06-21 19:18:11 UTC (rev 89369)
@@ -269,6 +269,8 @@
         result |= (DragOperationMove | DragOperationGeneric);
     if (actions & Qt::LinkAction)
         result |= DragOperationLink;
+    if (result == (DragOperationCopy | DragOperationMove | DragOperationGeneric | DragOperationLink))
+        result = DragOperationEvery;
     return (DragOperation)result;
 }
 
@@ -315,6 +317,7 @@
     , inspectorFrontend(0)
     , inspector(0)
     , inspectorIsInternalOnly(false)
+    , m_lastDropAction(Qt::IgnoreAction)
 {
     WebCore::InitializeLoggingChannelsIfNecessary();
     ScriptController::initializeThreading();
@@ -1015,10 +1018,10 @@
 #ifndef QT_NO_DRAGANDDROP
     DragData dragData(ev->mimeData(), QPointF(ev->pos()).toPoint(),
             QCursor::pos(), dropActionToDragOp(ev->possibleActions()));
-    Qt::DropAction action = ""
-    ev->setDropAction(action);
-    if (action != Qt::IgnoreAction)
-        ev->acceptProposedAction();
+    m_lastDropAction = dragOpToDropAction(page->dragController()->dragUpdated(&dragData));
+    ev->setDropAction(m_lastDropAction);
+    if (m_lastDropAction != Qt::IgnoreAction)
+        ev->accept();
 #endif
 }
 
@@ -1028,8 +1031,10 @@
 #ifndef QT_NO_DRAGANDDROP
     DragData dragData(ev->mimeData(), QPointF(ev->pos()).toPoint(),
             QCursor::pos(), dropActionToDragOp(ev->possibleActions()));
-    if (page->dragController()->performDrag(&dragData))
-        ev->acceptProposedAction();
+    if (page->dragController()->performDrag(&dragData)) {
+        ev->setDropAction(m_lastDropAction);
+        ev->accept();
+    }
 #endif
 }
 

Modified: trunk/Source/WebKit/qt/ChangeLog (89368 => 89369)


--- trunk/Source/WebKit/qt/ChangeLog	2011-06-21 18:16:35 UTC (rev 89368)
+++ trunk/Source/WebKit/qt/ChangeLog	2011-06-21 19:18:11 UTC (rev 89369)
@@ -1,3 +1,26 @@
+2011-06-21  Yael Aharon  <[email protected]>
+
+        Reviewed by Andreas Kling.
+
+        [Qt] Regression(60942) wrong default action for drag-and-drop.
+        https://bugs.webkit.org/show_bug.cgi?id=63004
+
+        Added special handling for the case that dragOperation is not initialized.
+        Save the last dropOperation and pass it to the dropEvent, so that it can 
+        be accepted by QDrag.
+        Call event->accepted() and not event->acceptProposedAction(), because the
+        later ignores the dropAction specified in _javascript_.
+
+        Tested with the test page attached to https://bugs.webkit.org/show_bug.cgi?id=40401
+        and did not see any issue.
+        Also manually tested all combinations of LayoutTests/fast/events/drag-and-drop.html
+        and they all pass.
+
+        * Api/qwebpage.cpp:
+        (dropActionToDragOp):
+        (QWebPagePrivate::dragMoveEvent):
+        (QWebPagePrivate::dropEvent):
+
 2011-06-20  Pavel Feldman  <[email protected]>
 
         Reviewed by Yury Semikhatsky.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to