Changeset 89369 in webkit


Ignore:
Timestamp:
Jun 21, 2011 12:18:11 PM (13 years ago)
Author:
yael.aharon@nokia.com
Message:

2011-06-21 Yael Aharon <yael.aharon@nokia.com>

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):
Location:
trunk/Source/WebKit/qt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/qt/Api/qwebpage.cpp

    r88933 r89369  
    270270    if (actions & Qt::LinkAction)
    271271        result |= DragOperationLink;
     272    if (result == (DragOperationCopy | DragOperationMove | DragOperationGeneric | DragOperationLink))
     273        result = DragOperationEvery;
    272274    return (DragOperation)result;
    273275}
     
    316318    , inspector(0)
    317319    , inspectorIsInternalOnly(false)
     320    , m_lastDropAction(Qt::IgnoreAction)
    318321{
    319322    WebCore::InitializeLoggingChannelsIfNecessary();
     
    10161019    DragData dragData(ev->mimeData(), QPointF(ev->pos()).toPoint(),
    10171020            QCursor::pos(), dropActionToDragOp(ev->possibleActions()));
    1018     Qt::DropAction action = dragOpToDropAction(page->dragController()->dragUpdated(&dragData));
    1019     ev->setDropAction(action);
    1020     if (action != Qt::IgnoreAction)
    1021         ev->acceptProposedAction();
     1021    m_lastDropAction = dragOpToDropAction(page->dragController()->dragUpdated(&dragData));
     1022    ev->setDropAction(m_lastDropAction);
     1023    if (m_lastDropAction != Qt::IgnoreAction)
     1024        ev->accept();
    10221025#endif
    10231026}
     
    10291032    DragData dragData(ev->mimeData(), QPointF(ev->pos()).toPoint(),
    10301033            QCursor::pos(), dropActionToDragOp(ev->possibleActions()));
    1031     if (page->dragController()->performDrag(&dragData))
    1032         ev->acceptProposedAction();
     1034    if (page->dragController()->performDrag(&dragData)) {
     1035        ev->setDropAction(m_lastDropAction);
     1036        ev->accept();
     1037    }
    10331038#endif
    10341039}
  • trunk/Source/WebKit/qt/ChangeLog

    r89252 r89369  
     12011-06-21  Yael Aharon  <yael.aharon@nokia.com>
     2
     3        Reviewed by Andreas Kling.
     4
     5        [Qt] Regression(60942) wrong default action for drag-and-drop.
     6        https://bugs.webkit.org/show_bug.cgi?id=63004
     7
     8        Added special handling for the case that dragOperation is not initialized.
     9        Save the last dropOperation and pass it to the dropEvent, so that it can
     10        be accepted by QDrag.
     11        Call event->accepted() and not event->acceptProposedAction(), because the
     12        later ignores the dropAction specified in JavaScript.
     13
     14        Tested with the test page attached to https://bugs.webkit.org/show_bug.cgi?id=40401
     15        and did not see any issue.
     16        Also manually tested all combinations of LayoutTests/fast/events/drag-and-drop.html
     17        and they all pass.
     18
     19        * Api/qwebpage.cpp:
     20        (dropActionToDragOp):
     21        (QWebPagePrivate::dragMoveEvent):
     22        (QWebPagePrivate::dropEvent):
     23
    1242011-06-20  Pavel Feldman  <pfeldman@chromium.org>
    225
Note: See TracChangeset for help on using the changeset viewer.