Title: [217103] branches/safari-604.1.21-branch
Revision
217103
Author
jmarc...@apple.com
Date
2017-05-19 01:04:16 -0700 (Fri, 19 May 2017)

Log Message

Cherry-pick r217074. rdar://problem/32282945

Modified Paths

Diff

Modified: branches/safari-604.1.21-branch/Source/WebCore/ChangeLog (217102 => 217103)


--- branches/safari-604.1.21-branch/Source/WebCore/ChangeLog	2017-05-19 06:58:05 UTC (rev 217102)
+++ branches/safari-604.1.21-branch/Source/WebCore/ChangeLog	2017-05-19 08:04:16 UTC (rev 217103)
@@ -1,3 +1,23 @@
+2017-05-18  Jason Marcell  <jmarc...@apple.com>
+
+        Cherry-pick r217074. rdar://problem/32282945
+
+    2017-05-18  Wenson Hsieh  <wenson_hs...@apple.com>
+
+            Selection around attachment elements should not persist when beginning a drag
+            https://bugs.webkit.org/show_bug.cgi?id=172319
+            <rdar://problem/32283008>
+
+            Reviewed by Tim Horton.
+
+            When beginning to drag an attachment element, save and restore the visible selection when calling out to the
+            injected bundle for additional data, and when creating the drag image.
+
+            Augmented an existing API test: DataInteractionTests.AttachmentElementItemProviders.
+
+            * page/DragController.cpp:
+            (WebCore::DragController::startDrag):
+
 2017-05-17  Jason Marcell  <jmarc...@apple.com>
 
         Cherry-pick r217022. rdar://problem/32258020

Modified: branches/safari-604.1.21-branch/Source/WebCore/page/DragController.cpp (217102 => 217103)


--- branches/safari-604.1.21-branch/Source/WebCore/page/DragController.cpp	2017-05-19 06:58:05 UTC (rev 217102)
+++ branches/safari-604.1.21-branch/Source/WebCore/page/DragController.cpp	2017-05-19 08:04:16 UTC (rev 217103)
@@ -1060,6 +1060,8 @@
 
 #if ENABLE(ATTACHMENT_ELEMENT)
     if (is<HTMLAttachmentElement>(element) && m_dragSourceAction & DragSourceActionAttachment) {
+        src.editor().setIgnoreSelectionChanges(true);
+        auto previousSelection = src.selection().selection();
         if (!dataTransfer.pasteboard().hasData()) {
             selectElement(element);
             if (!attachmentURL.isEmpty()) {
@@ -1088,6 +1090,8 @@
             m_dragOffset = IntPoint(dragOrigin.x() - dragLoc.x(), dragOrigin.y() - dragLoc.y());
         }
         doSystemDrag(WTFMove(dragImage), dragLoc, dragOrigin, { }, dataTransfer, src, DragSourceActionAttachment);
+        src.selection().setSelection(previousSelection);
+        src.editor().setIgnoreSelectionChanges(false);
         return true;
     }
 #endif

Modified: branches/safari-604.1.21-branch/Tools/ChangeLog (217102 => 217103)


--- branches/safari-604.1.21-branch/Tools/ChangeLog	2017-05-19 06:58:05 UTC (rev 217102)
+++ branches/safari-604.1.21-branch/Tools/ChangeLog	2017-05-19 08:04:16 UTC (rev 217103)
@@ -1,3 +1,20 @@
+2017-05-18  Jason Marcell  <jmarc...@apple.com>
+
+        Cherry-pick r217074. rdar://problem/32282945
+
+    2017-05-18  Wenson Hsieh  <wenson_hs...@apple.com>
+
+            Selection around attachment elements should not persist when beginning a drag
+            https://bugs.webkit.org/show_bug.cgi?id=172319
+            <rdar://problem/32283008>
+
+            Reviewed by Tim Horton.
+
+            Tests that temporary selection around an attachment does not persist longer than it needs to.
+
+            * TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
+            (TestWebKitAPI::TEST):
+
 2017-05-17  Jason Marcell  <jmarc...@apple.com>
 
         Cherry-pick r217010. rdar://problem/32141505

Modified: branches/safari-604.1.21-branch/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm (217102 => 217103)


--- branches/safari-604.1.21-branch/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm	2017-05-19 06:58:05 UTC (rev 217102)
+++ branches/safari-604.1.21-branch/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm	2017-05-19 08:04:16 UTC (rev 217103)
@@ -588,6 +588,7 @@
     [dataInteractionSimulator runFrom:CGPointMake(50, 50) to:CGPointMake(50, 400)];
 
     EXPECT_WK_STREQ("hello", [injectedString UTF8String]);
+    EXPECT_TRUE([webView stringByEvaluatingJavaScript:@"getSelection().isCollapsed"].boolValue);
 }
 
 TEST(DataInteractionTests, LargeImageToTargetDiv)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to