Title: [289544] trunk
Revision
289544
Author
akeer...@apple.com
Date
2022-02-10 09:37:37 -0800 (Thu, 10 Feb 2022)

Log Message

An element with both -webkit-user-select: all and -webkit-user-drag: element does not get the nice drag snapshot that you get if you just have -webkit-user-drag: element
https://bugs.webkit.org/show_bug.cgi?id=187656
<rdar://problem/42177956>

Reviewed by Wenson Hsieh.

Source/WebCore:

When dragging an element with "-webkit-user-select: all" and
"-webkit-user-drag: element", the element gets selected, leading
WebKit to add `DragSourceAction::Selection` to the set of
`DragSourceAction`s. The presence of "-webkit-user-drag: element"
results in the addition of `DragSourceAction::DHTML`.

The addition of `DragSourceAction::Selection` in the
"-webkit-user-drag: element" scenario is undesirable, as
it results in a drag snapshot containing only the selection, and
copies/pastes the text selection, rather than moving the element.

To fix, drop `DragSourceAction::Selection` from the set of actions
when a "-webkit-user-drag: element" element is being dragged.

The new behavior matches Firefox and Chrome.

* page/DragController.cpp:
(WebCore::DragController::draggableElement const):
(WebCore::DragController::startDrag):
(WebCore::DragController::doSystemDrag):
* platform/DragItem.h:

Dropping `DragSourceAction::Selection` exposes an issue in the
UIProcess on iOS, where UIKit text interaction can unexpectedly
begin while dragging an element with "-webkit-user-drag: element".

To fix the WebProcess behavior, while keeping the UIProcess behavior
the same, a new bit is added to `DragItem` to indicate that the
element being dragged contains the selection. The UIProcess will use
this bit to suppress UIKit text interaction.

(WebCore::DragItem::encode const):
(WebCore::DragItem::decode):

Source/WebKit:

Plumb `DragItem`'s `containsSelection` into the `DragDropInteractionState`
so that UIKit text interaction can be suppressed whenever the element
being dragged also contains the current selection.

* UIProcess/ios/DragDropInteractionState.h:
* UIProcess/ios/DragDropInteractionState.mm:
(WebKit::DragDropInteractionState::anyActiveDragSourceContainsSelection const):
(WebKit::DragDropInteractionState::stageDragItem):
(WebKit::DragDropInteractionState::anyActiveDragSourceIs const): Deleted.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):

Tools:

Added API tests on iOS and macOS to verify that dragging and dropping an
element with "-webkit-user-select: all" and "-webkit-user-drag: element"
does not paste the selection.

On iOS, the size of the lift preview is also tested.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/contenteditable-user-select-user-drag.html: Added.
* TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/mac/DragAndDropTestsMac.mm:
(TEST):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (289543 => 289544)


--- trunk/Source/WebCore/ChangeLog	2022-02-10 17:35:32 UTC (rev 289543)
+++ trunk/Source/WebCore/ChangeLog	2022-02-10 17:37:37 UTC (rev 289544)
@@ -1,3 +1,45 @@
+2022-02-10  Aditya Keerthi  <akeer...@apple.com>
+
+        An element with both -webkit-user-select: all and -webkit-user-drag: element does not get the nice drag snapshot that you get if you just have -webkit-user-drag: element
+        https://bugs.webkit.org/show_bug.cgi?id=187656
+        <rdar://problem/42177956>
+
+        Reviewed by Wenson Hsieh.
+
+        When dragging an element with "-webkit-user-select: all" and
+        "-webkit-user-drag: element", the element gets selected, leading
+        WebKit to add `DragSourceAction::Selection` to the set of
+        `DragSourceAction`s. The presence of "-webkit-user-drag: element"
+        results in the addition of `DragSourceAction::DHTML`.
+
+        The addition of `DragSourceAction::Selection` in the
+        "-webkit-user-drag: element" scenario is undesirable, as
+        it results in a drag snapshot containing only the selection, and
+        copies/pastes the text selection, rather than moving the element.
+
+        To fix, drop `DragSourceAction::Selection` from the set of actions
+        when a "-webkit-user-drag: element" element is being dragged.
+
+        The new behavior matches Firefox and Chrome.
+
+        * page/DragController.cpp:
+        (WebCore::DragController::draggableElement const):
+        (WebCore::DragController::startDrag):
+        (WebCore::DragController::doSystemDrag):
+        * platform/DragItem.h:
+
+        Dropping `DragSourceAction::Selection` exposes an issue in the
+        UIProcess on iOS, where UIKit text interaction can unexpectedly
+        begin while dragging an element with "-webkit-user-drag: element".
+
+        To fix the WebProcess behavior, while keeping the UIProcess behavior
+        the same, a new bit is added to `DragItem` to indicate that the
+        element being dragged contains the selection. The UIProcess will use
+        this bit to suppress UIKit text interaction.
+
+        (WebCore::DragItem::encode const):
+        (WebCore::DragItem::decode):
+
 2022-02-10  Alan Bujtas  <za...@apple.com>
 
         [LFC][IFC] Prepare InlineDisplayContentBuilder::adjustVisualGeometryForDisplayBox for supporting vertical writing mode

