[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Thu Apr 8 00:54:49 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 48e2647bd92963e8a7a5a3ae4af7520f57275402
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jan 5 19:36:23 2010 +0000

    2010-01-05  Yael Aharon  <yael.aharon at nokia.com>
    
            Reviewed by Kenneth Rohde Christiansen.
    
            [Qt] Drag & drop layout tests fail even when run manually
            https://bugs.webkit.org/show_bug.cgi?id=33055
    
            No new tests. Fix 3 layout tests when run manually.
            fast/events/drag-and-drop.html
            fast/events/drag-and-drop-dataTransfer-types-nocrash.html
            fast/events/drag-and-drop-fire-drag-dragover.html
            Running these tests in DRT will be fixed in 31332.
    
            * page/qt/DragControllerQt.cpp:
            (WebCore::DragController::cleanupAfterSystemDrag):
            Cleanup the drag operation if it failed to complete,
            Otherwise, new drag operations will not be possible.
    2010-01-05  Yael Aharon  <yael.aharon at nokia.com>
    
            Reviewed by Kenneth Rohde Christiansen.
    
            Drag & drop layout tests fail even when run manually
            https://bugs.webkit.org/show_bug.cgi?id=33055
    
            No new tests. Fix 3 layout tests when run manually.
            fast/events/drag-and-drop.html
            fast/events/drag-and-drop-dataTransfer-types-nocrash.html
            fast/events/drag-and-drop-fire-drag-dragover.html
            Running these tests in DRT will be fixed in 31332.
    
            * Api/qwebpage.cpp:
            (dropActionToDragOp):
            (dragOpToDropAction):
            (QWebPagePrivate::dragEnterEvent):
            (QWebPagePrivate::dragMoveEvent):
            (QWebPagePrivate::dropEvent):
            Accept drag events even if they are not over a drop target.
            This is to ensure that drag events will continue to be delivered.
    
            * Api/qwebpage_p.h:
            * WebCoreSupport/DragClientQt.cpp:
            (WebCore::dragOperationToDropActions):
            (WebCore::dropActionToDragOperation):
            (WebCore::DragClientQt::startDrag):
            Send dragEnd event.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52815 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index b45cb15..f64621c 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2010-01-05  Yael Aharon  <yael.aharon at nokia.com>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        [Qt] Drag & drop layout tests fail even when run manually
+        https://bugs.webkit.org/show_bug.cgi?id=33055
+
+        No new tests. Fix 3 layout tests when run manually.
+        fast/events/drag-and-drop.html
+        fast/events/drag-and-drop-dataTransfer-types-nocrash.html
+        fast/events/drag-and-drop-fire-drag-dragover.html
+        Running these tests in DRT will be fixed in 31332.
+
+        * page/qt/DragControllerQt.cpp:
+        (WebCore::DragController::cleanupAfterSystemDrag):
+        Cleanup the drag operation if it failed to complete,
+        Otherwise, new drag operations will not be possible.
+
 2010-01-05  Gustavo Noronha Silva <gns at gnome.org>
 
         Reviewed by Xan Lopez.
diff --git a/WebCore/page/qt/DragControllerQt.cpp b/WebCore/page/qt/DragControllerQt.cpp
index e6c7682..33815b5 100644
--- a/WebCore/page/qt/DragControllerQt.cpp
+++ b/WebCore/page/qt/DragControllerQt.cpp
@@ -66,6 +66,7 @@ const IntSize& DragController::maxDragImageSize()
 
 void DragController::cleanupAfterSystemDrag()
 {
+    dragEnded();
 }
 
 }
diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp
index 7ed7555..f110bce 100644
--- a/WebKit/qt/Api/qwebpage.cpp
+++ b/WebKit/qt/Api/qwebpage.cpp
@@ -344,8 +344,10 @@ static inline DragOperation dropActionToDragOp(Qt::DropActions actions)
     unsigned result = 0;
     if (actions & Qt::CopyAction)
         result |= DragOperationCopy;
+    // DragOperationgeneric represents InternetExplorer's equivalent of Move operation,
+    // hence it should be considered as "move"
     if (actions & Qt::MoveAction)
-        result |= DragOperationMove;
+        result |= (DragOperationMove | DragOperationGeneric);
     if (actions & Qt::LinkAction)
         result |= DragOperationLink;
     return (DragOperation)result;
