- Revision
- 237986
- Author
- [email protected]
- Date
- 2018-11-08 07:36:05 -0800 (Thu, 08 Nov 2018)
Log Message
Plain text drag in contenteditable is always DragOperationCopy, never DragOperationMove
https://bugs.webkit.org/show_bug.cgi?id=191228
<rdar://problem/45786830>
Patch by Jonathan Hammer <[email protected]> on 2018-11-08
Reviewed by Wenson Hsieh.
Source/WebCore:
DragController::beginDrag should not call cleanupAfterSystemDrag because
the drag is still in progress even after the call to m_client.beginDrag()
returns. This is in contrast to DragController::doSystemDrag, where the
call to cleanupAfterSystemDrag is appropriate because the drag has
concluded by the time m_client.startDrag() returns.
Test: fast/events/drag-and-drop-move-not-copy.html
* page/DragController.cpp:
(WebCore::DragController::beginDrag):
LayoutTests:
A test that checks that dragging plain text in a contenteditable element results
in the text being moved and not copied. Only applies to WK1. Test skipped on
WK2 because WK2 EventSender does not support drag events. Test also skipped on
AppleWin because drag and drop doesn't work correctly in DRT (according to the
TestExpectations file).
* fast/events/drag-and-drop-move-not-copy-expected.txt: Added.
* fast/events/drag-and-drop-move-not-copy.html: Added.
* platform/win/TestExpectations:
* platform/wk2/TestExpectations:
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (237985 => 237986)
--- trunk/LayoutTests/ChangeLog 2018-11-08 15:20:29 UTC (rev 237985)
+++ trunk/LayoutTests/ChangeLog 2018-11-08 15:36:05 UTC (rev 237986)
@@ -1,3 +1,22 @@
+2018-11-08 Jonathan Hammer <[email protected]>
+
+ Plain text drag in contenteditable is always DragOperationCopy, never DragOperationMove
+ https://bugs.webkit.org/show_bug.cgi?id=191228
+ <rdar://problem/45786830>
+
+ Reviewed by Wenson Hsieh.
+
+ A test that checks that dragging plain text in a contenteditable element results
+ in the text being moved and not copied. Only applies to WK1. Test skipped on
+ WK2 because WK2 EventSender does not support drag events. Test also skipped on
+ AppleWin because drag and drop doesn't work correctly in DRT (according to the
+ TestExpectations file).
+
+ * fast/events/drag-and-drop-move-not-copy-expected.txt: Added.
+ * fast/events/drag-and-drop-move-not-copy.html: Added.
+ * platform/win/TestExpectations:
+ * platform/wk2/TestExpectations:
+
2018-11-08 Alicia Boya García <[email protected]>
[GTK] Unreviewed test gardening
Added: trunk/LayoutTests/fast/events/drag-and-drop-move-not-copy-expected.txt (0 => 237986)
--- trunk/LayoutTests/fast/events/drag-and-drop-move-not-copy-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/drag-and-drop-move-not-copy-expected.txt 2018-11-08 15:36:05 UTC (rev 237986)
@@ -0,0 +1 @@
+DropDrag Me Here
Added: trunk/LayoutTests/fast/events/drag-and-drop-move-not-copy.html (0 => 237986)
--- trunk/LayoutTests/fast/events/drag-and-drop-move-not-copy.html (rev 0)
+++ trunk/LayoutTests/fast/events/drag-and-drop-move-not-copy.html 2018-11-08 15:36:05 UTC (rev 237986)
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style type="text/css">
+#start, #end {
+ display: inline-block;
+}
+</style>
+<script>
+function runTest()
+{
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ }
+
+ var start = document.getElementById('start');
+ var end = document.getElementById('end');
+
+ getSelection().setBaseAndExtent(start, 0, start, 1);
+
+ if (window.eventSender) {
+ eventSender.dragMode = false;
+ eventSender.mouseMoveTo(start.offsetLeft + start.offsetWidth / 2, start.offsetTop + start.offsetHeight / 2);
+ eventSender.mouseDown();
+ eventSender.leapForward(2000);
+ eventSender.mouseMoveTo(end.offsetLeft + end.offsetWidth / 2, end.offsetTop + end.offsetHeight / 2);
+ eventSender.mouseUp();
+ }
+}
+window.addEventListener('load', runTest);
+</script>
+</head>
+<body contenteditable="true">
+ <p id="start">Drag Me</p>
+ <p id="end">Drop Here</p>
+</body>
+</html>
Modified: trunk/LayoutTests/platform/win/TestExpectations (237985 => 237986)
--- trunk/LayoutTests/platform/win/TestExpectations 2018-11-08 15:20:29 UTC (rev 237985)
+++ trunk/LayoutTests/platform/win/TestExpectations 2018-11-08 15:36:05 UTC (rev 237986)
@@ -173,6 +173,7 @@
fast/events/only-valid-drop-targets-receive-file-drop.html [ Skip ]
fast/events/standalone-image-drag-to-editable.html [ Skip ]
fast/events/drag-and-drop-autoscroll-inner-frame.html [ Skip ]
+fast/events/drag-and-drop-move-not-copy.html [ Skip ]
http/tests/security/clipboard/clipboard-file-access.html [ Skip ]
http/tests/security/drag-drop-same-unique-origin.html [ Skip ]
Modified: trunk/LayoutTests/platform/wk2/TestExpectations (237985 => 237986)
--- trunk/LayoutTests/platform/wk2/TestExpectations 2018-11-08 15:20:29 UTC (rev 237985)
+++ trunk/LayoutTests/platform/wk2/TestExpectations 2018-11-08 15:36:05 UTC (rev 237986)
@@ -176,6 +176,7 @@
# eventSender.dragMode is unimplemented in WKTR
# Mac: https://bugs.webkit.org/show_bug.cgi?id=68552
+fast/events/drag-and-drop-move-not-copy.html
fast/events/controlclick-no-onclick.html
fast/events/moving-text-should-fire-drop-and-dragend-events.html
fast/events/moving-text-should-fire-drop-and-dragend-events-2.html
Modified: trunk/Source/WebCore/ChangeLog (237985 => 237986)
--- trunk/Source/WebCore/ChangeLog 2018-11-08 15:20:29 UTC (rev 237985)
+++ trunk/Source/WebCore/ChangeLog 2018-11-08 15:36:05 UTC (rev 237986)
@@ -1,3 +1,22 @@
+2018-11-08 Jonathan Hammer <[email protected]>
+
+ Plain text drag in contenteditable is always DragOperationCopy, never DragOperationMove
+ https://bugs.webkit.org/show_bug.cgi?id=191228
+ <rdar://problem/45786830>
+
+ Reviewed by Wenson Hsieh.
+
+ DragController::beginDrag should not call cleanupAfterSystemDrag because
+ the drag is still in progress even after the call to m_client.beginDrag()
+ returns. This is in contrast to DragController::doSystemDrag, where the
+ call to cleanupAfterSystemDrag is appropriate because the drag has
+ concluded by the time m_client.startDrag() returns.
+
+ Test: fast/events/drag-and-drop-move-not-copy.html
+
+ * page/DragController.cpp:
+ (WebCore::DragController::beginDrag):
+
2018-11-08 Zalan Bujtas <[email protected]>
[BFC][IFC] InlineFormattingContext::Line::alignRuns() should take care of all the alignments.
Modified: trunk/Source/WebCore/page/DragController.cpp (237985 => 237986)
--- trunk/Source/WebCore/page/DragController.cpp 2018-11-08 15:20:29 UTC (rev 237985)
+++ trunk/Source/WebCore/page/DragController.cpp 2018-11-08 15:36:05 UTC (rev 237986)
@@ -1253,13 +1253,6 @@
auto mouseDraggedPointInRootViewCoordinates = viewProtector->rootViewToContents(frame.view()->contentsToRootView(mouseDraggedPoint));
m_client.beginDrag(WTFMove(dragItem), frame, mouseDownPointInRootViewCoordinates, mouseDraggedPointInRootViewCoordinates, dataTransfer, dragSourceAction);
-
- // DragClient::beginDrag can cause the drag controller to be deleted.
- if (!mainFrameProtector->page())
- return;
-
- // FIXME: This shouldn't be needed.
- cleanupAfterSystemDrag();
}
void DragController::doSystemDrag(DragImage image, const IntPoint& dragLoc, const IntPoint& eventPos, Frame& frame, const DragState& state, PromisedAttachmentInfo&& promisedAttachmentInfo)