Modified: trunk/Source/WebCore/page/DragController.cpp (289543 => 289544)


--- trunk/Source/WebCore/page/DragController.cpp	2022-02-10 17:35:32 UTC (rev 289543)
+++ trunk/Source/WebCore/page/DragController.cpp	2022-02-10 17:37:37 UTC (rev 289544)
@@ -804,7 +804,7 @@
 
         UserDrag dragMode = renderer->style().userDrag();
         if (m_dragSourceAction.contains(DragSourceAction::DHTML) && dragMode == UserDrag::Element) {
-            state.type.add(DragSourceAction::DHTML);
+            state.type = DragSourceAction::DHTML;
             return element;
         }
         if (dragMode == UserDrag::Auto) {
@@ -1092,6 +1092,7 @@
         dragItem.imageAnchorPoint = dragImageAnchorPointForSelectionDrag(src, mouseDraggedPoint);
         dragItem.image = WTFMove(dragImage);
         dragItem.data = ""
+        dragItem.containsSelection = true;
 
         beginDrag(WTFMove(dragItem), src, dragOrigin, mouseDraggedPoint, dataTransfer, DragSourceAction::Selection);
 
@@ -1188,6 +1189,7 @@
         dragItem.imageAnchorPoint = dragImage ? anchorPointForLinkDragImage(dragImage.get()) : FloatPoint();
         dragItem.image = WTFMove(dragImage);
         dragItem.data = ""
+        dragItem.containsSelection = true;
 
         beginDrag(WTFMove(dragItem), src, dragOrigin, mouseDraggedPoint, dataTransfer, DragSourceAction::Selection);
 
@@ -1374,6 +1376,7 @@
     ASSERT(state.type.hasExactlyOneBitSet());
     item.sourceAction = state.type.toSingleValue();
     item.promisedAttachmentInfo = WTFMove(promisedAttachmentInfo);
+    item.containsSelection = frame.selection().contains(eventPos);
 
     auto eventPositionInRootViewCoordinates = frame.view()->contentsToRootView(eventPos);
     auto dragLocationInRootViewCoordinates = frame.view()->contentsToRootView(dragLoc);

Modified: trunk/Source/WebCore/platform/DragItem.h (289543 => 289544)


--- trunk/Source/WebCore/platform/DragItem.h	2022-02-10 17:35:32 UTC (rev 289543)
+++ trunk/Source/WebCore/platform/DragItem.h	2022-02-10 17:37:37 UTC (rev 289544)
@@ -48,6 +48,7 @@
     String title;
     URL url;
     IntRect dragPreviewFrameInRootViewCoordinates;
+    bool containsSelection { false };
 
     PasteboardWriterData data;
     PromisedAttachmentInfo promisedAttachmentInfo;
@@ -62,7 +63,7 @@
     // FIXME(173815): We should encode and decode PasteboardWriterData and platform drag image data
     // here too, as part of moving off of the legacy dragging codepath.
     encoder << sourceAction;
-    encoder << imageAnchorPoint << eventPositionInContentCoordinates << dragLocationInContentCoordinates << dragLocationInWindowCoordinates << title << url << dragPreviewFrameInRootViewCoordinates;
+    encoder << imageAnchorPoint << eventPositionInContentCoordinates << dragLocationInContentCoordinates << dragLocationInWindowCoordinates << title << url << dragPreviewFrameInRootViewCoordinates << containsSelection;
     bool hasIndicatorData = image.hasIndicatorData();
     encoder << hasIndicatorData;
     if (hasIndicatorData)
@@ -93,6 +94,8 @@
         return false;
     if (!decoder.decode(result.dragPreviewFrameInRootViewCoordinates))
         return false;
+    if (!decoder.decode(result.containsSelection))
+        return false;
     bool hasIndicatorData;
     if (!decoder.decode(hasIndicatorData))
         return false;

Modified: trunk/Source/WebKit/ChangeLog (289543 => 289544)


--- trunk/Source/WebKit/ChangeLog	2022-02-10 17:35:32 UTC (rev 289543)
+++ trunk/Source/WebKit/ChangeLog	2022-02-10 17:37:37 UTC (rev 289544)
@@ -1,3 +1,23 @@
+2022-02-10  Aditya Keerthi  <akeer...@apple.com>
+
+        An element with both -webkit-user-select: all and -webkit-user-drag: element does not get the nice drag snapshot that you get if you just have -webkit-user-drag: element
+        https://bugs.webkit.org/show_bug.cgi?id=187656
+        <rdar://problem/42177956>
+
+        Reviewed by Wenson Hsieh.
+
+        Plumb `DragItem`'s `containsSelection` into the `DragDropInteractionState`
+        so that UIKit text interaction can be suppressed whenever the element
+        being dragged also contains the current selection.
+
+        * UIProcess/ios/DragDropInteractionState.h:
+        * UIProcess/ios/DragDropInteractionState.mm:
+        (WebKit::DragDropInteractionState::anyActiveDragSourceContainsSelection const):
+        (WebKit::DragDropInteractionState::stageDragItem):
+        (WebKit::DragDropInteractionState::anyActiveDragSourceIs const): Deleted.
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):
+
 2022-02-10  Megan Gardner  <megan_gard...@apple.com>
 
         Mail attachment switched to TIFF and balloons in size after markup.

