Title: [201227] trunk
Revision
201227
Author
[email protected]
Date
2016-05-20 15:05:01 -0700 (Fri, 20 May 2016)

Log Message

Drag cannot start if no drag data or custom data is available in the Pasteboard.
https://bugs.webkit.org/show_bug.cgi?id=157911
rdar://problem/24577706

Reviewed by Tim Horton.

Source/WebKit/mac:

We need to make sure there is always one item in common between source and target
of the drag and drop operation.

* WebView/WebHTMLView.mm:
(-[WebHTMLView dragImage:at:offset:event:pasteboard:source:slideBack:]):

Source/WebKit2:

We need to make sure there is always one item in common between source and target
of the drag and drop operation.

* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::dragImageForView):

LayoutTests:

* fast/events/draggable-div-customdata-expected.txt: Added.
* fast/events/draggable-div-customdata.html: Added.
* platform/ios-simulator/TestExpectations
* platform/mac-wk2/TestExpectations

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (201226 => 201227)


--- trunk/LayoutTests/ChangeLog	2016-05-20 21:47:18 UTC (rev 201226)
+++ trunk/LayoutTests/ChangeLog	2016-05-20 22:05:01 UTC (rev 201227)
@@ -1,3 +1,16 @@
+2016-05-20  Enrica Casucci  <[email protected]>
+
+        Drag cannot start if no drag data or custom data is available in the Pasteboard.
+        https://bugs.webkit.org/show_bug.cgi?id=157911
+        rdar://problem/24577706
+
+        Reviewed by Tim Horton.
+
+        * fast/events/draggable-div-customdata-expected.txt: Added.
+        * fast/events/draggable-div-customdata.html: Added.
+        * platform/ios-simulator/TestExpectations
+        * platform/mac-wk2/TestExpectations
+
 2016-05-20  Alex Christensen  <[email protected]>
 
         Fix null dereferencing in CSSAnimationTriggerScrollValue::equals

Added: trunk/LayoutTests/fast/events/draggable-div-customdata-expected.txt (0 => 201227)


--- trunk/LayoutTests/fast/events/draggable-div-customdata-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/draggable-div-customdata-expected.txt	2016-05-20 22:05:01 UTC (rev 201227)
@@ -0,0 +1,9 @@
+This test checks that we drag a draggable element without setting data to transfer
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS TEST PASSED: square dropped
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/events/draggable-div-customdata.html (0 => 201227)


--- trunk/LayoutTests/fast/events/draggable-div-customdata.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/draggable-div-customdata.html	2016-05-20 22:05:01 UTC (rev 201227)
@@ -0,0 +1,89 @@
+<html>
+<head>
+<script src=""
+<style>
+    #dropTarget, #dragMe { text-align: center; display: table-cell; vertical-align: middle }
+    #dropTarget {width: 256px; height: 256px; border: 1px dashed}
+    #dragMe {-webkit-user-drag: element; -webkit-user-select: none; background: #ff0000; width: 64px; height: 64px; color: white}
+</style>
+<script>
+    var dragMe;
+    var dropTarget;
+    var consoleElm;
+    var event;
+
+    window._onload_ = function()
+    {
+        dragMe = document.getElementById("dragMe");
+        dropTarget = document.getElementById("dropTarget");
+        consoleElm = document.getElementById("console");
+
+        if (!dragMe || !dropTarget || !consoleElm)
+            return;
+
+        dragMe._onstart_ = dragStart;
+        dropTarget._ondragover_ = dragOver;
+        dropTarget._ondrop_ = drop;
+
+        runTest();
+    }
+
+    function dragStart(event)
+    {
+        event.dataTransfer.items.add('hello world', 'custom-data');
+    }
+
+    function drop(event)
+    {
+        testPassed("TEST PASSED: square dropped");
+        event.preventDefault();
+        dragMe.parentNode.removeChild(dragMe);
+        event.target.appendChild(dragMe);
+    }
+
+    function dragOver(event)
+    {
+        event.preventDefault();
+    }
+
+    function runTest()
+    {
+        if (!window.eventSender)
+            return;
+
+        if (window.testRunner)
+            testRunner.dumpAsText();
+
+        var startX = dragMe.offsetLeft + 10;
+        var startY = dragMe.offsetTop + dragMe.offsetHeight / 2;
+        var endX = dropTarget.offsetLeft + 10;
+        var endY = dropTarget.offsetTop + dropTarget.offsetHeight / 2;
+
+        eventSender.mouseMoveTo(startX, startY);
+        eventSender.mouseDown();
+        eventSender.leapForward(1000);
+        eventSender.mouseMoveTo(endX, endY);
+        eventSender.mouseUp();
+
+        var testContainer = document.getElementById("test-container");
+        if (testContainer)
+            document.body.removeChild(testContainer);
+        debug('<br /><span class="pass">TEST COMPLETE</span>');
+    }
+</script>
+</head>
+<body>
+    <p id="description"></p>
+    <div id="test-container">
+        <div id="dropTarget">Drop the red square onto me.</div>
+        <hr/>
+        <p>Items that can be dragged to the drop target:</p>
+        <div id="dragMe" draggable="true">Square</div>
+        <hr/>
+    </div>
+    <div id="console"></div>
+    <script>
+        description("This test checks that we drag a draggable element without setting data to transfer");
+    </script>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (201226 => 201227)


