Changeset 52815 in webkit


Ignore:
Timestamp:
Jan 5, 2010 11:36:23 AM (14 years ago)
Author:
eric@webkit.org
Message:

2010-01-05 Yael Aharon <yael.aharon@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@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.
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r52813 r52815  
     12010-01-05  Yael Aharon  <yael.aharon@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] Drag & drop layout tests fail even when run manually
     6        https://bugs.webkit.org/show_bug.cgi?id=33055
     7
     8        No new tests. Fix 3 layout tests when run manually.
     9        fast/events/drag-and-drop.html
     10        fast/events/drag-and-drop-dataTransfer-types-nocrash.html
     11        fast/events/drag-and-drop-fire-drag-dragover.html
     12        Running these tests in DRT will be fixed in 31332.
     13
     14        * page/qt/DragControllerQt.cpp:
     15        (WebCore::DragController::cleanupAfterSystemDrag):
     16        Cleanup the drag operation if it failed to complete,
     17        Otherwise, new drag operations will not be possible.
     18
    1192010-01-05  Gustavo Noronha Silva <gns@gnome.org>
    220
  • trunk/WebCore/page/qt/DragControllerQt.cpp

    r45747 r52815  
    6767void DragController::cleanupAfterSystemDrag()
    6868{
     69    dragEnded();
    6970}
    7071
  • trunk/WebKit/qt/Api/qwebpage.cpp

    r52662 r52815  
    345345    if (actions & Qt::CopyAction)
    346346        result |= DragOperationCopy;
     347    // DragOperationgeneric represents InternetExplorer's equivalent of Move operation,
     348    // hence it should be considered as "move"
    347349    if (actions & Qt::MoveAction)
    348         result |= DragOperationMove;
     350        result |= (DragOperationMove | DragOperationGeneric);
    349351    if (actions & Qt::LinkAction)
    350352        result |= DragOperationLink;
     
    358360        result = Qt::CopyAction;
    359361    else if (actions & DragOperationMove)
     362        result = Qt::MoveAction;
     363    // DragOperationgeneric represents InternetExplorer's equivalent of Move operation,
     364    // hence it should be considered as "move"
     365    else if (actions & DragOperationGeneric)
    360366        result = Qt::MoveAction;
    361367    else if (actions & DragOperationLink)
     
    10951101    Qt::DropAction action = dragOpToDropAction(page->dragController()->dragEntered(&dragData));
    10961102    ev->setDropAction(action);
    1097     if (action != Qt::IgnoreAction)
    1098         ev->accept();
     1103    // We must accept this event in order to receive the drag move events that are sent
     1104    // while the drag and drop action is in progress.
     1105    ev->accept();
    10991106#endif
    11001107}
     
    11361143                      dropActionToDragOp(ev->possibleActions()));
    11371144    Qt::DropAction action = dragOpToDropAction(page->dragController()->dragUpdated(&dragData));
     1145    m_lastDropAction = action;
    11381146    ev->setDropAction(action);
    1139     if (action != Qt::IgnoreAction)
    1140         ev->accept();
     1147    // We must accept this event in order to receive the drag move events that are sent
     1148    // while the drag and drop action is in progress.
     1149    ev->accept();
    11411150#endif
    11421151}
     
    11471156    DragData dragData(ev->mimeData(), ev->pos().toPoint(),
    11481157            QCursor::pos(), dropActionToDragOp(ev->possibleActions()));
    1149     Qt::DropAction action = dragOpToDropAction(page->dragController()->performDrag(&dragData));
    1150     if (action != Qt::IgnoreAction)
     1158    if (page->dragController()->performDrag(&dragData))
    11511159        ev->accept();
    11521160#endif
     
    11561164{
    11571165#ifndef QT_NO_DRAGANDDROP
     1166    // Overwrite the defaults set by QDragManager::defaultAction()
     1167    ev->setDropAction(m_lastDropAction);
    11581168    DragData dragData(ev->mimeData(), ev->pos(), QCursor::pos(),
    1159                       dropActionToDragOp(ev->possibleActions()));
    1160     Qt::DropAction action = dragOpToDropAction(page->dragController()->performDrag(&dragData));
    1161     if (action != Qt::IgnoreAction)
     1169                      dropActionToDragOp(Qt::DropAction(ev->dropAction())));
     1170    if (page->dragController()->performDrag(&dragData))
    11621171        ev->accept();
    11631172#endif
  • trunk/WebKit/qt/Api/qwebpage_p.h

    r51991 r52815  
    181181    QWebInspector* inspector;
    182182    bool inspectorIsInternalOnly; // True if created through the Inspect context menu action
     183    Qt::DropAction m_lastDropAction;
    183184
    184185    static bool drtRun;
  • trunk/WebKit/qt/ChangeLog

    r52713 r52815  
     12010-01-05  Yael Aharon  <yael.aharon@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        Drag & drop layout tests fail even when run manually
     6        https://bugs.webkit.org/show_bug.cgi?id=33055
     7
     8        No new tests. Fix 3 layout tests when run manually.
     9        fast/events/drag-and-drop.html
     10        fast/events/drag-and-drop-dataTransfer-types-nocrash.html
     11        fast/events/drag-and-drop-fire-drag-dragover.html
     12        Running these tests in DRT will be fixed in 31332.
     13
     14        * Api/qwebpage.cpp:
     15        (dropActionToDragOp):
     16        (dragOpToDropAction):
     17        (QWebPagePrivate::dragEnterEvent):
     18        (QWebPagePrivate::dragMoveEvent):
     19        (QWebPagePrivate::dropEvent):
     20        Accept drag events even if they are not over a drop target.
     21        This is to ensure that drag events will continue to be delivered.
     22
     23        * Api/qwebpage_p.h:
     24        * WebCoreSupport/DragClientQt.cpp:
     25        (WebCore::dragOperationToDropActions):
     26        (WebCore::dropActionToDragOperation):
     27        (WebCore::DragClientQt::startDrag):
     28        Send dragEnd event.
     29
    1302010-01-04  Daniel Bates  <dbates@webkit.org>
    231
  • trunk/WebKit/qt/WebCoreSupport/DragClientQt.cpp

    r49200 r52815  
    2828
    2929#include "ClipboardQt.h"
     30#include "Frame.h"
     31#include "PlatformMouseEvent.h"
    3032#include "qwebpage.h"
    3133
     
    3537
    3638namespace WebCore {
     39
     40static inline Qt::DropActions dragOperationsToDropActions(unsigned op)
     41{
     42    Qt::DropActions result = Qt::IgnoreAction;
     43    if (op & DragOperationCopy)
     44        result = Qt::CopyAction;
     45    if (op & DragOperationMove)
     46        result |= Qt::MoveAction;
     47    if (op & DragOperationGeneric)
     48        result |= Qt::MoveAction;
     49    if (op & DragOperationLink)
     50        result |= Qt::LinkAction;
     51    return result;
     52}
     53
     54static inline DragOperation dropActionToDragOperation(Qt::DropActions action)
     55{
     56    DragOperation result = DragOperationNone;
     57    if (action & Qt::CopyAction)
     58        result = DragOperationCopy;
     59    if (action & Qt::LinkAction)
     60        result = DragOperationLink;
     61    if (action & Qt::MoveAction)
     62        result = DragOperationMove;
     63    return result;
     64}
    3765
    3866DragDestinationAction DragClientQt::actionMaskForDrag(DragData*)
     
    5987}
    6088
    61 void DragClientQt::startDrag(DragImageRef, const IntPoint&, const IntPoint&, Clipboard* clipboard, Frame*, bool)
     89void DragClientQt::startDrag(DragImageRef, const IntPoint&, const IntPoint&, Clipboard* clipboard, Frame* frame, bool)
    6290{
    6391#ifndef QT_NO_DRAGANDDROP
     
    6795    if (view) {
    6896        QDrag *drag = new QDrag(view);
    69         if (clipboardData->hasImage())
     97        if (clipboardData && clipboardData->hasImage())
    7098            drag->setPixmap(qvariant_cast<QPixmap>(clipboardData->imageData()));
     99        DragOperation dragOperationMask = DragOperationEvery;
     100        clipboard->sourceOperation(dragOperationMask);
    71101        drag->setMimeData(clipboardData);
    72         drag->start();
     102        Qt::DropAction actualDropAction = drag->exec(dragOperationsToDropActions(dragOperationMask));
     103
     104        // Send dragEnd event
     105        PlatformMouseEvent me(m_webPage->view()->mapFromGlobal(QCursor::pos()), QCursor::pos(), LeftButton, MouseEventMoved, 0, false, false, false, false, 0);
     106        frame->eventHandler()->dragSourceEndedAt(me, dropActionToDragOperation(actualDropAction));
    73107    }
    74108#endif
Note: See TracChangeset for help on using the changeset viewer.