Modified: trunk/Source/WebKit/UIProcess/ios/DragDropInteractionState.h (289543 => 289544)


--- trunk/Source/WebKit/UIProcess/ios/DragDropInteractionState.h	2022-02-10 17:35:32 UTC (rev 289543)
+++ trunk/Source/WebKit/UIProcess/ios/DragDropInteractionState.h	2022-02-10 17:37:37 UTC (rev 289544)
@@ -55,6 +55,7 @@
     String linkTitle;
     URL linkURL;
     bool possiblyNeedsDragPreviewUpdate { true };
+    bool containsSelection { false };
 
     NSInteger itemIdentifier { 0 };
 };
@@ -71,7 +72,7 @@
 
 class DragDropInteractionState {
 public:
-    bool anyActiveDragSourceIs(WebCore::DragSourceAction) const;
+    bool anyActiveDragSourceContainsSelection() const;
 
     // These helper methods are unique to UIDragInteraction.
     void prepareForDragSession(id <UIDragSession>, dispatch_block_t completionHandler);

Modified: trunk/Source/WebKit/UIProcess/ios/DragDropInteractionState.mm (289543 => 289544)


--- trunk/Source/WebKit/UIProcess/ios/DragDropInteractionState.mm	2022-02-10 17:35:32 UTC (rev 289543)
+++ trunk/Source/WebKit/UIProcess/ios/DragDropInteractionState.mm	2022-02-10 17:37:37 UTC (rev 289544)
@@ -170,12 +170,13 @@
     return std::nullopt;
 }
 
-bool DragDropInteractionState::anyActiveDragSourceIs(WebCore::DragSourceAction action) const
+bool DragDropInteractionState::anyActiveDragSourceContainsSelection() const
 {
     for (auto& source : m_activeDragSources) {
-        if (source.action.contains(action))
+        if (source.containsSelection)
             return true;
     }
+
     return false;
 }
 
@@ -357,6 +358,7 @@
         item.title.isEmpty() ? nil : (NSString *)item.title,
         item.url.isEmpty() ? nil : (NSURL *)item.url,
         true, // We assume here that drag previews need to be updated until proven otherwise in updatePreviewsForActiveDragSources().