--- trunk/LayoutTests/platform/ios-simulator/TestExpectations	2016-05-20 21:47:18 UTC (rev 201226)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations	2016-05-20 22:05:01 UTC (rev 201227)
@@ -204,6 +204,7 @@
 fast/events/drag-selects-image.html
 fast/events/drag-to-navigate.html
 fast/events/draggable-div-nodata.html
+fast/events/draggable-div-customdata.html
 fast/events/drop-handler-should-not-stop-navigate.html
 fast/events/drop-with-file-paths.html
 fast/events/dropzone-001.html

Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (201226 => 201227)


--- trunk/LayoutTests/platform/mac-wk2/TestExpectations	2016-05-20 21:47:18 UTC (rev 201226)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations	2016-05-20 22:05:01 UTC (rev 201227)
@@ -96,6 +96,7 @@
 fast/events/drag-in-frames.html
 fast/events/drag-parent-node.html
 fast/events/draggable-div-nodata.html
+fast/events/draggable-div-customdata.html
 fast/events/dropzone-001.html
 fast/events/dropzone-002.html
 fast/events/dropzone-003.html

Modified: trunk/Source/WebKit/mac/ChangeLog (201226 => 201227)


--- trunk/Source/WebKit/mac/ChangeLog	2016-05-20 21:47:18 UTC (rev 201226)
+++ trunk/Source/WebKit/mac/ChangeLog	2016-05-20 22:05:01 UTC (rev 201227)
@@ -1,3 +1,17 @@
+2016-05-20  Enrica Casucci  <[email protected]>
+
+        Drag cannot start if no drag data or custom data is available in the Pasteboard.
+        https://bugs.webkit.org/show_bug.cgi?id=157911
+        rdar://problem/24577706
+
+        Reviewed by Tim Horton.
+
+        We need to make sure there is always one item in common between source and target
+        of the drag and drop operation.
+
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView dragImage:at:offset:event:pasteboard:source:slideBack:]):
+
 2016-05-19  Enrica Casucci  <[email protected]>
 
         Drag cannot start if no drag data is available in the Pasteboard.

Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (201226 => 201227)


--- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm	2016-05-20 21:47:18 UTC (rev 201226)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLView.mm	2016-05-20 22:05:01 UTC (rev 201227)
@@ -4576,8 +4576,7 @@
         slideBack:(BOOL)slideBack
 {
     ASSERT(self == [self _topHTMLView]);
-    if (![[pasteboard types] count])
-        [pasteboard setString:@"" forType:[WebHTMLView _dummyPasteboardType]];
+    [pasteboard setString:@"" forType:[WebHTMLView _dummyPasteboardType]];
 
     [super dragImage:dragImage at:at offset:offset event:event pasteboard:pasteboard source:source slideBack:slideBack];
 }

Modified: trunk/Source/WebKit2/ChangeLog (201226 => 201227)


--- trunk/Source/WebKit2/ChangeLog	2016-05-20 21:47:18 UTC (rev 201226)
+++ trunk/Source/WebKit2/ChangeLog	2016-05-20 22:05:01 UTC (rev 201227)
@@ -1,3 +1,17 @@
+2016-05-20  Enrica Casucci  <[email protected]>
+
+        Drag cannot start if no drag data or custom data is available in the Pasteboard.
+        https://bugs.webkit.org/show_bug.cgi?id=157911
+        rdar://problem/24577706
+
+        Reviewed by Tim Horton.
+
+        We need to make sure there is always one item in common between source and target
+        of the drag and drop operation.
+
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (WebKit::WebViewImpl::dragImageForView):
+
 2016-05-20  John Wilander  <[email protected]>
 
         Remove unnecessary PageOverlay client function pageOverlayDestroyed

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm (201226 => 201227)


--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm	2016-05-20 21:47:18 UTC (rev 201226)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm	2016-05-20 22:05:01 UTC (rev 201227)
@@ -2935,8 +2935,7 @@
     // The call below could release the view.
     RetainPtr<NSView> protector(m_view);
     NSPasteboard *pasteboard = [NSPasteboard pasteboardWithName:NSDragPboard];
-    if (![[pasteboard types] count])
-        [pasteboard setString:@"" forType:PasteboardTypes::WebDummyPboardType];
+    [pasteboard setString:@"" forType:PasteboardTypes::WebDummyPboardType];
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
     [view dragImage:image
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to