<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[245882] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/245882">245882</a></dd>
<dt>Author</dt> <dd>wenson_hsieh@apple.com</dd>
<dt>Date</dt> <dd>2019-05-29 19:41:10 -0700 (Wed, 29 May 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>Remove some logic to suppress the text selection assistant during drop
https://bugs.webkit.org/show_bug.cgi?id=198354

Reviewed by Tim Horton.

Source/WebKit:

This logic was originally added to hide the ranged selection after performing a drop in editable content.
However, after <a href="http://trac.webkit.org/projects/webkit/changeset/245803">r245803</a>, we (1) no longer show the keyboard and/or text selection views when dropping, and (2)
the final selection is now a caret, so it's no longer necessary to suppress the selection assistant.

* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView dropInteraction:performDrop:]):
(-[WKContentView dropInteraction:concludeDrop:]):

Tools:

Adjust some API tests that currently check whether or not the selection assistant was suppressed during drop.

* TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/cocoa/DragAndDropSimulator.h:
* TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm:
(-[DragAndDropSimulator _resetSimulatedState]):
(-[DragAndDropSimulator _webView:dataInteractionOperationWasHandled:forSession:itemProviders:]):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitUIProcessiosWKContentViewInteractionh">trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessiosWKContentViewInteractionmm">trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsiosDragAndDropTestsIOSmm">trunk/Tools/TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm</a></li>
<li><a href="#trunkToolsTestWebKitAPIcocoaDragAndDropSimulatorh">trunk/Tools/TestWebKitAPI/cocoa/DragAndDropSimulator.h</a></li>
<li><a href="#trunkToolsTestWebKitAPIiosDragAndDropSimulatorIOSmm">trunk/Tools/TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (245881 => 245882)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2019-05-30 00:23:58 UTC (rev 245881)
+++ trunk/Source/WebKit/ChangeLog       2019-05-30 02:41:10 UTC (rev 245882)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2019-05-29  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        Remove some logic to suppress the text selection assistant during drop
+        https://bugs.webkit.org/show_bug.cgi?id=198354
+
+        Reviewed by Tim Horton.
+
+        This logic was originally added to hide the ranged selection after performing a drop in editable content.
+        However, after r245803, we (1) no longer show the keyboard and/or text selection views when dropping, and (2)
+        the final selection is now a caret, so it's no longer necessary to suppress the selection assistant.
+
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView dropInteraction:performDrop:]):
+        (-[WKContentView dropInteraction:concludeDrop:]):
+
</ins><span class="cx"> 2019-05-29  Sihui Liu  <sihui_liu@apple.com>
</span><span class="cx"> 
</span><span class="cx">         WKWebsiteDataStore API fails to fetch web storage data for non-persistent data store
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessiosWKContentViewInteractionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (245881 => 245882)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h     2019-05-30 00:23:58 UTC (rev 245881)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h        2019-05-30 02:41:10 UTC (rev 245882)
</span><span class="lines">@@ -165,8 +165,7 @@
</span><span class="cx"> enum SuppressSelectionAssistantReason : uint8_t {
</span><span class="cx">     EditableRootIsTransparentOrFullyClipped = 1 << 0,
</span><span class="cx">     FocusedElementIsTooSmall = 1 << 1,
</span><del>-    DropAnimationIsRunning = 1 << 2,
-    InteractionIsHappening = 1 << 3
</del><ins>+    InteractionIsHappening = 1 << 2
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> struct WKSelectionDrawingInfo {
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessiosWKContentViewInteractionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (245881 => 245882)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm    2019-05-30 00:23:58 UTC (rev 245881)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm       2019-05-30 02:41:10 UTC (rev 245882)
</span><span class="lines">@@ -6891,9 +6891,7 @@
</span><span class="cx">         WebKit::SandboxExtension::HandleArray sandboxExtensionForUpload;
</span><span class="cx">         retainedSelf->_page->createSandboxExtensionsIfNeeded(filenames, sandboxExtensionHandle, sandboxExtensionForUpload);
</span><span class="cx">         retainedSelf->_page->performDragOperation(capturedDragData, "data interaction pasteboard", WTFMove(sandboxExtensionHandle), WTFMove(sandboxExtensionForUpload));
</span><del>-
</del><span class="cx">         retainedSelf->_visibleContentViewSnapshot = [retainedSelf snapshotViewAfterScreenUpdates:NO];
</span><del>-        [retainedSelf _startSuppressingSelectionAssistantForReason:WebKit::DropAnimationIsRunning];
</del><span class="cx">         [UIView performWithoutAnimation:[retainedSelf] {
</span><span class="cx">             [retainedSelf->_visibleContentViewSnapshot setFrame:[retainedSelf bounds]];
</span><span class="cx">             [retainedSelf addSubview:retainedSelf->_visibleContentViewSnapshot.get()];
</span><span class="lines">@@ -6910,7 +6908,6 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)dropInteraction:(UIDropInteraction *)interaction concludeDrop:(id <UIDropSession>)session
</span><span class="cx"> {
</span><del>-    [self _stopSuppressingSelectionAssistantForReason:WebKit::DropAnimationIsRunning];
</del><span class="cx">     [std::exchange(_visibleContentViewSnapshot, nil) removeFromSuperview];
</span><span class="cx">     [std::exchange(_unselectedContentSnapshot, nil) removeFromSuperview];
</span><span class="cx">     _dragDropInteractionState.clearAllDelayedItemPreviewProviders();
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (245881 => 245882)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog    2019-05-30 00:23:58 UTC (rev 245881)
+++ trunk/Tools/ChangeLog       2019-05-30 02:41:10 UTC (rev 245882)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2019-05-29  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        Remove some logic to suppress the text selection assistant during drop
+        https://bugs.webkit.org/show_bug.cgi?id=198354
+
+        Reviewed by Tim Horton.
+
+        Adjust some API tests that currently check whether or not the selection assistant was suppressed during drop.
+
+        * TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/cocoa/DragAndDropSimulator.h:
+        * TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm:
+        (-[DragAndDropSimulator _resetSimulatedState]):
+        (-[DragAndDropSimulator _webView:dataInteractionOperationWasHandled:forSession:itemProviders:]):
+
</ins><span class="cx"> 2019-05-29  Sihui Liu  <sihui_liu@apple.com>
</span><span class="cx"> 
</span><span class="cx">         WKWebsiteDataStore API fails to fetch web storage data for non-persistent data store
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsiosDragAndDropTestsIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm (245881 => 245882)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm       2019-05-30 00:23:58 UTC (rev 245881)
+++ trunk/Tools/TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm  2019-05-30 02:41:10 UTC (rev 245882)
</span><span class="lines">@@ -370,7 +370,6 @@
</span><span class="cx">     loadTestPageAndEnsureInputSession(simulator.get(), @"autofocus-contenteditable");
</span><span class="cx">     [simulator runFrom:CGPointMake(100, 50) to:CGPointMake(100, 300)];
</span><span class="cx"> 
</span><del>-    EXPECT_TRUE([simulator suppressedSelectionCommandsDuringDrop]);
</del><span class="cx">     EXPECT_EQ([webView stringByEvaluatingJavaScript:@"source.textContent"].length, 0UL);
</span><span class="cx">     EXPECT_WK_STREQ("Hello world", [webView stringByEvaluatingJavaScript:@"editor.textContent"].UTF8String);
</span><span class="cx"> 
</span><span class="lines">@@ -394,7 +393,6 @@
</span><span class="cx">     loadTestPageAndEnsureInputSession(simulator.get(), @"contenteditable-and-textarea");
</span><span class="cx">     [simulator runFrom:CGPointMake(100, 50) to:CGPointMake(100, 300)];
</span><span class="cx"> 
</span><del>-    EXPECT_TRUE([simulator suppressedSelectionCommandsDuringDrop]);
</del><span class="cx">     EXPECT_EQ([webView stringByEvaluatingJavaScript:@"source.textContent"].length, 0UL);
</span><span class="cx">     EXPECT_WK_STREQ("Hello world", [webView editorValue].UTF8String);
</span><span class="cx"> 
</span><span class="lines">@@ -455,7 +453,6 @@
</span><span class="cx">     NSUInteger firstParagraphOffset = [finalTextContent rangeOfString:@"This is the first paragraph"].location;
</span><span class="cx">     NSUInteger secondParagraphOffset = [finalTextContent rangeOfString:@"This is the second paragraph"].location;
</span><span class="cx"> 
</span><del>-    EXPECT_TRUE([simulator suppressedSelectionCommandsDuringDrop]);
</del><span class="cx">     EXPECT_FALSE(firstParagraphOffset == NSNotFound);
</span><span class="cx">     EXPECT_FALSE(secondParagraphOffset == NSNotFound);
</span><span class="cx">     EXPECT_GT(firstParagraphOffset, secondParagraphOffset);
</span><span class="lines">@@ -482,7 +479,6 @@
</span><span class="cx">     loadTestPageAndEnsureInputSession(simulator.get(), @"textarea-to-input");
</span><span class="cx">     [simulator runFrom:CGPointMake(100, 50) to:CGPointMake(100, 300)];
</span><span class="cx"> 
</span><del>-    EXPECT_TRUE([simulator suppressedSelectionCommandsDuringDrop]);
</del><span class="cx">     EXPECT_EQ([webView stringByEvaluatingJavaScript:@"source.value"].length, 0UL);
</span><span class="cx">     EXPECT_WK_STREQ("Hello world", [webView editorValue].UTF8String);
</span><span class="cx">     checkCGRectIsEqualToCGRectWithLogging(CGRectMake(1089, 241, 2, 232), [simulator finalSelectionStartRect]);
</span><span class="lines">@@ -499,8 +495,6 @@
</span><span class="cx">     [webView stringByEvaluatingJavaScript:@"source.selectionEnd = source.value.length"];
</span><span class="cx">     [simulator runFrom:CGPointMake(100, 50) to:CGPointMake(100, 300)];
</span><span class="cx"> 
</span><del>-    EXPECT_TRUE([simulator suppressedSelectionCommandsDuringDrop]);
-
</del><span class="cx">     NSItemProvider *itemProvider = [simulator sourceItemProviders].firstObject;
</span><span class="cx">     NSArray *registeredTypes = [itemProvider registeredTypeIdentifiers];
</span><span class="cx">     EXPECT_EQ(1UL, registeredTypes.count);
</span><span class="lines">@@ -521,8 +515,6 @@
</span><span class="cx">     [webView stringByEvaluatingJavaScript:@"source.selectionEnd = source.value.length"];
</span><span class="cx">     [simulator runFrom:CGPointMake(100, 50) to:CGPointMake(100, 300)];
</span><span class="cx"> 
</span><del>-    EXPECT_TRUE([simulator suppressedSelectionCommandsDuringDrop]);
-
</del><span class="cx">     NSItemProvider *itemProvider = [simulator sourceItemProviders].firstObject;
</span><span class="cx">     NSArray *registeredTypes = [itemProvider registeredTypeIdentifiers];
</span><span class="cx">     EXPECT_EQ(2UL, registeredTypes.count);
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIcocoaDragAndDropSimulatorh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/cocoa/DragAndDropSimulator.h (245881 => 245882)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/cocoa/DragAndDropSimulator.h   2019-05-30 00:23:58 UTC (rev 245881)
+++ trunk/Tools/TestWebKitAPI/cocoa/DragAndDropSimulator.h      2019-05-30 02:41:10 UTC (rev 245882)
</span><span class="lines">@@ -113,7 +113,6 @@
</span><span class="cx"> @property (nonatomic, readonly) NSArray<UITargetedDragPreview *> *liftPreviews;
</span><span class="cx"> @property (nonatomic, readonly) NSArray *dropPreviews;
</span><span class="cx"> @property (nonatomic, readonly) NSArray *delayedDropPreviews;
</span><del>-@property (nonatomic, readonly) BOOL suppressedSelectionCommandsDuringDrop;
</del><span class="cx"> 
</span><span class="cx"> #endif // PLATFORM(IOS_FAMILY)
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIiosDragAndDropSimulatorIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm (245881 => 245882)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm 2019-05-30 00:23:58 UTC (rev 245881)
+++ trunk/Tools/TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm    2019-05-30 02:41:10 UTC (rev 245882)
</span><span class="lines">@@ -323,7 +323,6 @@
</span><span class="cx">     bool _isDoneWaitingForDelayedDropPreviews;
</span><span class="cx">     DragAndDropPhase _phase;
</span><span class="cx"> 
</span><del>-    BOOL _suppressedSelectionCommandsDuringDrop;
</del><span class="cx">     RetainPtr<UIDropProposal> _lastKnownDropProposal;
</span><span class="cx"> 
</span><span class="cx">     BlockPtr<BOOL(_WKActivatedElementInfo *)> _showCustomActionSheetBlock;
</span><span class="lines">@@ -373,7 +372,6 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)_resetSimulatedState
</span><span class="cx"> {
</span><del>-    _suppressedSelectionCommandsDuringDrop = NO;
</del><span class="cx">     _phase = DragAndDropPhaseBeginning;
</span><span class="cx">     _currentProgress = 0;
</span><span class="cx">     _isDoneWithCurrentRun = false;
</span><span class="lines">@@ -763,8 +761,6 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)_webView:(WKWebView *)webView dataInteractionOperationWasHandled:(BOOL)handled forSession:(id)session itemProviders:(NSArray<NSItemProvider *> *)itemProviders
</span><span class="cx"> {
</span><del>-    _suppressedSelectionCommandsDuringDrop = [_webView textInputContentView]._shouldSuppressSelectionCommands;
-
</del><span class="cx">     if (self.dropCompletionBlock)
</span><span class="cx">         self.dropCompletionBlock(handled, itemProviders);
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>