+        item.containsSelection,
         ++currentDragSourceItemIdentifier
     }};
 }

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (289543 => 289544)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2022-02-10 17:35:32 UTC (rev 289543)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2022-02-10 17:37:37 UTC (rev 289544)
@@ -9159,7 +9159,7 @@
 - (void)dragInteraction:(UIDragInteraction *)interaction willAnimateLiftWithAnimator:(id <UIDragAnimating>)animator session:(id <UIDragSession>)session
 {
     RELEASE_LOG(DragAndDrop, "Drag session willAnimateLiftWithAnimator: %p", session);
-    if (_dragDropInteractionState.anyActiveDragSourceIs(WebCore::DragSourceAction::Selection)) {
+    if (_dragDropInteractionState.anyActiveDragSourceContainsSelection()) {
         [self cancelActiveTextInteractionGestures];
         if (!_shouldRestoreCalloutBarAfterDrop) {
             // FIXME: This SPI should be renamed in UIKit to reflect a more general purpose of hiding interaction assistant controls.

Modified: trunk/Tools/ChangeLog (289543 => 289544)


--- trunk/Tools/ChangeLog	2022-02-10 17:35:32 UTC (rev 289543)
+++ trunk/Tools/ChangeLog	2022-02-10 17:37:37 UTC (rev 289544)
@@ -1,3 +1,24 @@
+2022-02-10  Aditya Keerthi  <akeer...@apple.com>
+
+        An element with both -webkit-user-select: all and -webkit-user-drag: element does not get the nice drag snapshot that you get if you just have -webkit-user-drag: element
+        https://bugs.webkit.org/show_bug.cgi?id=187656
+        <rdar://problem/42177956>
+
+        Reviewed by Wenson Hsieh.
+
+        Added API tests on iOS and macOS to verify that dragging and dropping an
+        element with "-webkit-user-select: all" and "-webkit-user-drag: element"
+        does not paste the selection.
+
+        On iOS, the size of the lift preview is also tested.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKitCocoa/contenteditable-user-select-user-drag.html: Added.
+        * TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/mac/DragAndDropTestsMac.mm:
+        (TEST):
+
 2022-02-10  Jonathan Bedard  <jbed...@apple.com>
 
         Unreviewed, reverting 247040@main.

Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (289543 => 289544)


--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2022-02-10 17:35:32 UTC (rev 289543)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2022-02-10 17:37:37 UTC (rev 289544)
@@ -1000,6 +1000,7 @@
 		E3FCFB7F274B70D5000E6B69 /* SentinelLinkedList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3FCFB7E274B70D5000E6B69 /* SentinelLinkedList.cpp */; };
 		E5036F78211BC25400BFDBE2 /* color-drop.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = E5036F77211BC22800BFDBE2 /* color-drop.html */; };
 		E520A36B25AFB76C00526CB9 /* WKWebViewTitlebarSeparatorTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = E520A36A25AFB76C00526CB9 /* WKWebViewTitlebarSeparatorTests.mm */; };
+		E540058827B3A8B20005653A /* contenteditable-user-select-user-drag.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = E540058727B3A8320005653A /* contenteditable-user-select-user-drag.html */; };
 		E589183C252BC90A0041DED5 /* DateTimeInputsAccessoryViewTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = E589183B252BC90A0041DED5 /* DateTimeInputsAccessoryViewTests.mm */; };
 		E5AA42F2259128AE00410A3D /* UserInterfaceIdiomUpdate.mm in Sources */ = {isa = PBXBuildFile; fileRef = E5AA42F1259128AE00410A3D /* UserInterfaceIdiomUpdate.mm */; };
 		E5AA8D1D25151CC60051CC45 /* DateInputTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = E5AA8D1C25151CC60051CC45 /* DateInputTests.mm */; };
@@ -1285,6 +1286,7 @@
 				F469FB241F01804B00401539 /* contenteditable-and-target.html in Copy Resources */,
 				F41AB9A11EF4696B0083FA08 /* contenteditable-and-textarea.html in Copy Resources */,
 				F4A32ECB1F0643370047C544 /* contenteditable-in-iframe.html in Copy Resources */,
+				E540058827B3A8B20005653A /* contenteditable-user-select-user-drag.html in Copy Resources */,
 				A16F66BA1C40EB4F00BD4D24 /* ContentFiltering.html in Copy Resources */,
 				A13D1AD624AD468F003F92A8 /* context-menu-control-click.html in Copy Resources */,
 				5142B2731517C8C800C32B19 /* ContextMenuCanCopyURL.html in Copy Resources */,
@@ -2969,6 +2971,7 @@
 		E4C9ABC71B3DB1710040A987 /* RunLoop.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RunLoop.cpp; sourceTree = "<group>"; };
 		E5036F77211BC22800BFDBE2 /* color-drop.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "color-drop.html"; sourceTree = "<group>"; };
 		E520A36A25AFB76C00526CB9 /* WKWebViewTitlebarSeparatorTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewTitlebarSeparatorTests.mm; sourceTree = "<group>"; };
+		E540058727B3A8320005653A /* contenteditable-user-select-user-drag.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "contenteditable-user-select-user-drag.html"; sourceTree = "<group>"; };
 		E589183B252BC90A0041DED5 /* DateTimeInputsAccessoryViewTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = DateTimeInputsAccessoryViewTests.mm; sourceTree = "<group>"; };
 		E5AA42F1259128AE00410A3D /* UserInterfaceIdiomUpdate.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = UserInterfaceIdiomUpdate.mm; sourceTree = "<group>"; };
 		E5AA8D1C25151CC60051CC45 /* DateInputTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = DateInputTests.mm; sourceTree = "<group>"; };
@@ -4069,6 +4072,7 @@
 				F469FB231F01803500401539 /* contenteditable-and-target.html */,
 				F41AB99C1EF4692C0083FA08 /* contenteditable-and-textarea.html */,
 				F4A32ECA1F0642F40047C544 /* contenteditable-in-iframe.html */,
