Title: [217074] trunk
- Revision
- 217074
- Author
- [email protected]
- Date
- 2017-05-18 16:20:34 -0700 (Thu, 18 May 2017)
Log Message
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.
Source/WebCore:
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):
Tools:
Tests that temporary selection around an attachment does not persist longer than it needs to.
* TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
(TestWebKitAPI::TEST):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (217073 => 217074)
--- trunk/Source/WebCore/ChangeLog 2017-05-18 23:11:30 UTC (rev 217073)
+++ trunk/Source/WebCore/ChangeLog 2017-05-18 23:20:34 UTC (rev 217074)
@@ -1,3 +1,19 @@
+2017-05-18 Wenson Hsieh <[email protected]>
+
+ 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-18 Daniel Bates <[email protected]>
Cleanup: Remove unused functions from RuntimeEnabledFeatures
Modified: trunk/Source/WebCore/page/DragController.cpp (217073 => 217074)
--- trunk/Source/WebCore/page/DragController.cpp 2017-05-18 23:11:30 UTC (rev 217073)
+++ trunk/Source/WebCore/page/DragController.cpp 2017-05-18 23:20:34 UTC (rev 217074)
@@ -1056,6 +1056,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()) {
@@ -1084,6 +1086,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: trunk/Tools/ChangeLog (217073 => 217074)
--- trunk/Tools/ChangeLog 2017-05-18 23:11:30 UTC (rev 217073)
+++ trunk/Tools/ChangeLog 2017-05-18 23:20:34 UTC (rev 217074)
@@ -1,3 +1,16 @@
+2017-05-18 Wenson Hsieh <[email protected]>
+
+ 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-18 John Wilander <[email protected]>
Resource Load Statistics: Grandfather domains for existing data records
Modified: trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm (217073 => 217074)
--- trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm 2017-05-18 23:11:30 UTC (rev 217073)
+++ trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm 2017-05-18 23:20:34 UTC (rev 217074)
@@ -644,6 +644,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
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes