<!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>[211354] 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/211354">211354</a></dd>
<dt>Author</dt> <dd>mitz@apple.com</dd>
<dt>Date</dt> <dd>2017-01-29 16:26:36 -0800 (Sun, 29 Jan 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>[iOS] Expose WebCore::DataDetection::detectContentInRange WKWebProcessPlugInRangeHandle
https://bugs.webkit.org/show_bug.cgi?id=167565
Reviewed by Sam Weinig.
Source/WebKit2:
Test: TestWebKitAPI/Tests/WebKit2Cocoa/BundleRangeHandle.mm
* Shared/API/Cocoa/WKDataDetectorTypes.h: Added. Moved the enum definition from
WKWebViewConfiguration.h to here.
* Shared/API/Cocoa/WKDataDetectorTypesInternal.h: Added.
(fromWKDataDetectorTypes): Moved from WKWebView.mm.
* UIProcess/API/Cocoa/WKWebView.mm:
(fromWKDataDetectorTypes): Moved to WKDataDetectorTypesInternal.h.
* UIProcess/API/Cocoa/WKWebViewConfiguration.h: Moved WKDataDetectorTypes definition out
to WKDataDetectorTypes.h.
* WebKit2.xcodeproj/project.pbxproj: Added references to new files.
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.h:
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm:
(-[WKWebProcessPlugInRangeHandle detectDataWithTypes:context:]): Added. Calls
DataDetection::detectContentInRange.
Tools:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/BundleRangeHandle.mm: Added.
(-[BundleRangeHandleRemoteObject textFromBodyRange:]):
(-[BundleRangeHandleRemoteObject bodyInnerHTMLAfterDetectingData:]):
(TEST):
* TestWebKitAPI/Tests/WebKit2Cocoa/BundleRangeHandlePlugIn.mm: Added.
(-[BundleRangeHandlePlugIn webProcessPlugIn:didCreateBrowserContextController:]):
(-[BundleRangeHandlePlugIn webProcessPlugInBrowserContextController:didFinishDocumentLoadForFrame:]):
* TestWebKitAPI/Tests/WebKit2Cocoa/BundleRangeHandleProtocol.h: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewConfigurationh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPICocoaWKWebProcessPlugInRangeHandleh">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPICocoaWKWebProcessPlugInRangeHandlemm">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2SharedAPICocoaWKDataDetectorTypesh">trunk/Source/WebKit2/Shared/API/Cocoa/WKDataDetectorTypes.h</a></li>
<li><a href="#trunkSourceWebKit2SharedAPICocoaWKDataDetectorTypesInternalh">trunk/Source/WebKit2/Shared/API/Cocoa/WKDataDetectorTypesInternal.h</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2CocoaBundleRangeHandlemm">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleRangeHandle.mm</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2CocoaBundleRangeHandlePlugInmm">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleRangeHandlePlugIn.mm</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2CocoaBundleRangeHandleProtocolh">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleRangeHandleProtocol.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (211353 => 211354)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2017-01-29 20:21:08 UTC (rev 211353)
+++ trunk/Source/WebKit2/ChangeLog        2017-01-30 00:26:36 UTC (rev 211354)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2017-01-29 Dan Bernstein <mitz@apple.com>
+
+ [iOS] Expose WebCore::DataDetection::detectContentInRange WKWebProcessPlugInRangeHandle
+ https://bugs.webkit.org/show_bug.cgi?id=167565
+
+ Reviewed by Sam Weinig.
+
+ Test: TestWebKitAPI/Tests/WebKit2Cocoa/BundleRangeHandle.mm
+
+ * Shared/API/Cocoa/WKDataDetectorTypes.h: Added. Moved the enum definition from
+ WKWebViewConfiguration.h to here.
+ * Shared/API/Cocoa/WKDataDetectorTypesInternal.h: Added.
+ (fromWKDataDetectorTypes): Moved from WKWebView.mm.
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (fromWKDataDetectorTypes): Moved to WKDataDetectorTypesInternal.h.
+
+ * UIProcess/API/Cocoa/WKWebViewConfiguration.h: Moved WKDataDetectorTypes definition out
+ to WKDataDetectorTypes.h.
+
+ * WebKit2.xcodeproj/project.pbxproj: Added references to new files.
+
+ * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.h:
+ * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm:
+ (-[WKWebProcessPlugInRangeHandle detectDataWithTypes:context:]): Added. Calls
+ DataDetection::detectContentInRange.
+
</ins><span class="cx"> 2017-01-29 Carlos Garcia Campos <cgarcia@igalia.com>
</span><span class="cx">
</span><span class="cx"> [Coordinated Graphics] WebPage shouldn't use the layerTreeHost directly
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedAPICocoaWKDataDetectorTypesh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/Shared/API/Cocoa/WKDataDetectorTypes.h (0 => 211354)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/API/Cocoa/WKDataDetectorTypes.h         (rev 0)
+++ trunk/Source/WebKit2/Shared/API/Cocoa/WKDataDetectorTypes.h        2017-01-30 00:26:36 UTC (rev 211354)
</span><span class="lines">@@ -0,0 +1,64 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebKit/WKFoundation.h>
+
+#if WK_API_ENABLED
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+#if TARGET_OS_IPHONE
+
+/*! @enum WKDataDetectorTypes
+ @abstract The type of data detected.
+ @constant WKDataDetectorTypeNone No detection is performed.
+ @constant WKDataDetectorTypePhoneNumber Phone numbers are detected and turned into links.
+ @constant WKDataDetectorTypeLink URLs in text are detected and turned into links.
+ @constant WKDataDetectorTypeAddress Addresses are detected and turned into links.
+ @constant WKDataDetectorTypeCalendarEvent Dates and times that are in the future are detected and turned into links.
+ @constant WKDataDetectorTypeAll All of the above data types are turned into links when detected. Choosing this value will
+ automatically include any new detection type that is added.
+ */
+typedef NS_OPTIONS(NSUInteger, WKDataDetectorTypes) {
+ WKDataDetectorTypeNone = 0,
+ WKDataDetectorTypePhoneNumber = 1 << 0,
+ WKDataDetectorTypeLink = 1 << 1,
+ WKDataDetectorTypeAddress = 1 << 2,
+ WKDataDetectorTypeCalendarEvent = 1 << 3,
+ WKDataDetectorTypeTrackingNumber = 1 << 4,
+ WKDataDetectorTypeFlightNumber = 1 << 5,
+ WKDataDetectorTypeLookupSuggestion = 1 << 6,
+ WKDataDetectorTypeAll = NSUIntegerMax,
+
+ WKDataDetectorTypeSpotlightSuggestion WK_API_DEPRECATED_WITH_REPLACEMENT("WKDataDetectorTypeLookupSuggestion", ios(10.0, 10.0)) = WKDataDetectorTypeLookupSuggestion,
+} WK_API_AVAILABLE(ios(10.0));
+
+#endif
+
+NS_ASSUME_NONNULL_END
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2SharedAPICocoaWKDataDetectorTypesInternalh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/Shared/API/Cocoa/WKDataDetectorTypesInternal.h (0 => 211354)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/API/Cocoa/WKDataDetectorTypesInternal.h         (rev 0)
+++ trunk/Source/WebKit2/Shared/API/Cocoa/WKDataDetectorTypesInternal.h        2017-01-30 00:26:36 UTC (rev 211354)
</span><span class="lines">@@ -0,0 +1,62 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WKDataDetectorTypes.h"
+
+#if WK_API_ENABLED
+
+#if PLATFORM(IOS)
+
+#import <WebCore/DataDetection.h>
+
+static inline WebCore::DataDetectorTypes fromWKDataDetectorTypes(uint64_t types)
+{
+ if (static_cast<WKDataDetectorTypes>(types) == WKDataDetectorTypeNone)
+ return WebCore::DataDetectorTypeNone;
+ if (static_cast<WKDataDetectorTypes>(types) == WKDataDetectorTypeAll)
+ return WebCore::DataDetectorTypeAll;
+
+ uint32_t value = WebCore::DataDetectorTypeNone;
+ if (types & WKDataDetectorTypePhoneNumber)
+ value |= WebCore::DataDetectorTypePhoneNumber;
+ if (types & WKDataDetectorTypeLink)
+ value |= WebCore::DataDetectorTypeLink;
+ if (types & WKDataDetectorTypeAddress)
+ value |= WebCore::DataDetectorTypeAddress;
+ if (types & WKDataDetectorTypeCalendarEvent)
+ value |= WebCore::DataDetectorTypeCalendarEvent;
+ if (types & WKDataDetectorTypeTrackingNumber)
+ value |= WebCore::DataDetectorTypeTrackingNumber;
+ if (types & WKDataDetectorTypeFlightNumber)
+ value |= WebCore::DataDetectorTypeFlightNumber;
+ if (types & WKDataDetectorTypeLookupSuggestion)
+ value |= WebCore::DataDetectorTypeLookupSuggestion;
+
+ return static_cast<WebCore::DataDetectorTypes>(value);
+}
+
+#endif
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (211353 => 211354)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2017-01-29 20:21:08 UTC (rev 211353)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2017-01-30 00:26:36 UTC (rev 211354)
</span><span class="lines">@@ -50,6 +50,7 @@
</span><span class="cx"> #import "WKBackForwardListInternal.h"
</span><span class="cx"> #import "WKBackForwardListItemInternal.h"
</span><span class="cx"> #import "WKBrowsingContextHandleInternal.h"
</span><ins>+#import "WKDataDetectorTypesInternal.h"
</ins><span class="cx"> #import "WKErrorInternal.h"
</span><span class="cx"> #import "WKHistoryDelegatePrivate.h"
</span><span class="cx"> #import "WKLayoutMode.h"
</span><span class="lines">@@ -352,34 +353,6 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#if ENABLE(DATA_DETECTION) && PLATFORM(IOS)
-static WebCore::DataDetectorTypes fromWKDataDetectorTypes(uint64_t types)
-{
- if (static_cast<WKDataDetectorTypes>(types) == WKDataDetectorTypeNone)
- return WebCore::DataDetectorTypeNone;
- if (static_cast<WKDataDetectorTypes>(types) == WKDataDetectorTypeAll)
- return WebCore::DataDetectorTypeAll;
-
- uint32_t value = WebCore::DataDetectorTypeNone;
- if (types & WKDataDetectorTypePhoneNumber)
- value |= WebCore::DataDetectorTypePhoneNumber;
- if (types & WKDataDetectorTypeLink)
- value |= WebCore::DataDetectorTypeLink;
- if (types & WKDataDetectorTypeAddress)
- value |= WebCore::DataDetectorTypeAddress;
- if (types & WKDataDetectorTypeCalendarEvent)
- value |= WebCore::DataDetectorTypeCalendarEvent;
- if (types & WKDataDetectorTypeTrackingNumber)
- value |= WebCore::DataDetectorTypeTrackingNumber;
- if (types & WKDataDetectorTypeFlightNumber)
- value |= WebCore::DataDetectorTypeFlightNumber;
- if (types & WKDataDetectorTypeLookupSuggestion)
- value |= WebCore::DataDetectorTypeLookupSuggestion;
-
- return static_cast<WebCore::DataDetectorTypes>(value);
-}
-#endif
-
</del><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> static uint32_t convertUserInterfaceDirectionPolicy(WKUserInterfaceDirectionPolicy policy)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewConfigurationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h (211353 => 211354)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h        2017-01-29 20:21:08 UTC (rev 211353)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h        2017-01-30 00:26:36 UTC (rev 211354)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="cx">
</span><span class="cx"> #import <Foundation/Foundation.h>
</span><ins>+#import <WebKit/WKDataDetectorTypes.h>
</ins><span class="cx">
</span><span class="cx"> NS_ASSUME_NONNULL_BEGIN
</span><span class="cx">
</span><span class="lines">@@ -51,30 +52,6 @@
</span><span class="cx"> WKSelectionGranularityCharacter,
</span><span class="cx"> } WK_API_AVAILABLE(ios(8.0));
</span><span class="cx">
</span><del>-/*! @enum WKDataDetectorTypes
- @abstract The type of data detected.
- @constant WKDataDetectorTypeNone No detection is performed.
- @constant WKDataDetectorTypePhoneNumber Phone numbers are detected and turned into links.
- @constant WKDataDetectorTypeLink URLs in text are detected and turned into links.
- @constant WKDataDetectorTypeAddress Addresses are detected and turned into links.
- @constant WKDataDetectorTypeCalendarEvent Dates and times that are in the future are detected and turned into links.
- @constant WKDataDetectorTypeAll All of the above data types are turned into links when detected. Choosing this value will
- automatically include any new detection type that is added.
- */
-typedef NS_OPTIONS(NSUInteger, WKDataDetectorTypes) {
- WKDataDetectorTypeNone = 0,
- WKDataDetectorTypePhoneNumber = 1 << 0,
- WKDataDetectorTypeLink = 1 << 1,
- WKDataDetectorTypeAddress = 1 << 2,
- WKDataDetectorTypeCalendarEvent = 1 << 3,
- WKDataDetectorTypeTrackingNumber = 1 << 4,
- WKDataDetectorTypeFlightNumber = 1 << 5,
- WKDataDetectorTypeLookupSuggestion = 1 << 6,
- WKDataDetectorTypeAll = NSUIntegerMax,
-
- WKDataDetectorTypeSpotlightSuggestion WK_API_DEPRECATED_WITH_REPLACEMENT("WKDataDetectorTypeLookupSuggestion", ios(10.0, 10.0)) = WKDataDetectorTypeLookupSuggestion,
-} WK_API_AVAILABLE(ios(10.0));
-
</del><span class="cx"> #else
</span><span class="cx">
</span><span class="cx"> /*! @enum WKUserInterfaceDirectionPolicy
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (211353 => 211354)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2017-01-29 20:21:08 UTC (rev 211353)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2017-01-30 00:26:36 UTC (rev 211354)
</span><span class="lines">@@ -840,6 +840,8 @@
</span><span class="cx">                 37A5E01418BBF93F000A081E /* _WKActivatedElementInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 37A5E01218BBF937000A081E /* _WKActivatedElementInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 37A64E5518F38E3C00EB30F1 /* _WKInputDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 37A64E5418F38E3C00EB30F1 /* _WKInputDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 37A64E5718F38F4600EB30F1 /* _WKFormInputSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 37A64E5618F38F4600EB30F1 /* _WKFormInputSession.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                37A709A71E3EA0FD00CA5969 /* WKDataDetectorTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 37A709A61E3EA0FD00CA5969 /* WKDataDetectorTypes.h */; settings = {ATTRIBUTES = (Public, ); }; };
+                37A709A91E3EA40C00CA5969 /* WKDataDetectorTypesInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 37A709A81E3EA40C00CA5969 /* WKDataDetectorTypesInternal.h */; };
</ins><span class="cx">                 37B0D1841C1E499A00D40D64 /* PluginProcessShim.dylib in Copy Shims */ = {isa = PBXBuildFile; fileRef = 1AC25FB012A48EA700BD2671 /* PluginProcessShim.dylib */; };
</span><span class="cx">                 37B0D1851C1E499A00D40D64 /* SecItemShim.dylib in Copy Shims */ = {isa = PBXBuildFile; fileRef = 510031F61379CACB00C8DFE4 /* SecItemShim.dylib */; };
</span><span class="cx">                 37B0D1861C1E499A00D40D64 /* WebProcessShim.dylib in Copy Shims */ = {isa = PBXBuildFile; fileRef = CDC3830617211799008A2FC3 /* WebProcessShim.dylib */; };
</span><span class="lines">@@ -2950,6 +2952,8 @@
</span><span class="cx">                 37A5E01218BBF937000A081E /* _WKActivatedElementInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKActivatedElementInfo.h; sourceTree = "<group>"; };
</span><span class="cx">                 37A64E5418F38E3C00EB30F1 /* _WKInputDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKInputDelegate.h; sourceTree = "<group>"; };
</span><span class="cx">                 37A64E5618F38F4600EB30F1 /* _WKFormInputSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKFormInputSession.h; sourceTree = "<group>"; };
</span><ins>+                37A709A61E3EA0FD00CA5969 /* WKDataDetectorTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKDataDetectorTypes.h; sourceTree = "<group>"; };
+                37A709A81E3EA40C00CA5969 /* WKDataDetectorTypesInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKDataDetectorTypesInternal.h; sourceTree = "<group>"; };
</ins><span class="cx">                 37B418EB1C9624F20031E63B /* WebContent-OSX.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "WebContent-OSX.entitlements"; sourceTree = "<group>"; };
</span><span class="cx">                 37B47E2C1D64DB76005F4EFF /* objcSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = objcSPI.h; sourceTree = "<group>"; };
</span><span class="cx">                 37B5045119EEF31300CE2CF8 /* WKErrorPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKErrorPrivate.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -5513,6 +5517,8 @@
</span><span class="cx">                                 1AE00D4A182D6EB000087DD7 /* WKBrowsingContextHandle.mm */,
</span><span class="cx">                                 1AE00D4E182D6F5000087DD7 /* WKBrowsingContextHandleInternal.h */,
</span><span class="cx">                                 373D122418A473B30066D9CC /* WKBrowsingContextHandleInternal.h */,
</span><ins>+                                37A709A61E3EA0FD00CA5969 /* WKDataDetectorTypes.h */,
+                                37A709A81E3EA40C00CA5969 /* WKDataDetectorTypesInternal.h */,
</ins><span class="cx">                                 37DFA6FF1810BB92001F4A9F /* WKFoundation.h */,
</span><span class="cx">                                 1A9E32991822E1CC00F5D04C /* WKRemoteObject.h */,
</span><span class="cx">                                 1A9E32981822E1CC00F5D04C /* WKRemoteObject.mm */,
</span><span class="lines">@@ -7662,8 +7668,12 @@
</span><span class="cx">                         buildActionMask = 2147483647;
</span><span class="cx">                         files = (
</span><span class="cx">                                 1A85E4721E303F3700914599 /* WebKit.apinotes in Headers */,
</span><ins>+                                1A6280C51919949F006AD9F9 /* WebKit.h in Headers */,
+                                37C4C08D1814AC5C003688B9 /* WKBackForwardList.h in Headers */,
+                                37C4C08718149C5B003688B9 /* WKBackForwardListItem.h in Headers */,
</ins><span class="cx">                                 37A5E01418BBF93F000A081E /* _WKActivatedElementInfo.h in Headers */,
</span><span class="cx">                                 379A873618BBFA4300588AF2 /* _WKActivatedElementInfoInternal.h in Headers */,
</span><ins>+                                37A709A71E3EA0FD00CA5969 /* WKDataDetectorTypes.h in Headers */,
</ins><span class="cx">                                 99E714C51C124A0400665B3A /* _WKAutomationDelegate.h in Headers */,
</span><span class="cx">                                 990D28AB1C6420C600986977 /* _WKAutomationSession.h in Headers */,
</span><span class="cx">                                 990D28AC1C6420CF00986977 /* _WKAutomationSessionDelegate.h in Headers */,
</span><span class="lines">@@ -8206,7 +8216,6 @@
</span><span class="cx">                                 1CBBE4A119B66C53006B7D81 /* WebInspectorUIMessages.h in Headers */,
</span><span class="cx">                                 A55BA82B1BA38E61007CD33D /* WebInspectorUtilities.h in Headers */,
</span><span class="cx">                                 2DA944A01884E4F000ED86DB /* WebIOSEventFactory.h in Headers */,
</span><del>-                                1A6280C51919949F006AD9F9 /* WebKit.h in Headers */,
</del><span class="cx">                                 BCB63478116BF10600603215 /* WebKit2_C.h in Headers */,
</span><span class="cx">                                 BC9BA5051697C45300E44616 /* WebKit2Initialize.h in Headers */,
</span><span class="cx">                                 1A6280C71919950C006AD9F9 /* WebKitPrivate.h in Headers */,
</span><span class="lines">@@ -8254,6 +8263,7 @@
</span><span class="cx">                                 BC574E631267D080006F0F12 /* WebPopupMenuProxy.h in Headers */,
</span><span class="cx">                                 BC5750971268F3C6006F0F12 /* WebPopupMenuProxyMac.h in Headers */,
</span><span class="cx">                                 BCD597FF112B57BE00EC8C23 /* WebPreferences.h in Headers */,
</span><ins>+                                37A709A91E3EA40C00CA5969 /* WKDataDetectorTypesInternal.h in Headers */,
</ins><span class="cx">                                 7C85FD7C193415A8000177C4 /* WebPreferencesDefinitions.h in Headers */,
</span><span class="cx">                                 7C85FD8019341665000177C4 /* WebPreferencesKeys.h in Headers */,
</span><span class="cx">                                 BCD598AC112B7FDF00EC8C23 /* WebPreferencesStore.h in Headers */,
</span><span class="lines">@@ -8308,9 +8318,7 @@
</span><span class="cx">                                 BC4075F4124FF0270068F20A /* WKArray.h in Headers */,
</span><span class="cx">                                 512F58F612A88A5400629530 /* WKAuthenticationChallenge.h in Headers */,
</span><span class="cx">                                 512F58F812A88A5400629530 /* WKAuthenticationDecisionListener.h in Headers */,
</span><del>-                                37C4C08D1814AC5C003688B9 /* WKBackForwardList.h in Headers */,
</del><span class="cx">                                 37C4C0951814B9E6003688B9 /* WKBackForwardListInternal.h in Headers */,
</span><del>-                                37C4C08718149C5B003688B9 /* WKBackForwardListItem.h in Headers */,
</del><span class="cx">                                 37C4C08918149F23003688B9 /* WKBackForwardListItemInternal.h in Headers */,
</span><span class="cx">                                 2DFF7B6F1DA4CFAF00814614 /* WKBackForwardListItemPrivate.h in Headers */,
</span><span class="cx">                                 BC646C1D11DD399F006455B0 /* WKBackForwardListItemRef.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPICocoaWKWebProcessPlugInRangeHandleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.h (211353 => 211354)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.h        2017-01-29 20:21:08 UTC (rev 211353)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.h        2017-01-30 00:26:36 UTC (rev 211354)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx">
</span><span class="cx"> #import <Foundation/Foundation.h>
</span><span class="cx"> #import <JavaScriptCore/JavaScriptCore.h>
</span><ins>+#import <WebKit/WKDataDetectorTypes.h>
</ins><span class="cx">
</span><span class="cx"> @class WKWebProcessPlugInFrame;
</span><span class="cx">
</span><span class="lines">@@ -40,6 +41,10 @@
</span><span class="cx"> @property (nonatomic, readonly) WKWebProcessPlugInFrame *frame;
</span><span class="cx"> @property (nonatomic, readonly, copy) NSString *text WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
</span><span class="cx">
</span><ins>+#if TARGET_OS_IPHONE
+- (NSArray *)detectDataWithTypes:(WKDataDetectorTypes)types context:(NSDictionary *)context WK_API_AVAILABLE(ios(WK_IOS_TBA));
+#endif
+
</ins><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> #endif // WK_API_ENABLED
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPICocoaWKWebProcessPlugInRangeHandlemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm (211353 => 211354)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm        2017-01-29 20:21:08 UTC (rev 211353)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInRangeHandle.mm        2017-01-30 00:26:36 UTC (rev 211354)
</span><span class="lines">@@ -29,7 +29,10 @@
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="cx">
</span><span class="cx"> #import "InjectedBundleNodeHandle.h"
</span><ins>+#import "WKDataDetectorTypesInternal.h"
</ins><span class="cx"> #import "WKWebProcessPlugInFrameInternal.h"
</span><ins>+#import <WebCore/DataDetection.h>
+#import <WebCore/Range.h>
</ins><span class="cx">
</span><span class="cx"> using namespace WebKit;
</span><span class="cx">
</span><span class="lines">@@ -64,6 +67,14 @@
</span><span class="cx"> return _rangeHandle->text();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if TARGET_OS_IPHONE
+- (NSArray *)detectDataWithTypes:(WKDataDetectorTypes)types context:(NSDictionary *)context WK_API_AVAILABLE(ios(WK_IOS_TBA))
+{
+ RefPtr<WebCore::Range> coreRange = _rangeHandle->coreRange();
+ return WebCore::DataDetection::detectContentInRange(coreRange, fromWKDataDetectorTypes(types), context);
+}
+#endif
+
</ins><span class="cx"> - (InjectedBundleRangeHandle&)_rangeHandle
</span><span class="cx"> {
</span><span class="cx"> return *_rangeHandle;
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (211353 => 211354)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2017-01-29 20:21:08 UTC (rev 211353)
+++ trunk/Tools/ChangeLog        2017-01-30 00:26:36 UTC (rev 211354)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2017-01-29 Dan Bernstein <mitz@apple.com>
+
+ [iOS] Expose WebCore::DataDetection::detectContentInRange WKWebProcessPlugInRangeHandle
+ https://bugs.webkit.org/show_bug.cgi?id=167565
+
+ Reviewed by Sam Weinig.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit2Cocoa/BundleRangeHandle.mm: Added.
+ (-[BundleRangeHandleRemoteObject textFromBodyRange:]):
+ (-[BundleRangeHandleRemoteObject bodyInnerHTMLAfterDetectingData:]):
+ (TEST):
+ * TestWebKitAPI/Tests/WebKit2Cocoa/BundleRangeHandlePlugIn.mm: Added.
+ (-[BundleRangeHandlePlugIn webProcessPlugIn:didCreateBrowserContextController:]):
+ (-[BundleRangeHandlePlugIn webProcessPlugInBrowserContextController:didFinishDocumentLoadForFrame:]):
+ * TestWebKitAPI/Tests/WebKit2Cocoa/BundleRangeHandleProtocol.h: Added.
+
</ins><span class="cx"> 2017-01-28 Yoav Weiss <yoav@yoav.ws>
</span><span class="cx">
</span><span class="cx"> Add Link Preload as an off-by-default experimental feature menu item.
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (211353 => 211354)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2017-01-29 20:21:08 UTC (rev 211353)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2017-01-30 00:26:36 UTC (rev 211354)
</span><span class="lines">@@ -102,6 +102,8 @@
</span><span class="cx">                 378E64791632707400B6C676 /* link-with-title.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 378E647816326FDF00B6C676 /* link-with-title.html */; };
</span><span class="cx">                 379028B914FAC24C007E6B43 /* acceptsFirstMouse.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 379028B814FABE49007E6B43 /* acceptsFirstMouse.html */; };
</span><span class="cx">                 37A22AA71DCAA27200AFBFC4 /* ObservedRenderingProgressEventsAfterCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37A22AA51DCAA27200AFBFC4 /* ObservedRenderingProgressEventsAfterCrash.mm */; };
</span><ins>+                37A709AE1E3EA8B000CA5969 /* BundleRangeHandle.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37A709AD1E3EA8B000CA5969 /* BundleRangeHandle.mm */; };
+                37A709AF1E3EA97E00CA5969 /* BundleRangeHandlePlugIn.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37A709AA1E3EA79000CA5969 /* BundleRangeHandlePlugIn.mm */; };
</ins><span class="cx">                 37B47E301D64E7CA005F4EFF /* WKObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37B47E2E1D64E7CA005F4EFF /* WKObject.mm */; };
</span><span class="cx">                 37BCA61C1B596BA9002012CA /* ShouldOpenExternalURLsInNewWindowActions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37BCA61B1B596BA9002012CA /* ShouldOpenExternalURLsInNewWindowActions.mm */; };
</span><span class="cx">                 37D36ED71AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37D36ED61AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm */; };
</span><span class="lines">@@ -924,6 +926,9 @@
</span><span class="cx">                 3799AD3914120A43005EB0C6 /* StringByEvaluatingJavaScriptFromString.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringByEvaluatingJavaScriptFromString.mm; sourceTree = "<group>"; };
</span><span class="cx">                 37A22AA51DCAA27200AFBFC4 /* ObservedRenderingProgressEventsAfterCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ObservedRenderingProgressEventsAfterCrash.mm; sourceTree = "<group>"; };
</span><span class="cx">                 37A6895D148A9B50005100FA /* SubresourceErrorCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SubresourceErrorCrash.mm; sourceTree = "<group>"; };
</span><ins>+                37A709AA1E3EA79000CA5969 /* BundleRangeHandlePlugIn.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BundleRangeHandlePlugIn.mm; sourceTree = "<group>"; };
+                37A709AC1E3EA7E800CA5969 /* BundleRangeHandleProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BundleRangeHandleProtocol.h; sourceTree = "<group>"; };
+                37A709AD1E3EA8B000CA5969 /* BundleRangeHandle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BundleRangeHandle.mm; sourceTree = "<group>"; };
</ins><span class="cx">                 37B47E2E1D64E7CA005F4EFF /* WKObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKObject.mm; sourceTree = "<group>"; };
</span><span class="cx">                 37BCA61B1B596BA9002012CA /* ShouldOpenExternalURLsInNewWindowActions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ShouldOpenExternalURLsInNewWindowActions.mm; sourceTree = "<group>"; };
</span><span class="cx">                 37C784DE197C8F2E0010A496 /* RenderedImageFromDOMNode.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RenderedImageFromDOMNode.mm; sourceTree = "<group>"; };
</span><span class="lines">@@ -1502,6 +1507,9 @@
</span><span class="cx">                                 374B7A621DF3734C00ACCB6C /* BundleEditingDelegateProtocol.h */,
</span><span class="cx">                                 A13EBBAC1B87436F00097110 /* BundleParameters.mm */,
</span><span class="cx">                                 A13EBBAE1B87436F00097110 /* BundleParametersPlugIn.mm */,
</span><ins>+                                37A709AD1E3EA8B000CA5969 /* BundleRangeHandle.mm */,
+                                37A709AA1E3EA79000CA5969 /* BundleRangeHandlePlugIn.mm */,
+                                37A709AC1E3EA7E800CA5969 /* BundleRangeHandleProtocol.h */,
</ins><span class="cx">                                 1C2B817E1C891E4200A5529F /* CancelFontSubresource.mm */,
</span><span class="cx">                                 1C2B81811C891EFA00A5529F /* CancelFontSubresourcePlugIn.mm */,
</span><span class="cx">                                 1AAD19F51C7CE20300831E47 /* Coding.mm */,
</span><span class="lines">@@ -1524,14 +1532,15 @@
</span><span class="cx">                                 51BCEE491C84F4AF0042C82E /* IndexedDBMultiProcess.mm */,
</span><span class="cx">                                 51B1EE8D1C80F5880064FB98 /* IndexedDBPersistence.mm */,
</span><span class="cx">                                 37D36ED61AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm */,
</span><ins>+                                A125478D1DB18B9400358564 /* LoadDataWithNilMIMEType.mm */,
</ins><span class="cx">                                 57901FAC1CAF12C200ED64F9 /* LoadInvalidURLRequest.mm */,
</span><span class="cx">                                 51E6A8921D2F1BEC00C004B6 /* LocalStorageClear.mm */,
</span><span class="cx">                                 46C519D81D355A7300DAA51A /* LocalStorageNullEntries.mm */,
</span><span class="cx">                                 7A6A2C6F1DCCF87B00C0D085 /* LocalStorageQuirkTest.mm */,
</span><span class="cx">                                 51CD1C6A1B38CE3600142CA5 /* ModalAlerts.mm */,
</span><del>-                                A10F047C1E3AD29C00C95E19 /* NSFileManagerExtras.mm */,
</del><span class="cx">                                 1ABC3DED1899BE6D004F0626 /* Navigation.mm */,
</span><span class="cx">                                 2ECFF5541D9B12F800B55394 /* NowPlayingControlsTests.mm */,
</span><ins>+                                A10F047C1E3AD29C00C95E19 /* NSFileManagerExtras.mm */,
</ins><span class="cx">                                 37A22AA51DCAA27200AFBFC4 /* ObservedRenderingProgressEventsAfterCrash.mm */,
</span><span class="cx">                                 CEA6CF2219CCF5BD0064F5A7 /* OpenAndCloseWindow.mm */,
</span><span class="cx">                                 C95501BE19AD2FAF0049BE3E /* Preferences.mm */,
</span><span class="lines">@@ -1562,7 +1571,6 @@
</span><span class="cx">                                 7C417F311D19E14800B8EF53 /* WKWebViewDefaultNavigationDelegate.mm */,
</span><span class="cx">                                 0F3B94A51A77266C00DE3272 /* WKWebViewEvaluateJavaScript.mm */,
</span><span class="cx">                                 9984FACA1CFFAEEE008D198C /* WKWebViewTextInput.mm */,
</span><del>-                                A125478D1DB18B9400358564 /* LoadDataWithNilMIMEType.mm */,
</del><span class="cx">                         );
</span><span class="cx">                         name = "WebKit2 Cocoa";
</span><span class="cx">                         path = WebKit2Cocoa;
</span><span class="lines">@@ -2605,6 +2613,7 @@
</span><span class="cx">                                 2EFF06D41D8AEDBB0004BB30 /* TestWKWebView.mm in Sources */,
</span><span class="cx">                                 7C83E0B81D0A64BD00FEBCF3 /* InjectedBundleMakeAllShadowRootsOpen.cpp in Sources */,
</span><span class="cx">                                 7CCE7EC31A411A7E00447C4C /* InspectorBar.mm in Sources */,
</span><ins>+                                37A709AE1E3EA8B000CA5969 /* BundleRangeHandle.mm in Sources */,
</ins><span class="cx">                                 7CCE7EDA1A411A8700447C4C /* InstanceMethodSwizzler.mm in Sources */,
</span><span class="cx">                                 5C726D6F1D3EE06E00C5E1A1 /* InstanceMethodSwizzler.mm in Sources */,
</span><span class="cx">                                 7CCE7EAD1A411A3400447C4C /* JavaScriptTest.cpp in Sources */,
</span><span class="lines">@@ -2784,6 +2793,7 @@
</span><span class="cx">                                 A13EBBAB1B87434600097110 /* PlatformUtilitiesCocoa.mm in Sources */,
</span><span class="cx">                                 1A4F81CF1BDFFD53004E672E /* RemoteObjectRegistryPlugIn.mm in Sources */,
</span><span class="cx">                                 7C882E091C80C630006BF731 /* UserContentWorldPlugIn.mm in Sources */,
</span><ins>+                                37A709AF1E3EA97E00CA5969 /* BundleRangeHandlePlugIn.mm in Sources */,
</ins><span class="cx">                                 374B7A611DF371CF00ACCB6C /* BundleEditingDelegatePlugIn.mm in Sources */,
</span><span class="cx">                                 7C83E03D1D0A60D600FEBCF3 /* UtilitiesCocoa.mm in Sources */,
</span><span class="cx">                                 A13EBBAA1B87428D00097110 /* WebProcessPlugIn.mm in Sources */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2CocoaBundleRangeHandlemm"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleRangeHandle.mm (0 => 211354)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleRangeHandle.mm         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleRangeHandle.mm        2017-01-30 00:26:36 UTC (rev 211354)
</span><span class="lines">@@ -0,0 +1,81 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import <WebKit/WKFoundation.h>
+
+#if WK_API_ENABLED
+
+#import "BundleRangeHandleProtocol.h"
+#import "PlatformUtilities.h"
+#import "Test.h"
+#import "TestNavigationDelegate.h"
+#import "WKWebViewConfigurationExtras.h"
+#import <WebKit/WKProcessPoolPrivate.h>
+#import <WebKit/WKWebViewPrivate.h>
+#import <WebKit/_WKRemoteObjectInterface.h>
+#import <WebKit/_WKRemoteObjectRegistry.h>
+#import <wtf/RetainPtr.h>
+
+static bool didGetTextFromBodyRange;
+static bool didGetBodyInnerHTMLAfterDetectingData;
+
+@interface BundleRangeHandleRemoteObject : NSObject <BundleRangeHandleProtocol>
+@end
+
+@implementation BundleRangeHandleRemoteObject
+
+- (void)textFromBodyRange:(NSString *)text
+{
+ didGetTextFromBodyRange = true;
+ EXPECT_WK_STREQ("Visit webkit.org or email webkit-dev@lists.webkit.org.", text);
+}
+
+- (void)bodyInnerHTMLAfterDetectingData:(NSString *)text
+{
+ didGetBodyInnerHTMLAfterDetectingData = true;
+ EXPECT_WK_STREQ("Visit <a href=\"http://webkit.org\" dir=\"ltr\" x-apple-data-detectors=\"true\" x-apple-data-detectors-type=\"link\" x-apple-data-detectors-result=\"0\">webkit.org</a> <em> or</em> email <a href=\"mailto:webkit-dev@lists.webkit.org\" dir=\"ltr\" x-apple-data-detectors=\"true\" x-apple-data-detectors-type=\"link\" x-apple-data-detectors-result=\"1\">webkit-dev@lists.webkit.org</a>.", text);
+}
+
+@end
+
+TEST(WebKit2, WKWebProcessPlugInRangeHandle)
+{
+ RetainPtr<WKWebViewConfiguration> configuration = retainPtr([WKWebViewConfiguration testwebkitapi_configurationWithTestPlugInClassName:@"BundleRangeHandlePlugIn"]);
+ RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
+
+ RetainPtr<BundleRangeHandleRemoteObject> object = adoptNS([[BundleRangeHandleRemoteObject alloc] init]);
+ _WKRemoteObjectInterface *interface = [_WKRemoteObjectInterface remoteObjectInterfaceWithProtocol:@protocol(BundleRangeHandleProtocol)];
+ [[webView _remoteObjectRegistry] registerExportedObject:object.get() interface:interface];
+
+ [webView loadHTMLString:@"Visit webkit.org <em> or</em> email webkit-dev@lists.webkit.org." baseURL:nil];
+
+ TestWebKitAPI::Util::run(&didGetTextFromBodyRange);
+#if PLATFORM(IOS)
+ TestWebKitAPI::Util::run(&didGetBodyInnerHTMLAfterDetectingData);
+#endif
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2CocoaBundleRangeHandlePlugInmm"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleRangeHandlePlugIn.mm (0 => 211354)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleRangeHandlePlugIn.mm         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleRangeHandlePlugIn.mm        2017-01-30 00:26:36 UTC (rev 211354)
</span><span class="lines">@@ -0,0 +1,79 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+
+#if WK_API_ENABLED
+
+#import "BundleRangeHandleProtocol.h"
+#import "PlatformUtilities.h"
+#import <WebKit/WKWebProcessPlugIn.h>
+#import <WebKit/WKWebProcessPlugInBrowserContextControllerPrivate.h>
+#import <WebKit/WKWebProcessPlugInFrame.h>
+#import <WebKit/WKWebProcessPlugInLoadDelegate.h>
+#import <WebKit/WKWebProcessPlugInRangeHandle.h>
+#import <WebKit/WKWebProcessPlugInScriptWorld.h>
+#import <WebKit/_WKRemoteObjectInterface.h>
+#import <WebKit/_WKRemoteObjectRegistry.h>
+#import <wtf/RetainPtr.h>
+
+@interface BundleRangeHandlePlugIn : NSObject <WKWebProcessPlugIn, WKWebProcessPlugInLoadDelegate>
+@end
+
+@implementation BundleRangeHandlePlugIn {
+ RetainPtr<WKWebProcessPlugInBrowserContextController> _browserContextController;
+ RetainPtr<WKWebProcessPlugInController> _plugInController;
+ RetainPtr<id <BundleRangeHandleProtocol>> _remoteObject;
+}
+
+- (void)webProcessPlugIn:(WKWebProcessPlugInController *)plugInController didCreateBrowserContextController:(WKWebProcessPlugInBrowserContextController *)browserContextController
+{
+ ASSERT(!_browserContextController);
+ ASSERT(!_plugInController);
+ _browserContextController = browserContextController;
+ _plugInController = plugInController;
+
+ _WKRemoteObjectInterface *interface = [_WKRemoteObjectInterface remoteObjectInterfaceWithProtocol:@protocol(BundleRangeHandleProtocol)];
+ _remoteObject = [browserContextController._remoteObjectRegistry remoteObjectProxyWithInterface:interface];
+
+ [_browserContextController setLoadDelegate:self];
+}
+
+- (void)webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController *)controller didFinishDocumentLoadForFrame:(WKWebProcessPlugInFrame *)frame
+{
+ auto context = [frame jsContextForWorld:[WKWebProcessPlugInScriptWorld normalWorld]];
+ auto jsRange = [context evaluateScript:@"let range = document.createRange(); range.selectNodeContents(document.body); range;"];
+ auto rangeHandle = [WKWebProcessPlugInRangeHandle rangeHandleWithJSValue:jsRange inContext:context];
+
+ [_remoteObject textFromBodyRange:rangeHandle.text];
+#if PLATFORM(IOS)
+ [rangeHandle detectDataWithTypes:WKDataDetectorTypeAll context:@{ }];
+ [_remoteObject bodyInnerHTMLAfterDetectingData:[[context evaluateScript:@"document.body.innerHTML"] toString]];
+#endif
+}
+
+@end
+
+#endif // WK_API_ENABLED
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2CocoaBundleRangeHandleProtocolh"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleRangeHandleProtocol.h (0 => 211354)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleRangeHandleProtocol.h         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleRangeHandleProtocol.h        2017-01-30 00:26:36 UTC (rev 211354)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebKit/WKFoundation.h>
+
+#if WK_API_ENABLED
+
+@protocol BundleRangeHandleProtocol <NSObject>
+- (void)textFromBodyRange:(NSString *)text;
+- (void)bodyInnerHTMLAfterDetectingData:(NSString *)text;
+@end
+
+#endif
</ins></span></pre>
</div>
</div>
</body>
</html>