Title: [212881] trunk
Revision
212881
Author
[email protected]
Date
2017-02-23 03:24:17 -0800 (Thu, 23 Feb 2017)

Log Message

[GTK] Drag and drop is always moving the content even if copy is requested
https://bugs.webkit.org/show_bug.cgi?id=168424

Reviewed by Carlos Garcia Campos.

Source/WebCore:

Drag and drop is always moving the content around even if the copy is
requested (i.e. by pressing the Control key).

Test: editing/pasteboard/drag-drop-copy-content.html

* page/gtk/DragControllerGtk.cpp:
(WebCore::DragController::isCopyKeyDown):

Source/WebKit2:

Drag and drop is always moving the content around even if the copy is
requested (i.e. by pressing the Control key).

* UIProcess/gtk/DragAndDropHandler.cpp:
(WebKit::DragAndDropHandler::drop):

LayoutTests:

Mark the editing/pasteboard/drag-drop-copy-content.html as failing
as WTR doesn't know how to perform drag and drop in WK2. Also the
test does not pass on the mac WK1, created a bug for it.

* platform/efl/TestExpectations:
* platform/gtk-wayland/TestExpectations:
* platform/gtk/TestExpectations:
* platform/mac-wk2/TestExpectations:
* platform/mac/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (212880 => 212881)


--- trunk/LayoutTests/ChangeLog	2017-02-23 07:24:22 UTC (rev 212880)
+++ trunk/LayoutTests/ChangeLog	2017-02-23 11:24:17 UTC (rev 212881)
@@ -1,3 +1,20 @@
+2017-02-23  Tomas Popela  <[email protected]>
+
+        [GTK] Drag and drop is always moving the content even if copy is requested
+        https://bugs.webkit.org/show_bug.cgi?id=168424
+
+        Reviewed by Carlos Garcia Campos.
+
+        Mark the editing/pasteboard/drag-drop-copy-content.html as failing
+        as WTR doesn't know how to perform drag and drop in WK2. Also the
+        test does not pass on the mac WK1, created a bug for it.
+
+        * platform/efl/TestExpectations:
+        * platform/gtk-wayland/TestExpectations:
+        * platform/gtk/TestExpectations:
+        * platform/mac-wk2/TestExpectations:
+        * platform/mac/TestExpectations:
+
 2017-02-22  Antoine Quint  <[email protected]>
 
         [Modern Media Controls] Clicking on the video doesn't toggle playback state in fullscreen on macOS

Added: trunk/LayoutTests/editing/pasteboard/drag-drop-copy-content-expected.txt (0 => 212881)


--- trunk/LayoutTests/editing/pasteboard/drag-drop-copy-content-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/drag-drop-copy-content-expected.txt	2017-02-23 11:24:17 UTC (rev 212881)
@@ -0,0 +1,5 @@
+This tests the generic drag and drop where the copy of the content is requested (pressing Control on WebKitGTK+ or Alt on Mac when dropping the content) instead of the move. To manually run the test, select the "Text" in the textarea and drag it to the input on the left. When dropping the content request the copy operation. The test is passed if the input will contain "Text" and the textarea "Text!" strings.
+
+PASS: input
+PASS: textarea
+ 

Added: trunk/LayoutTests/editing/pasteboard/drag-drop-copy-content.html (0 => 212881)