@@ -358,6 +360,10 @@ static inline Qt::DropAction dragOpToDropAction(unsigned actions)
         result = Qt::CopyAction;
     else if (actions & DragOperationMove)
         result = Qt::MoveAction;
+    // DragOperationgeneric represents InternetExplorer's equivalent of Move operation,
+    // hence it should be considered as "move"
+    else if (actions & DragOperationGeneric)
+        result = Qt::MoveAction;
     else if (actions & DragOperationLink)
         result = Qt::LinkAction;
     return result;
@@ -1094,8 +1100,9 @@ void QWebPagePrivate::dragEnterEvent(QDragEnterEvent* ev)
                       dropActionToDragOp(ev->possibleActions()));
     Qt::DropAction action = dragOpToDropAction(page->dragController()->dragEntered(&dragData));
     ev->setDropAction(action);
-    if (action != Qt::IgnoreAction)
-        ev->accept();
+    // We must accept this event in order to receive the drag move events that are sent
+    // while the drag and drop action is in progress.
+    ev->accept();
 #endif
 }
 
@@ -1135,9 +1142,11 @@ void QWebPagePrivate::dragMoveEvent(QDragMoveEvent* ev)
     DragData dragData(ev->mimeData(), ev->pos(), QCursor::pos(),
                       dropActionToDragOp(ev->possibleActions()));
     Qt::DropAction action = dragOpToDropAction(page->dragController()->dragUpdated(&dragData));
+    m_lastDropAction = action;
     ev->setDropAction(action);
-    if (action != Qt::IgnoreAction)
-        ev->accept();
+    // We must accept this event in order to receive the drag move events that are sent
+    // while the drag and drop action is in progress.
+    ev->accept();
 #endif
 }
 
@@ -1146,8 +1155,7 @@ void QWebPagePrivate::dropEvent(QGraphicsSceneDragDropEvent* ev)
 #ifndef QT_NO_DRAGANDDROP
     DragData dragData(ev->mimeData(), ev->pos().toPoint(),
             QCursor::pos(), dropActionToDragOp(ev->possibleActions()));
-    Qt::DropAction action = dragOpToDropAction(page->dragController()->performDrag(&dragData));
-    if (action != Qt::IgnoreAction)
+    if (page->dragController()->performDrag(&dragData))
         ev->accept();
 #endif
 }
@@ -1155,10 +1163,11 @@ void QWebPagePrivate::dropEvent(QGraphicsSceneDragDropEvent* ev)
 void QWebPagePrivate::dropEvent(QDropEvent* ev)
 {
 #ifndef QT_NO_DRAGANDDROP
+    // Overwrite the defaults set by QDragManager::defaultAction()
+    ev->setDropAction(m_lastDropAction);
     DragData dragData(ev->mimeData(), ev->pos(), QCursor::pos(),
-                      dropActionToDragOp(ev->possibleActions()));
-    Qt::DropAction action = dragOpToDropAction(page->dragController()->performDrag(&dragData));
-    if (action != Qt::IgnoreAction)
+                      dropActionToDragOp(Qt::DropAction(ev->dropAction())));
+    if (page->dragController()->performDrag(&dragData))
         ev->accept();
 #endif
 }
diff --git a/WebKit/qt/Api/qwebpage_p.h b/WebKit/qt/Api/qwebpage_p.h
index ffbdd51..dbc981e 100644
--- a/WebKit/qt/Api/qwebpage_p.h
+++ b/WebKit/qt/Api/qwebpage_p.h
@@ -180,6 +180,7 @@ public:
     QWidget* inspectorFrontend;
     QWebInspector* inspector;
     bool inspectorIsInternalOnly; // True if created through the Inspect context menu action
