<!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>[212974] 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/212974">212974</a></dd>
<dt>Author</dt> <dd>wenson_hsieh@apple.com</dd>
<dt>Date</dt> <dd>2017-02-24 16:05:45 -0800 (Fri, 24 Feb 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Refactor data interaction to use new WKDataInteraction SPI
https://bugs.webkit.org/show_bug.cgi?id=168602
Work towards &lt;rdar://problem/30313681&gt;

Reviewed by Tim Horton.

Source/WebKit2:

Adjust testing SPI to match new data interaction interfaces.

* Platform/spi/ios/UIKitSPI.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _simulateDataInteractionEntered:]):
(-[WKWebView _simulateDataInteractionUpdated:]):
(-[WKWebView _simulateDataInteractionPerformOperation:]):
(-[WKWebView _simulateDataInteractionEnded:]):
(-[WKWebView _simulateDataInteractionSessionDidEnd:]):
(-[WKWebView _simulateWillBeginDataInteractionWithSession:]):
(-[WKWebView _simulatedItemsForSession:]):
(-[WKWebView _simulatePrepareForDataInteractionSession:completion:]):
(-[WKWebView _simulateDataInteractionSessionDidEnd:withOperation:]): Deleted.
(-[WKWebView _simulateFailedDataInteractionWithIndex:]): Deleted.
(-[WKWebView _simulateWillBeginDataInteractionWithIndex:withSession:]): Deleted.
(-[WKWebView _simulatedItemsForDataInteractionWithIndex:]): Deleted.
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _positionInformationDidChange:]):
* UIProcess/ios/WKScrollView.h:
* UIProcess/ios/WKScrollView.mm:

Tools:

Update DataInteractionSimulator to simulate data interaction using updated SPI. See changes in WebKit2 for more details.

* TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/ios/DataInteractionSimulator.h:
* TestWebKitAPI/ios/DataInteractionSimulator.mm:
(-[DataInteractionSimulator _resetSimulatedState]):
(-[DataInteractionSimulator runFrom:to:]):
(-[DataInteractionSimulator _advanceProgress]):
(-[DataInteractionSimulator _currentLocation]):
(-[DataInteractionSimulator _finishDataInteraction]): Deleted.
(-[DataInteractionSimulator webViewDidSendDataInteractionStartRequest:]): Deleted.
(-[DataInteractionSimulator webView:didReceiveDataInteractionStartResponse:]): Deleted.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2PlatformspiiosUIKitSPIh">trunk/Source/WebKit2/Platform/spi/ios/UIKitSPI.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewInteractionh">trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewInteractionmm">trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKScrollViewmm">trunk/Source/WebKit2/UIProcess/ios/WKScrollView.mm</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsiosDataInteractionTestsmm">trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm</a></li>
<li><a href="#trunkToolsTestWebKitAPIiosDataInteractionSimulatorh">trunk/Tools/TestWebKitAPI/ios/DataInteractionSimulator.h</a></li>
<li><a href="#trunkToolsTestWebKitAPIiosDataInteractionSimulatormm">trunk/Tools/TestWebKitAPI/ios/DataInteractionSimulator.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (212973 => 212974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2017-02-25 00:05:39 UTC (rev 212973)
+++ trunk/Source/WebKit2/ChangeLog        2017-02-25 00:05:45 UTC (rev 212974)
</span><span class="lines">@@ -1,5 +1,36 @@
</span><span class="cx"> 2017-02-20  Wenson Hsieh  &lt;wenson_hsieh@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Refactor data interaction to use new WKDataInteraction SPI
+        https://bugs.webkit.org/show_bug.cgi?id=168602
+        Work towards &lt;rdar://problem/30313681&gt;
+
+        Reviewed by Tim Horton.
+
+        Adjust testing SPI to match new data interaction interfaces.
+
+        * Platform/spi/ios/UIKitSPI.h:
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _simulateDataInteractionEntered:]):
+        (-[WKWebView _simulateDataInteractionUpdated:]):
+        (-[WKWebView _simulateDataInteractionPerformOperation:]):
+        (-[WKWebView _simulateDataInteractionEnded:]):
+        (-[WKWebView _simulateDataInteractionSessionDidEnd:]):
+        (-[WKWebView _simulateWillBeginDataInteractionWithSession:]):
+        (-[WKWebView _simulatedItemsForSession:]):
+        (-[WKWebView _simulatePrepareForDataInteractionSession:completion:]):
+        (-[WKWebView _simulateDataInteractionSessionDidEnd:withOperation:]): Deleted.
+        (-[WKWebView _simulateFailedDataInteractionWithIndex:]): Deleted.
+        (-[WKWebView _simulateWillBeginDataInteractionWithIndex:withSession:]): Deleted.
+        (-[WKWebView _simulatedItemsForDataInteractionWithIndex:]): Deleted.
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _positionInformationDidChange:]):
+        * UIProcess/ios/WKScrollView.h:
+        * UIProcess/ios/WKScrollView.mm:
+
+2017-02-20  Wenson Hsieh  &lt;wenson_hsieh@apple.com&gt;
+
</ins><span class="cx">         Remove the data interaction gesture recognizer
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=168600
</span><span class="cx">         &lt;rdar://problem/30313681&gt;
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformspiiosUIKitSPIh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Platform/spi/ios/UIKitSPI.h (212973 => 212974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/spi/ios/UIKitSPI.h        2017-02-25 00:05:39 UTC (rev 212973)
+++ trunk/Source/WebKit2/Platform/spi/ios/UIKitSPI.h        2017-02-25 00:05:45 UTC (rev 212974)
</span><span class="lines">@@ -54,6 +54,7 @@
</span><span class="cx"> #import &lt;UIKit/UIStringDrawing_Private.h&gt;
</span><span class="cx"> #import &lt;UIKit/UITableViewCell_Private.h&gt;
</span><span class="cx"> #import &lt;UIKit/UITapGestureRecognizer_Private.h&gt;
</span><ins>+#import &lt;UIKit/UITextEffectsWindow.h&gt;
</ins><span class="cx"> #import &lt;UIKit/UITextInput_Private.h&gt;
</span><span class="cx"> #import &lt;UIKit/UITextInteractionAssistant_Private.h&gt;
</span><span class="cx"> #import &lt;UIKit/UIViewControllerTransitioning_Private.h&gt;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (212973 => 212974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2017-02-25 00:05:39 UTC (rev 212973)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2017-02-25 00:05:45 UTC (rev 212974)
</span><span class="lines">@@ -5235,35 +5235,60 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)_simulateDataInteractionEntered:(id)info
</span><span class="cx"> {
</span><ins>+#if ENABLE(DATA_INTERACTION)
+    [_contentView _simulateDataInteractionEntered:info];
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_simulateDataInteractionUpdated:(id)info
</span><span class="cx"> {
</span><ins>+#if ENABLE(DATA_INTERACTION)
+    [_contentView _simulateDataInteractionUpdated:info];
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_simulateDataInteractionPerformOperation:(id)info
</span><span class="cx"> {
</span><ins>+#if ENABLE(DATA_INTERACTION)
+    [_contentView _simulateDataInteractionPerformOperation:info];
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_simulateDataInteractionEnded:(id)info
</span><span class="cx"> {
</span><ins>+#if ENABLE(DATA_INTERACTION)
+    [_contentView _simulateDataInteractionEnded:info];
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)_simulateDataInteractionSessionDidEnd:(id)session withOperation:(NSUInteger)operation
</del><ins>+- (void)_simulateDataInteractionSessionDidEnd:(id)session
</ins><span class="cx"> {
</span><ins>+#if ENABLE(DATA_INTERACTION)
+    [_contentView _simulateDataInteractionSessionDidEnd:session];
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)_simulateFailedDataInteractionWithIndex:(NSInteger)sourceIndex
</del><ins>+- (void)_simulateWillBeginDataInteractionWithSession:(id)session
</ins><span class="cx"> {
</span><ins>+#if ENABLE(DATA_INTERACTION)
+    [_contentView _simulateWillBeginDataInteractionWithSession:session];
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)_simulateWillBeginDataInteractionWithIndex:(NSInteger)sourceIndex withSession:(id)session
</del><ins>+- (NSArray *)_simulatedItemsForSession:(id)session
</ins><span class="cx"> {
</span><ins>+#if ENABLE(DATA_INTERACTION)
+    return [_contentView _simulatedItemsForSession:session];
+#else
+    return @[ ];
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (NSArray *)_simulatedItemsForDataInteractionWithIndex:(NSInteger)sourceIndex
</del><ins>+- (void)_simulatePrepareForDataInteractionSession:(id)session completion:(dispatch_block_t)completion
</ins><span class="cx"> {
</span><del>-    return @[ ];
</del><ins>+#if ENABLE(DATA_INTERACTION)
+    [_contentView _simulatePrepareForDataInteractionSession:session completion:completion];
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (212973 => 212974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2017-02-25 00:05:39 UTC (rev 212973)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2017-02-25 00:05:45 UTC (rev 212974)
</span><span class="lines">@@ -310,10 +310,10 @@
</span><span class="cx"> - (void)_simulateDataInteractionUpdated:(id)info WK_API_AVAILABLE(ios(WK_IOS_TBA));
</span><span class="cx"> - (void)_simulateDataInteractionPerformOperation:(id)info WK_API_AVAILABLE(ios(WK_IOS_TBA));
</span><span class="cx"> - (void)_simulateDataInteractionEnded:(id)info WK_API_AVAILABLE(ios(WK_IOS_TBA));
</span><del>-- (void)_simulateDataInteractionSessionDidEnd:(id)session withOperation:(NSUInteger)operation WK_API_AVAILABLE(ios(WK_IOS_TBA));
-- (void)_simulateFailedDataInteractionWithIndex:(NSInteger)sourceIndex WK_API_AVAILABLE(ios(WK_IOS_TBA));
-- (void)_simulateWillBeginDataInteractionWithIndex:(NSInteger)sourceIndex withSession:(id)session WK_API_AVAILABLE(ios(WK_IOS_TBA));
-- (NSArray *)_simulatedItemsForDataInteractionWithIndex:(NSInteger)sourceIndex WK_API_AVAILABLE(ios(WK_IOS_TBA));
</del><ins>+- (void)_simulateDataInteractionSessionDidEnd:(id)session WK_API_AVAILABLE(ios(WK_IOS_TBA));
+- (void)_simulateWillBeginDataInteractionWithSession:(id)session WK_API_AVAILABLE(ios(WK_IOS_TBA));
+- (NSArray *)_simulatedItemsForSession:(id)session WK_API_AVAILABLE(ios(WK_IOS_TBA));
+- (void)_simulatePrepareForDataInteractionSession:(id)session completion:(dispatch_block_t)completion WK_API_AVAILABLE(ios(WK_IOS_TBA));
</ins><span class="cx"> 
</span><span class="cx"> #endif // TARGET_OS_IPHONE
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewInteractionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h (212973 => 212974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h        2017-02-25 00:05:39 UTC (rev 212973)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h        2017-02-25 00:05:45 UTC (rev 212974)
</span><span class="lines">@@ -188,6 +188,8 @@
</span><span class="cx"> #if ENABLE(DATA_INTERACTION)
</span><span class="cx">     WebKit::WKDataInteractionState _dataInteractionState;
</span><span class="cx">     BOOL _isPerformingDataInteractionOperation;
</span><ins>+    RetainPtr&lt;WKDataInteraction&gt; _dataInteraction;
+    CGPoint _deferredActionSheetRequestLocation;
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -195,7 +197,7 @@
</span><span class="cx"> 
</span><span class="cx"> @interface WKContentView (WKInteraction) &lt;UIGestureRecognizerDelegate, UIWebTouchEventsGestureRecognizerDelegate, UITextInputPrivate, UIWebFormAccessoryDelegate, UIWKInteractionViewProtocol, WKFileUploadPanelDelegate, WKActionSheetAssistantDelegate
</span><span class="cx"> #if ENABLE(DATA_INTERACTION)
</span><del>-    , WKViewDataInteractionSourceDelegate, WKDataInteractionSessionDelegate, WKViewDataInteractionDestinationDelegate, WKDataInteractionItemVisualTarget
</del><ins>+    , WKDataInteractionItemVisualTarget, WKDataInteractionDelegate, WKViewDataInteractionDestinationDelegate
</ins><span class="cx"> #endif
</span><span class="cx"> &gt;
</span><span class="cx"> 
</span><span class="lines">@@ -269,14 +271,14 @@
</span><span class="cx"> - (void)_didPerformDataInteractionControllerOperation;
</span><span class="cx"> - (void)_didHandleStartDataInteractionRequest:(BOOL)started;
</span><span class="cx"> - (void)_startDataInteractionWithImage:(RetainPtr&lt;CGImageRef&gt;)image withIndicatorData:(std::optional&lt;WebCore::TextIndicatorData&gt;)indicatorData atClientPosition:(CGPoint)clientPosition anchorPoint:(CGPoint)anchorPoint action:(uint64_t)action;
</span><del>-- (void)_simulateDataInteractionEntered:(id)info WK_API_AVAILABLE(ios(WK_IOS_TBA));
-- (void)_simulateDataInteractionUpdated:(id)info WK_API_AVAILABLE(ios(WK_IOS_TBA));
-- (void)_simulateDataInteractionPerformOperation:(id)info WK_API_AVAILABLE(ios(WK_IOS_TBA));
-- (void)_simulateDataInteractionEnded:(id)info WK_API_AVAILABLE(ios(WK_IOS_TBA));
-- (void)_simulateDataInteractionSessionDidEnd:(id)session withOperation:(NSUInteger)operation WK_API_AVAILABLE(ios(WK_IOS_TBA));
-- (void)_simulateFailedDataInteractionWithIndex:(NSInteger)sourceIndex WK_API_AVAILABLE(ios(WK_IOS_TBA));
-- (void)_simulateWillBeginDataInteractionWithIndex:(NSInteger)sourceIndex withSession:(id)session WK_API_AVAILABLE(ios(WK_IOS_TBA));
-- (NSArray *)_simulatedItemsForDataInteractionWithIndex:(NSInteger)sourceIndex WK_API_AVAILABLE(ios(WK_IOS_TBA));
</del><ins>+- (void)_simulateDataInteractionEntered:(id)info;
+- (void)_simulateDataInteractionUpdated:(id)info;
+- (void)_simulateDataInteractionPerformOperation:(id)info;
+- (void)_simulateDataInteractionEnded:(id)info;
+- (void)_simulateDataInteractionSessionDidEnd:(id)session;
+- (void)_simulateWillBeginDataInteractionWithSession:(id)session;
+- (NSArray *)_simulatedItemsForSession:(id)session;
+- (void)_simulatePrepareForDataInteractionSession:(id)session completion:(dispatch_block_t)completion;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewInteractionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (212973 => 212974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm        2017-02-25 00:05:39 UTC (rev 212973)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm        2017-02-25 00:05:45 UTC (rev 212974)
</span><span class="lines">@@ -1720,10 +1720,6 @@
</span><span class="cx">     _hasValidPositionInformation = YES;
</span><span class="cx">     if (_actionSheetAssistant)
</span><span class="cx">         [_actionSheetAssistant updateSheetPosition];
</span><del>-
-#if ENABLE(DATA_INTERACTION)
-    [self _updateDataInteractionPreviewSnapshotIfPossible];
-#endif
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_willStartScrollingOrZooming
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKScrollViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKScrollView.mm (212973 => 212974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKScrollView.mm        2017-02-25 00:05:39 UTC (rev 212973)
+++ trunk/Source/WebKit2/UIProcess/ios/WKScrollView.mm        2017-02-25 00:05:45 UTC (rev 212974)
</span><span class="lines">@@ -129,6 +129,10 @@
</span><span class="cx">     return self;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if USE(APPLE_INTERNAL_SDK) &amp;&amp; __has_include(&lt;WebKitAdditions/WKScrollViewAdditions.mm&gt;)
+#import &lt;WebKitAdditions/WKScrollViewAdditions.mm&gt;
+#endif
+
</ins><span class="cx"> - (void)setInternalDelegate:(WKWebView &lt;UIScrollViewDelegate&gt; *)internalDelegate
</span><span class="cx"> {
</span><span class="cx">     if (internalDelegate == _internalDelegate)
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (212973 => 212974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2017-02-25 00:05:39 UTC (rev 212973)
+++ trunk/Tools/ChangeLog        2017-02-25 00:05:45 UTC (rev 212974)
</span><span class="lines">@@ -1,5 +1,27 @@
</span><span class="cx"> 2017-02-20  Wenson Hsieh  &lt;wenson_hsieh@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Refactor data interaction to use new WKDataInteraction SPI
+        https://bugs.webkit.org/show_bug.cgi?id=168602
+        Work towards &lt;rdar://problem/30313681&gt;
+
+        Reviewed by Tim Horton.
+
+        Update DataInteractionSimulator to simulate data interaction using updated SPI. See changes in WebKit2 for more details.
+
+        * TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/ios/DataInteractionSimulator.h:
+        * TestWebKitAPI/ios/DataInteractionSimulator.mm:
+        (-[DataInteractionSimulator _resetSimulatedState]):
+        (-[DataInteractionSimulator runFrom:to:]):
+        (-[DataInteractionSimulator _advanceProgress]):
+        (-[DataInteractionSimulator _currentLocation]):
+        (-[DataInteractionSimulator _finishDataInteraction]): Deleted.
+        (-[DataInteractionSimulator webViewDidSendDataInteractionStartRequest:]): Deleted.
+        (-[DataInteractionSimulator webView:didReceiveDataInteractionStartResponse:]): Deleted.
+
+2017-02-20  Wenson Hsieh  &lt;wenson_hsieh@apple.com&gt;
+
</ins><span class="cx">         Remove the data interaction gesture recognizer
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=168600
</span><span class="cx">         &lt;rdar://problem/30313681&gt;
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsiosDataInteractionTestsmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm (212973 => 212974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm        2017-02-25 00:05:39 UTC (rev 212973)
+++ trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm        2017-02-25 00:05:45 UTC (rev 212974)
</span><span class="lines">@@ -25,7 +25,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> 
</span><del>-#if 0
</del><ins>+#if ENABLE(DATA_INTERACTION)
</ins><span class="cx"> 
</span><span class="cx"> #import &quot;DataInteractionSimulator.h&quot;
</span><span class="cx"> #import &quot;PlatformUtilities.h&quot;
</span><span class="lines">@@ -81,7 +81,6 @@
</span><span class="cx"> 
</span><span class="cx">     NSURL *imageURL = [NSURL fileURLWithPath:[webView editorValue]];
</span><span class="cx">     EXPECT_WK_STREQ(&quot;icon.png&quot;, imageURL.lastPathComponent);
</span><del>-    EXPECT_TRUE([dataInteractionSimulator didTryToBeginDataInteraction]);
</del><span class="cx"> 
</span><span class="cx">     NSArray *observedEventNames = [dataInteractionSimulator observedEventNames];
</span><span class="cx">     EXPECT_TRUE([observedEventNames containsObject:DataInteractionEnterEventName]);
</span><span class="lines">@@ -102,7 +101,6 @@
</span><span class="cx"> 
</span><span class="cx">     EXPECT_EQ([webView stringByEvaluatingJavaScript:@&quot;source.textContent&quot;].length, 0UL);
</span><span class="cx">     EXPECT_WK_STREQ(&quot;Hello world&quot;, [webView stringByEvaluatingJavaScript:@&quot;editor.textContent&quot;].UTF8String);
</span><del>-    EXPECT_TRUE([dataInteractionSimulator didTryToBeginDataInteraction]);
</del><span class="cx"> 
</span><span class="cx">     NSArray *observedEventNames = [dataInteractionSimulator observedEventNames];
</span><span class="cx">     EXPECT_TRUE([observedEventNames containsObject:DataInteractionEnterEventName]);
</span><span class="lines">@@ -121,7 +119,6 @@
</span><span class="cx"> 
</span><span class="cx">     EXPECT_EQ([webView stringByEvaluatingJavaScript:@&quot;source.textContent&quot;].length, 0UL);
</span><span class="cx">     EXPECT_WK_STREQ(&quot;Hello world&quot;, [webView editorValue].UTF8String);
</span><del>-    EXPECT_TRUE([dataInteractionSimulator didTryToBeginDataInteraction]);
</del><span class="cx"> 
</span><span class="cx">     NSArray *observedEventNames = [dataInteractionSimulator observedEventNames];
</span><span class="cx">     EXPECT_TRUE([observedEventNames containsObject:DataInteractionEnterEventName]);
</span><span class="lines">@@ -139,7 +136,6 @@
</span><span class="cx">     [dataInteractionSimulator runFrom:CGPointMake(100, 50) to:CGPointMake(100, 300)];
</span><span class="cx"> 
</span><span class="cx">     EXPECT_WK_STREQ(&quot;https://www.daringfireball.net/&quot;, [webView editorValue].UTF8String);
</span><del>-    EXPECT_TRUE([dataInteractionSimulator didTryToBeginDataInteraction]);
</del><span class="cx"> 
</span><span class="cx">     NSArray *observedEventNames = [dataInteractionSimulator observedEventNames];
</span><span class="cx">     EXPECT_TRUE([observedEventNames containsObject:DataInteractionEnterEventName]);
</span><span class="lines">@@ -157,7 +153,6 @@
</span><span class="cx">     [dataInteractionSimulator runFrom:CGPointMake(100, 50) to:CGPointMake(100, 300)];
</span><span class="cx"> 
</span><span class="cx">     EXPECT_WK_STREQ(&quot;https://www.daringfireball.net/&quot;, [webView editorValue].UTF8String);
</span><del>-    EXPECT_TRUE([dataInteractionSimulator didTryToBeginDataInteraction]);
</del><span class="cx"> 
</span><span class="cx">     NSArray *observedEventNames = [dataInteractionSimulator observedEventNames];
</span><span class="cx">     EXPECT_TRUE([observedEventNames containsObject:DataInteractionEnterEventName]);
</span><span class="lines">@@ -175,7 +170,6 @@
</span><span class="cx">     [dataInteractionSimulator runFrom:CGPointMake(100, 50) to:CGPointMake(100, 300)];
</span><span class="cx"> 
</span><span class="cx">     EXPECT_FALSE([webView editorContainsImageElement]);
</span><del>-    EXPECT_FALSE([dataInteractionSimulator didTryToBeginDataInteraction]);
</del><span class="cx"> 
</span><span class="cx">     NSArray *observedEventNames = [dataInteractionSimulator observedEventNames];
</span><span class="cx">     EXPECT_FALSE([observedEventNames containsObject:DataInteractionEnterEventName]);
</span><span class="lines">@@ -192,7 +186,6 @@
</span><span class="cx">     [dataInteractionSimulator runFrom:CGPointMake(100, 50) to:CGPointMake(100, 300)];
</span><span class="cx"> 
</span><span class="cx">     EXPECT_FALSE([webView editorContainsImageElement]);
</span><del>-    EXPECT_TRUE([dataInteractionSimulator didTryToBeginDataInteraction]);
</del><span class="cx"> 
</span><span class="cx">     NSArray *observedEventNames = [dataInteractionSimulator observedEventNames];
</span><span class="cx">     EXPECT_TRUE([observedEventNames containsObject:DataInteractionEnterEventName]);
</span><span class="lines">@@ -209,7 +202,6 @@
</span><span class="cx">     [dataInteractionSimulator runFrom:CGPointMake(100, 50) to:CGPointMake(100, 450)];
</span><span class="cx"> 
</span><span class="cx">     EXPECT_WK_STREQ(&quot;&quot;, [webView editorValue].UTF8String);
</span><del>-    EXPECT_TRUE([dataInteractionSimulator didTryToBeginDataInteraction]);
</del><span class="cx"> 
</span><span class="cx">     NSArray *observedEventNames = [dataInteractionSimulator observedEventNames];
</span><span class="cx">     EXPECT_TRUE([observedEventNames containsObject:DataInteractionEnterEventName]);
</span><span class="lines">@@ -219,22 +211,6 @@
</span><span class="cx">     EXPECT_TRUE([[dataInteractionSimulator finalSelectionRects] isEqualToArray:@[ ]]);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-TEST(DataInteractionTests, HandlesDataInteractionFailureGracefully)
-{
-    RetainPtr&lt;TestWKWebView&gt; webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
-    [webView synchronouslyLoadTestPageNamed:@&quot;link-and-input&quot;];
-
-    RetainPtr&lt;DataInteractionSimulator&gt; dataInteractionSimulator = adoptNS([[DataInteractionSimulator alloc] initWithWebView:webView.get()]);
-    [dataInteractionSimulator setForceRequestToFail:YES];
-    [dataInteractionSimulator runFrom:CGPointMake(100, 50) to:CGPointMake(100, 300)];
-    EXPECT_WK_STREQ(&quot;&quot;, [webView editorValue].UTF8String);
-
-    // Before r212266, starting a subsequent gesture would have caused a debug assertion in the web process.
-    [dataInteractionSimulator setForceRequestToFail:NO];
-    [dataInteractionSimulator runFrom:CGPointMake(100, 50) to:CGPointMake(100, 300)];
-    EXPECT_WK_STREQ(&quot;https://www.daringfireball.net/&quot;, [webView editorValue].UTF8String);
-}
-
</del><span class="cx"> TEST(DataInteractionTests, ExternalSourceUTF8PlainTextOnly)
</span><span class="cx"> {
</span><span class="cx">     RetainPtr&lt;TestWKWebView&gt; webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIiosDataInteractionSimulatorh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/ios/DataInteractionSimulator.h (212973 => 212974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/ios/DataInteractionSimulator.h        2017-02-25 00:05:39 UTC (rev 212973)
+++ trunk/Tools/TestWebKitAPI/ios/DataInteractionSimulator.h        2017-02-25 00:05:45 UTC (rev 212974)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #import &lt;wtf/BlockPtr.h&gt;
</span><span class="cx"> 
</span><span class="cx"> @class MockDataInteractionInfo;
</span><ins>+@class MockDataInteractionSession;
</ins><span class="cx"> 
</span><span class="cx"> extern NSString * const DataInteractionEnterEventName;
</span><span class="cx"> extern NSString * const DataInteractionOverEventName;
</span><span class="lines">@@ -40,7 +41,8 @@
</span><span class="cx"> extern NSString * const DataInteractionStartEventName;
</span><span class="cx"> 
</span><span class="cx"> typedef NS_ENUM(NSInteger, DataInteractionPhase) {
</span><del>-    DataInteractionUnrecognized = 1,
</del><ins>+    DataInteractionCancelled = 0,
+    DataInteractionBeginning = 1,
</ins><span class="cx">     DataInteractionBegan = 2,
</span><span class="cx">     DataInteractionEntered = 3,
</span><span class="cx">     DataInteractionPerforming = 4
</span><span class="lines">@@ -48,6 +50,7 @@
</span><span class="cx"> 
</span><span class="cx"> @interface DataInteractionSimulator : NSObject&lt;_WKTestingDelegate&gt; {
</span><span class="cx">     RetainPtr&lt;TestWKWebView&gt; _webView;
</span><ins>+    RetainPtr&lt;MockDataInteractionSession&gt; _dataInteractionSession;
</ins><span class="cx">     RetainPtr&lt;MockDataInteractionInfo&gt; _dataInteractionInfo;
</span><span class="cx">     RetainPtr&lt;NSMutableArray&gt; _observedEventNames;
</span><span class="cx">     RetainPtr&lt;UIItemProvider&gt; _externalItemProvider;
</span><span class="lines">@@ -55,7 +58,7 @@
</span><span class="cx">     CGPoint _startLocation;
</span><span class="cx">     CGPoint _endLocation;
</span><span class="cx"> 
</span><del>-    double _gestureProgress;
</del><ins>+    double _currentProgress;
</ins><span class="cx">     bool _isDoneWithCurrentRun;
</span><span class="cx">     DataInteractionPhase _phase;
</span><span class="cx"> }
</span><span class="lines">@@ -63,9 +66,7 @@
</span><span class="cx"> - (instancetype)initWithWebView:(TestWKWebView *)webView;
</span><span class="cx"> - (void)runFrom:(CGPoint)startLocation to:(CGPoint)endLocation;
</span><span class="cx"> 
</span><del>-@property (nonatomic) BOOL forceRequestToFail;
</del><span class="cx"> @property (nonatomic, strong) UIItemProvider *externalItemProvider;
</span><del>-@property (nonatomic, readonly) BOOL didTryToBeginDataInteraction;
</del><span class="cx"> @property (nonatomic, readonly) NSArray *observedEventNames;
</span><span class="cx"> @property (nonatomic, readonly) NSArray *finalSelectionRects;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIiosDataInteractionSimulatormm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/ios/DataInteractionSimulator.mm (212973 => 212974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/ios/DataInteractionSimulator.mm        2017-02-25 00:05:39 UTC (rev 212973)
+++ trunk/Tools/TestWebKitAPI/ios/DataInteractionSimulator.mm        2017-02-25 00:05:45 UTC (rev 212974)
</span><span class="lines">@@ -73,12 +73,13 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)_resetSimulatedState
</span><span class="cx"> {
</span><del>-    _gestureProgress = 0;
-    _phase = DataInteractionUnrecognized;
</del><ins>+    _phase = DataInteractionBeginning;
+    _currentProgress = 0;
</ins><span class="cx">     _isDoneWithCurrentRun = false;
</span><del>-    _didTryToBeginDataInteraction = NO;
</del><span class="cx">     _observedEventNames = adoptNS([[NSMutableArray alloc] init]);
</span><span class="cx">     _finalSelectionRects = @[ ];
</span><ins>+    _dataInteractionSession = nil;
+    _dataInteractionInfo = nil;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (NSArray *)observedEventNames
</span><span class="lines">@@ -102,12 +103,19 @@
</span><span class="cx">     _endLocation = endLocation;
</span><span class="cx"> 
</span><span class="cx">     if (self.externalItemProvider) {
</span><ins>+        _dataInteractionInfo = adoptNS([[MockDataInteractionInfo alloc] initWithProvider:self.externalItemProvider location:_startLocation window:[_webView window]]);
</ins><span class="cx">         _phase = DataInteractionBegan;
</span><del>-        _dataInteractionInfo = adoptNS([[MockDataInteractionInfo alloc] initWithProvider:self.externalItemProvider location:startLocation window:[_webView window]]);
</del><ins>+        [self _advanceProgress];
+    } else {
+        _dataInteractionSession = adoptNS([[MockDataInteractionSession alloc] initWithWindow:[_webView window]]);
+        [_dataInteractionSession setMockLocationInWindow:_startLocation];
+        [_webView _simulatePrepareForDataInteractionSession:_dataInteractionSession.get() completion:^() {
+            DataInteractionSimulator *weakSelf = strongSelf.get();
+            weakSelf-&gt;_phase = DataInteractionBeginning;
+            [weakSelf _advanceProgress];
+        }];
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    [self _scheduleAdvanceProgress];
-
</del><span class="cx">     Util::run(&amp;_isDoneWithCurrentRun);
</span><span class="cx">     [_webView clearMessageHandlers:dataInteractionEventNames()];
</span><span class="cx">     _finalSelectionRects = [_webView selectionRectsAfterPresentationUpdate];
</span><span class="lines">@@ -120,42 +128,54 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)_advanceProgress
</span><span class="cx"> {
</span><del>-    _gestureProgress = std::min(1.0, std::max(0.0, progressIncrementStep + _gestureProgress));
-    [_dataInteractionInfo setMockLocationInWindow:self._currentLocation];
-    if (_gestureProgress &gt;= 1) {
-        [self _finishDataInteraction];
</del><ins>+    _currentProgress += progressIncrementStep;
+    CGPoint locationInWindow = self._currentLocation;
+    [_dataInteractionSession setMockLocationInWindow:locationInWindow];
+    [_dataInteractionInfo setMockLocationInWindow:locationInWindow];
+
+    if (_currentProgress &gt;= 1) {
+        [_webView _simulateDataInteractionPerformOperation:_dataInteractionInfo.get()];
+        [_webView _simulateDataInteractionEnded:_dataInteractionInfo.get()];
+        if (_dataInteractionSession)
+            [_webView _simulateDataInteractionSessionDidEnd:_dataInteractionSession.get()];
+
+        _phase = DataInteractionPerforming;
+        _currentProgress = 1;
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     switch (_phase) {
</span><del>-    case DataInteractionUnrecognized:
-        [self _scheduleAdvanceProgress];
</del><ins>+    case DataInteractionBeginning: {
+        NSMutableArray&lt;UIItemProvider *&gt; *itemProviders = [NSMutableArray array];
+        NSArray&lt;WKDataInteractionItem *&gt; *items = [_webView _simulatedItemsForSession:_dataInteractionSession.get()];
+        if (!items.count) {
+            _phase = DataInteractionCancelled;
+            _currentProgress = 1;
+            _isDoneWithCurrentRun = true;
+            return;
+        }
+
+        for (WKDataInteractionItem *item in items)
+            [itemProviders addObject:item.itemProvider];
+
+        _dataInteractionInfo = adoptNS([[MockDataInteractionInfo alloc] initWithProvider:itemProviders.firstObject location:self._currentLocation window:[_webView window]]);
+        [_dataInteractionSession setItems:items];
+        [_webView _simulateWillBeginDataInteractionWithSession:_dataInteractionSession.get()];
+        _phase = DataInteractionBegan;
</ins><span class="cx">         break;
</span><ins>+    }
</ins><span class="cx">     case DataInteractionBegan:
</span><span class="cx">         [_webView _simulateDataInteractionEntered:_dataInteractionInfo.get()];
</span><span class="cx">         _phase = DataInteractionEntered;
</span><del>-        [self _scheduleAdvanceProgress];
</del><span class="cx">         break;
</span><span class="cx">     case DataInteractionEntered:
</span><span class="cx">         [_webView _simulateDataInteractionUpdated:_dataInteractionInfo.get()];
</span><del>-        [self _scheduleAdvanceProgress];
</del><span class="cx">         break;
</span><span class="cx">     default:
</span><span class="cx">         break;
</span><span class="cx">     }
</span><del>-}
</del><span class="cx"> 
</span><del>-- (void)_finishDataInteraction
-{
-    if (_phase == DataInteractionUnrecognized) {
-        _isDoneWithCurrentRun = true;
-        return;
-    }
-
-    _phase = DataInteractionPerforming;
-    [_webView _simulateDataInteractionPerformOperation:_dataInteractionInfo.get()];
-    [_webView _simulateDataInteractionEnded:_dataInteractionInfo.get()];
-    [_webView _simulateDataInteractionSessionDidEnd:nil withOperation:0];
</del><ins>+    [self _scheduleAdvanceProgress];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (CGPoint)_currentLocation
</span><span class="lines">@@ -162,7 +182,7 @@
</span><span class="cx"> {
</span><span class="cx">     CGFloat distanceX = _endLocation.x - _startLocation.x;
</span><span class="cx">     CGFloat distanceY = _endLocation.y - _startLocation.y;
</span><del>-    return CGPointMake(_startLocation.x + _gestureProgress * distanceX, _startLocation.y + _gestureProgress * distanceY);
</del><ins>+    return CGPointMake(_startLocation.x + _currentProgress * distanceX, _startLocation.y + _currentProgress * distanceY);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_scheduleAdvanceProgress
</span><span class="lines">@@ -188,20 +208,6 @@
</span><span class="cx">     _isDoneWithCurrentRun = true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)webViewDidSendDataInteractionStartRequest:(WKWebView *)webView
-{
-    // This addresses a race condition in the testing harness wherein the web process might take longer than usual to process the
-    // request to start data interaction, and in the meantime, DataInteractionSimulator would end up completing the rest of the test
-    // before a response from the web process is received. We instead defer test progress until after the web process has indicated
-    // whether or not data interaction should commence.
-    [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(_advanceProgress) object:nil];
-}
-
-- (void)webView:(WKWebView *)webView didReceiveDataInteractionStartResponse:(BOOL)started
-{
-    [self _scheduleAdvanceProgress];
-}
-
</del><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(DATA_INTERACTION)
</span></span></pre>
</div>
</div>

</body>
</html>