+				E540058727B3A8320005653A /* contenteditable-user-select-user-drag.html */,
 				A16F66B91C40EA2000BD4D24 /* ContentFiltering.html */,
 				5C2936941D5BFD1900DEAB1E /* CookieMessage.html */,
 				9B1056421F9047CC00D5583F /* copy-html.html */,

Added: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/contenteditable-user-select-user-drag.html (0 => 289544)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/contenteditable-user-select-user-drag.html	                        (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/contenteditable-user-select-user-drag.html	2022-02-10 17:37:37 UTC (rev 289544)
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+<meta name="viewport" content="width=device-width">
+<head>
+<style>
+    body, html {
+        width: 100%;
+        height: 100%;
+    }
+
+    body {
+        margin: 0;
+    }
+
+    #editor {
+        width: 200px;
+        height: 200px;
+        outline: 1px solid black;
+    }
+
+    #draggable {
+        background-color: red;
+        width: 200px;
+        height: 200px;
+        -webkit-user-select: all;
+        -webkit-user-drag: element;
+        display: inline-block;
+    }
+</style>
+</head>
+
+<div id="draggable" draggable="true">This text should not be draggable without a red background.</div>
+<div id="editor" contenteditable=""></div>
+
+<div><code>To manually test, attempt to drag the colored block.</code></div>
+
+<script>
+draggable.addEventListener("dragstart", event => {
+    event.dataTransfer.setData("text/plain", "Text");
+});
+</script>
+</html>
+

Modified: trunk/Tools/TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm (289543 => 289544)


--- trunk/Tools/TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm	2022-02-10 17:35:32 UTC (rev 289543)
+++ trunk/Tools/TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm	2022-02-10 17:37:37 UTC (rev 289544)
@@ -2153,6 +2153,23 @@
     EXPECT_FALSE(isCompletelyWhite([(UIImageView *)finalPreview.view image]));
 }
 
+TEST(DragAndDropTests, DropUserSelectAllUserDragElementDiv)
+{
+    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
+    [webView synchronouslyLoadTestPageNamed:@"contenteditable-user-select-user-drag"];
+
+    auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebView:webView.get()]);
+    [simulator runFrom:CGPointMake(100, 100) to:CGPointMake(100, 300)];
+
+    NSArray *liftPreviews = [simulator liftPreviews];
+    EXPECT_EQ(1U, liftPreviews.count);
+    EXPECT_EQ(UITargetedDragPreview.class, [liftPreviews.firstObject class]);
+
+    checkCGRectIsEqualToCGRectWithLogging({ { 0, 0 }, { 200, 200 } }, [simulator liftPreviews][0].view.frame);
+
+    EXPECT_WK_STREQ(@"Text", [webView stringByEvaluatingJavaScript:@"document.getElementById(\"editor\").textContent"]);
+}
+
 TEST(DragAndDropTests, SuggestedNameContainsDot)
 {
     auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);

Modified: trunk/Tools/TestWebKitAPI/Tests/mac/DragAndDropTestsMac.mm (289543 => 289544)


--- trunk/Tools/TestWebKitAPI/Tests/mac/DragAndDropTestsMac.mm	2022-02-10 17:35:32 UTC (rev 289543)
+++ trunk/Tools/TestWebKitAPI/Tests/mac/DragAndDropTestsMac.mm	2022-02-10 17:37:37 UTC (rev 289544)
@@ -58,6 +58,18 @@
     EXPECT_EQ(1U, numberOfValidItemsForDrop);
 }
 
+TEST(DragAndDropTests, DropUserSelectAllUserDragElementDiv)
+{
+    auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebViewFrame:NSMakeRect(0, 0, 320, 500)]);
+
+    TestWKWebView *webView = [simulator webView];
+    [webView synchronouslyLoadTestPageNamed:@"contenteditable-user-select-user-drag"];
+
+    [simulator runFrom:NSMakePoint(100, 100) to:NSMakePoint(100, 300)];
+
+    EXPECT_WK_STREQ(@"Text", [webView stringByEvaluatingJavaScript:@"document.getElementById(\"editor\").textContent"]);
+}
+
 #if ENABLE(INPUT_TYPE_COLOR)
 TEST(DragAndDropTests, DropColor)
 {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to