[Webkit-unassigned] [Bug 191228] New: Plain text drag in contenteditable is always DragOperationCopy, never DragOperationMove

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Nov 3 14:50:21 PDT 2018


https://bugs.webkit.org/show_bug.cgi?id=191228

            Bug ID: 191228
           Summary: Plain text drag in contenteditable is always
                    DragOperationCopy, never DragOperationMove
           Product: WebKit
           Version: WebKit Local Build
          Hardware: Macintosh
                OS: macOS 10.14
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: HTML Editing
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: jonathan at e3software.com
                CC: wenson_hsieh at apple.com

Created attachment 353783

  --> https://bugs.webkit.org/attachment.cgi?id=353783&action=review

Xcode project to reproduce issue

Dragging plain text inside a contenteditable element always results in the text being copied (instead of the text being moved as intended). This only happens with legacy WebView. Please see attached Xcode project to reproduce the issue.

I believe the cause of the problem is as follows:

1. DragController::startDrag calls `beginDrag`
2. `beginDrag` calls `cleanupAfterSystemDrag` after beginning the drag (this seems strange)
3. `cleanupAfterSystemDrag` calls `dragEnded`
4. `dragEnded` sets m_dragInitiator = nullptr
5. As the mouse is moved and the drag is updated, `dragEnteredOrUpdated` is called, which calls into `tryDocumentDrag`
6. `tryDocumentDrag` calls into `dragIsMove`
7. `dragIsMove` always return false because m_documentUnderMouse != m_dragInitiator (because m_dragInitiator was set to nullptr after the drag was started)

I think the root problem is in step #2. `beginDrag` should not call `cleanupAfterSystemDrag`. Interestingly, that line of code is marked with the following comment:

    // FIXME: This shouldn't be needed.

Removing that call to `cleanupAfterSystemDrag` fixes the issue for me.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20181103/a99e90ff/attachment.html>


More information about the webkit-unassigned mailing list