--- trunk/LayoutTests/editing/pasteboard/drag-drop-copy-content.html	                        (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/drag-drop-copy-content.html	2017-02-23 11:24:17 UTC (rev 212881)
@@ -0,0 +1,53 @@
+<html>
+<head>
+  <script src=""
+</head>
+<body>
+<script>
+function log(msg) {
+  var console = document.getElementById('console');
+  var line = document.createElement('div');
+  line.textContent = msg;
+  console.appendChild(line);
+}
+
+function runTest() {
+    if (!window.testRunner)
+        return;
+
+    testRunner.dumpAsText();
+
+    // Drag a word in the textarea
+    var textarea = document.getElementById("textarea");
+    textarea.setSelectionRange(0, 4);
+    x = textarea.offsetLeft + 10;
+    y = textarea.offsetTop + textarea.offsetHeight / 2;
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseDown();
+    // and drop it off to the input field
+    var input = document.getElementById("destination");
+    eventSender.leapForward(500);
+    eventSender.mouseMoveTo(input.offsetLeft + 10, input.offsetTop + input.offsetHeight / 2);
+    if (isGtk())
+      eventSender.mouseUp(0, ['ctrlKey']);
+    else
+      eventSender.mouseUp(0, ['altKey']);
+
+    var result = input.value;
+    log(result == 'Text' ? 'PASS: input' : 'FAIL: expected value="Text", actual value="' + result + '"');
+    var result = textarea.value;
+    log(result == 'Text!' ? 'PASS: textarea' : 'FAIL: expected value="Text!", actual value="' + result + '"');
+}
+</script>
+<p>This tests the generic drag and drop where the copy of the content is
+requested (pressing Control on WebKitGTK+ or Alt on Mac when dropping the
+content) instead of the move. To manually run the test, select the "Text"
+in the textarea and drag it to the input on the left. When dropping the
+content request the copy operation. The test is passed if the input will
+contain "Text" and the textarea "Text!" strings.</p>
+<div id=console></div>
+<input id=destination>
+<textarea id=textarea rows=1>Text!</textarea>
+<script>runTest();</script>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (212880 => 212881)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2017-02-23 07:24:22 UTC (rev 212880)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2017-02-23 11:24:17 UTC (rev 212881)
@@ -1866,6 +1866,7 @@
 webkit.org/b/157179 editing/pasteboard/drag-and-drop-image-contenteditable.html [ Failure Timeout ]
 webkit.org/b/157179 editing/pasteboard/drag-and-drop-inputimage-contenteditable.html [ Failure Timeout ]
 webkit.org/b/157179 editing/pasteboard/drag-and-drop-objectimage-contenteditable.html [ Failure Timeout ]
+webkit.org/b/157179 editing/pasteboard/drag-drop-copy-content.html [ Failure ]
 webkit.org/b/157179 editing/pasteboard/drag-drop-input-textarea.html [ Failure ]
 webkit.org/b/157179 editing/pasteboard/drag-drop-modifies-page.html [ Failure ]
 webkit.org/b/157179 editing/pasteboard/drag-drop-url-text.html [ Failure ]

Modified: trunk/LayoutTests/platform/gtk-wayland/TestExpectations (212880 => 212881)


--- trunk/LayoutTests/platform/gtk-wayland/TestExpectations	2017-02-23 07:24:22 UTC (rev 212880)
+++ trunk/LayoutTests/platform/gtk-wayland/TestExpectations	2017-02-23 11:24:17 UTC (rev 212881)
@@ -72,6 +72,7 @@
 webkit.org/b/157179 editing/pasteboard/drag-and-drop-image-contenteditable.html [ Crash ]
 webkit.org/b/157179 editing/pasteboard/drag-and-drop-inputimage-contenteditable.html [ Crash ]
 webkit.org/b/157179 editing/pasteboard/drag-and-drop-objectimage-contenteditable.html [ Crash ]
+webkit.org/b/157179 editing/pasteboard/drag-drop-copy-content.html [ Crash ]
 webkit.org/b/157179 editing/pasteboard/drag-drop-input-textarea.html [ Crash ]
 webkit.org/b/157179 editing/pasteboard/drag-drop-modifies-page.html [ Crash ]
 webkit.org/b/157179 editing/pasteboard/drag-drop-url-text.html [ Crash ]

Modified: trunk/LayoutTests/platform/mac/TestExpectations (212880 => 212881)


--- trunk/LayoutTests/platform/mac/TestExpectations	2017-02-23 07:24:22 UTC (rev 212880)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2017-02-23 11:24:17 UTC (rev 212881)
@@ -1534,3 +1534,5 @@
 webkit.org/b/168415 [ ElCapitan ] imported/w3c/web-platform-tests/resource-timing/rt-cors.worker.html [ Skip ]
 
 webkit.org/b/212466 [ ElCapitan ] js/dom/gc-slot-visitor-parallel-drain-pings-runloop-when-done.html [ Skip ]
+
+webkit.org/b/168503 editing/pasteboard/drag-drop-copy-content.html [ Failure ]

Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (212880 => 212881)


--- trunk/LayoutTests/platform/mac-wk2/TestExpectations	2017-02-23 07:24:22 UTC (rev 212880)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations	2017-02-23 11:24:17 UTC (rev 212881)
@@ -53,6 +53,7 @@
 editing/pasteboard/drag-and-drop-inputimage-contenteditable.html
 editing/pasteboard/drag-and-drop-objectimage-contenteditable.html
 editing/pasteboard/drag-and-drop-attachment-contenteditable.html
+editing/pasteboard/drag-drop-copy-content.html
 editing/pasteboard/drag-drop-dead-frame.html
 editing/pasteboard/drag-drop-input-textarea.html
 editing/pasteboard/drag-drop-list.html

Modified: trunk/Source/WebCore/ChangeLog (212880 => 212881)


--- trunk/Source/WebCore/ChangeLog	2017-02-23 07:24:22 UTC (rev 212880)
+++ trunk/Source/WebCore/ChangeLog	2017-02-23 11:24:17 UTC (rev 212881)
@@ -1,3 +1,18 @@
+2017-02-23  Tomas Popela  <[email protected]>
+
+        [GTK] Drag and drop is always moving the content even if copy is requested
+        https://bugs.webkit.org/show_bug.cgi?id=168424
+
+        Reviewed by Carlos Garcia Campos.
+
+        Drag and drop is always moving the content around even if the copy is
+        requested (i.e. by pressing the Control key).
+
+        Test: editing/pasteboard/drag-drop-copy-content.html
+
+        * page/gtk/DragControllerGtk.cpp:
+        (WebCore::DragController::isCopyKeyDown):
+
 2017-02-22  Myles C. Maxfield  <[email protected]>
 
         [Cocoa] Remove Yosemite-specific font lookup code

Modified: trunk/Source/WebCore/page/gtk/DragControllerGtk.cpp (212880 => 212881)


--- trunk/Source/WebCore/page/gtk/DragControllerGtk.cpp	2017-02-23 07:24:22 UTC (rev 212880)
+++ trunk/Source/WebCore/page/gtk/DragControllerGtk.cpp	2017-02-23 11:24:17 UTC (rev 212881)
@@ -46,9 +46,9 @@
 
 const float DragController::DragImageAlpha = 0.75f;
 
-bool DragController::isCopyKeyDown(const DragData&)
+bool DragController::isCopyKeyDown(const DragData& dragData)
 {
-    return false;
+    return dragData.flags() & DragApplicationIsCopyKeyDown;
 }
 
 DragOperation DragController::dragOperation(const DragData& dragData)

Modified: trunk/Source/WebKit2/ChangeLog (212880 => 212881)


--- trunk/Source/WebKit2/ChangeLog	2017-02-23 07:24:22 UTC (rev 212880)
+++ trunk/Source/WebKit2/ChangeLog	2017-02-23 11:24:17 UTC (rev 212881)
@@ -1,3 +1,16 @@
+2017-02-23  Tomas Popela  <[email protected]>
+
+        [GTK] Drag and drop is always moving the content even if copy is requested
+        https://bugs.webkit.org/show_bug.cgi?id=168424
+
+        Reviewed by Carlos Garcia Campos.
+
+        Drag and drop is always moving the content around even if the copy is
+        requested (i.e. by pressing the Control key).
+
+        * UIProcess/gtk/DragAndDropHandler.cpp:
+        (WebKit::DragAndDropHandler::drop):
+
 2017-02-22  Carlos Garcia Campos  <[email protected]>
 
         Better handle Thread and RunLoop initialization

Modified: trunk/Source/WebKit2/UIProcess/gtk/DragAndDropHandler.cpp (212880 => 212881)


--- trunk/Source/WebKit2/UIProcess/gtk/DragAndDropHandler.cpp	2017-02-23 07:24:22 UTC (rev 212880)
+++ trunk/Source/WebKit2/UIProcess/gtk/DragAndDropHandler.cpp	2017-02-23 11:24:17 UTC (rev 212881)
@@ -289,7 +289,10 @@
 
     droppingContext->dropHappened = true;
 
-    DragData dragData(droppingContext->selectionData.ptr(), position, convertWidgetPointToScreenPoint(m_page.viewWidget(), position), gdkDragActionToDragOperation(gdk_drag_context_get_actions(context)));
+    uint32_t flags = 0;
+    if ((gdk_drag_context_get_selected_action(context) & GDK_ACTION_COPY))
+        flags |= WebCore::DragApplicationIsCopyKeyDown;
+    DragData dragData(droppingContext->selectionData.ptr(), position, convertWidgetPointToScreenPoint(m_page.viewWidget(), position), gdkDragActionToDragOperation(gdk_drag_context_get_actions(context)), static_cast<WebCore::DragApplicationFlags>(flags));
     SandboxExtension::Handle handle;
     SandboxExtension::HandleArray sandboxExtensionForUpload;
     m_page.performDragOperation(dragData, String(), handle, sandboxExtensionForUpload);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to