+    Qt::DropAction m_lastDropAction;
 
     static bool drtRun;
 };
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index a6853b7..d49e5ae 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,32 @@
+2010-01-05  Yael Aharon  <yael.aharon at nokia.com>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Drag & drop layout tests fail even when run manually
+        https://bugs.webkit.org/show_bug.cgi?id=33055
+
+        No new tests. Fix 3 layout tests when run manually.
+        fast/events/drag-and-drop.html
+        fast/events/drag-and-drop-dataTransfer-types-nocrash.html
+        fast/events/drag-and-drop-fire-drag-dragover.html
+        Running these tests in DRT will be fixed in 31332.
+
+        * Api/qwebpage.cpp:
+        (dropActionToDragOp):
+        (dragOpToDropAction):
+        (QWebPagePrivate::dragEnterEvent):
+        (QWebPagePrivate::dragMoveEvent):
+        (QWebPagePrivate::dropEvent):
+        Accept drag events even if they are not over a drop target. 
+        This is to ensure that drag events will continue to be delivered.
+
+        * Api/qwebpage_p.h:
+        * WebCoreSupport/DragClientQt.cpp:
+        (WebCore::dragOperationToDropActions):
+        (WebCore::dropActionToDragOperation):
+        (WebCore::DragClientQt::startDrag):
+        Send dragEnd event.
+
 2010-01-04  Daniel Bates  <dbates at webkit.org>
 
         Reviewed by Eric Seidel.
diff --git a/WebKit/qt/WebCoreSupport/DragClientQt.cpp b/WebKit/qt/WebCoreSupport/DragClientQt.cpp
index 99e438d..a50bc5e 100644
--- a/WebKit/qt/WebCoreSupport/DragClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/DragClientQt.cpp
@@ -27,6 +27,8 @@
 #include "DragClientQt.h"
 
 #include "ClipboardQt.h"
+#include "Frame.h"
+#include "PlatformMouseEvent.h"
 #include "qwebpage.h"
 
 #include <QDrag>
@@ -35,6 +37,32 @@
 
 namespace WebCore {
 
+static inline Qt::DropActions dragOperationsToDropActions(unsigned op)
+{
+    Qt::DropActions result = Qt::IgnoreAction;
+    if (op & DragOperationCopy)
+        result = Qt::CopyAction;
+    if (op & DragOperationMove)
+        result |= Qt::MoveAction;
+    if (op & DragOperationGeneric)
+        result |= Qt::MoveAction;
+    if (op & DragOperationLink)
+        result |= Qt::LinkAction;
+    return result;
+}
+
+static inline DragOperation dropActionToDragOperation(Qt::DropActions action)
+{
+    DragOperation result = DragOperationNone;
+    if (action & Qt::CopyAction)
+        result = DragOperationCopy;
+    if (action & Qt::LinkAction)
+        result = DragOperationLink;
+    if (action & Qt::MoveAction)
+        result = DragOperationMove;
+    return result;
+}
+
 DragDestinationAction DragClientQt::actionMaskForDrag(DragData*)
 {
     return DragDestinationActionAny;
@@ -58,7 +86,7 @@ void DragClientQt::willPerformDragSourceAction(DragSourceAction, const IntPoint&
 {
 }
 
-void DragClientQt::startDrag(DragImageRef, const IntPoint&, const IntPoint&, Clipboard* clipboard, Frame*, bool)
+void DragClientQt::startDrag(DragImageRef, const IntPoint&, const IntPoint&, Clipboard* clipboard, Frame* frame, bool)
 {
 #ifndef QT_NO_DRAGANDDROP
     QMimeData* clipboardData = static_cast<ClipboardQt*>(clipboard)->clipboardData();
@@ -66,10 +94,16 @@ void DragClientQt::startDrag(DragImageRef, const IntPoint&, const IntPoint&, Cli
     QWidget* view = m_webPage->view();
     if (view) {
         QDrag *drag = new QDrag(view);
-        if (clipboardData->hasImage())
+        if (clipboardData && clipboardData->hasImage())
             drag->setPixmap(qvariant_cast<QPixmap>(clipboardData->imageData()));
+        DragOperation dragOperationMask = DragOperationEvery;
+        clipboard->sourceOperation(dragOperationMask);
         drag->setMimeData(clipboardData);
-        drag->start();
+        Qt::DropAction actualDropAction = drag->exec(dragOperationsToDropActions(dragOperationMask));
+
+        // Send dragEnd event
+        PlatformMouseEvent me(m_webPage->view()->mapFromGlobal(QCursor::pos()), QCursor::pos(), LeftButton, MouseEventMoved, 0, false, false, false, false, 0);
+        frame->eventHandler()->dragSourceEndedAt(me, dropActionToDragOperation(actualDropAction));
     }
 #endif
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list