<!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>[192486] trunk/Source/WebKit2</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/192486">192486</a></dd>
<dt>Author</dt> <dd>bdakin@apple.com</dd>
<dt>Date</dt> <dd>2015-11-16 14:38:20 -0800 (Mon, 16 Nov 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add SPI for handling inline link navigation for peek/pop
https://bugs.webkit.org/show_bug.cgi?id=151270
-and corresponding-
rdar://problem/22233739

Reviewed by Darin Adler.

This patch adds three new SPI methods. If a client wants to disable previews 
entirely for the given element, they should return NO in 
shouldPreviewElement:. Returning NO in shouldPreviewElement will prevent the 
other methods from being invoked. The client can provide a custom preview by 
returning their own UIViewController from 
previewingViewControllerForElement:defaultActions:. Returning nil will result 
in the default preview behavior for that element. This will allow clients to 
implement this method to handle http link navigation inline, but still opt 
into UIKit’s built-in DataDetectors behaviors for DD links once we start 
supporting DD links in WK2. 
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:

Added linkURL to _WKElementInfo. linkURL will be nil for elements that are 
not links.
* UIProcess/API/Cocoa/_WKElementInfo.h:
* UIProcess/API/Cocoa/_WKElementInfo.mm:
(-[_WKElementInfo copyWithZone:]):
(-[_WKElementInfo linkURL]):
* UIProcess/API/Cocoa/_WKElementInfoInternal.h: Added.

_WKPreviewingElementInfo inherits from _WKElementInfo. Added a constructor.
* UIProcess/API/Cocoa/_WKPreviewElementInfo.h: Added.
* UIProcess/API/Cocoa/_WKPreviewElementInfo.mm: Added.
(-[_WKPreviewElementInfo _initWithLinkURL:]):
* UIProcess/API/Cocoa/_WKPreviewElementInfoInternal.h: Added.

Invoke shouldPreviewElement:.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):

Invoke previewingViewControllerForElement: for all potentially preview-able 
elements that have a default implementations, which will be limited to links 
at this time.
(-[WKContentView _presentedViewControllerForPreviewItemController:]):

Invoke commitPreviewingViewController:
(-[WKContentView _previewItemController:commitPreview:]):
* WebKit2.xcodeproj/project.pbxproj:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKUIDelegatePrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoa_WKElementInfoh">trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKElementInfo.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoa_WKElementInfomm">trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKElementInfo.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewInteractionmm">trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoa_WKElementInfoInternalh">trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKElementInfoInternal.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoa_WKPreviewElementInfoh">trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKPreviewElementInfo.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoa_WKPreviewElementInfomm">trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKPreviewElementInfo.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoa_WKPreviewElementInfoInternalh">trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKPreviewElementInfoInternal.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (192485 => 192486)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-11-16 22:10:56 UTC (rev 192485)
+++ trunk/Source/WebKit2/ChangeLog        2015-11-16 22:38:20 UTC (rev 192486)
</span><span class="lines">@@ -1,3 +1,51 @@
</span><ins>+2015-11-16  Beth Dakin  &lt;bdakin@apple.com&gt;
+
+        Add SPI for handling inline link navigation for peek/pop
+        https://bugs.webkit.org/show_bug.cgi?id=151270
+        -and corresponding-
+        rdar://problem/22233739
+
+        Reviewed by Darin Adler.
+
+        This patch adds three new SPI methods. If a client wants to disable previews 
+        entirely for the given element, they should return NO in 
+        shouldPreviewElement:. Returning NO in shouldPreviewElement will prevent the 
+        other methods from being invoked. The client can provide a custom preview by 
+        returning their own UIViewController from 
+        previewingViewControllerForElement:defaultActions:. Returning nil will result 
+        in the default preview behavior for that element. This will allow clients to 
+        implement this method to handle http link navigation inline, but still opt 
+        into UIKit’s built-in DataDetectors behaviors for DD links once we start 
+        supporting DD links in WK2. 
+        * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
+
+        Added linkURL to _WKElementInfo. linkURL will be nil for elements that are 
+        not links.
+        * UIProcess/API/Cocoa/_WKElementInfo.h:
+        * UIProcess/API/Cocoa/_WKElementInfo.mm:
+        (-[_WKElementInfo copyWithZone:]):
+        (-[_WKElementInfo linkURL]):
+        * UIProcess/API/Cocoa/_WKElementInfoInternal.h: Added.
+
+        _WKPreviewingElementInfo inherits from _WKElementInfo. Added a constructor.
+        * UIProcess/API/Cocoa/_WKPreviewElementInfo.h: Added.
+        * UIProcess/API/Cocoa/_WKPreviewElementInfo.mm: Added.
+        (-[_WKPreviewElementInfo _initWithLinkURL:]):
+        * UIProcess/API/Cocoa/_WKPreviewElementInfoInternal.h: Added.
+
+        Invoke shouldPreviewElement:.
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
+
+        Invoke previewingViewControllerForElement: for all potentially preview-able 
+        elements that have a default implementations, which will be limited to links 
+        at this time.
+        (-[WKContentView _presentedViewControllerForPreviewItemController:]):
+
+        Invoke commitPreviewingViewController:
+        (-[WKContentView _previewItemController:commitPreview:]):
+        * WebKit2.xcodeproj/project.pbxproj:
+
</ins><span class="cx"> 2015-11-16  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add identifier strings for a bunch of context menu items
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKUIDelegatePrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h (192485 => 192486)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h        2015-11-16 22:10:56 UTC (rev 192485)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h        2015-11-16 22:38:20 UTC (rev 192486)
</span><span class="lines">@@ -30,12 +30,14 @@
</span><span class="cx"> #import &lt;WebKit/WKSecurityOrigin.h&gt;
</span><span class="cx"> #import &lt;WebKit/_WKActivatedElementInfo.h&gt;
</span><span class="cx"> 
</span><ins>+@class UIPreviewActionItem;
</ins><span class="cx"> @class UIScrollView;
</span><span class="cx"> @class UIViewController;
</span><span class="cx"> @class _WKContextMenuElementInfo;
</span><span class="cx"> @class _WKActivatedElementInfo;
</span><span class="cx"> @class _WKElementAction;
</span><span class="cx"> @class _WKFrameHandle;
</span><ins>+@class _WKPreviewElementInfo;
</ins><span class="cx"> 
</span><span class="cx"> @protocol WKUIDelegatePrivate &lt;WKUIDelegate&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -72,6 +74,15 @@
</span><span class="cx"> - (UIEdgeInsets)_webView:(WKWebView *)webView finalObscuredInsetsForScrollView:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset WK_AVAILABLE(NA, 9_0);
</span><span class="cx"> - (UIViewController *)_webView:(WKWebView *)webView previewViewControllerForURL:(NSURL *)url defaultActions:(WK_ARRAY(_WKElementAction *) *)actions elementInfo:(_WKActivatedElementInfo *)elementInfo WK_AVAILABLE(NA, 9_0);
</span><span class="cx"> - (UIViewController *)_webView:(WKWebView *)webView previewViewControllerForAnimatedImageAtURL:(NSURL *)url defaultActions:(WK_ARRAY(_WKElementAction *) *)actions elementInfo:(_WKActivatedElementInfo *)elementInfo imageSize:(CGSize)imageSize WK_AVAILABLE(NA, 9_0);
</span><ins>+
+// If a client wants to disable previews entirely for the given element, they should return NO in
+// shouldPreviewElement. Returning NO in shouldPreviewElement will prevent the other methods from being invoked.
+// The client can provide a custom preview by returning their own UIViewController from
+// previewingViewControllerForElement:defaultActions:. Returning nil will result in the default preview behavior
+// for that element.
+- (BOOL)_webView:(WKWebView *)webView shouldPreviewElement:(_WKPreviewElementInfo *)elementInfo;
+- (UIViewController *)_webView:(WKWebView *)webView previewingViewControllerForElement:(_WKPreviewElementInfo *)elementInfo defaultActions:(NSArray&lt;UIPreviewActionItem *&gt; *)previewActions WK_AVAILABLE(NA, WK_IOS_TBA);
+- (void)_webView:(WKWebView *)webView commitPreviewingViewController:(UIViewController *)previewingViewController WK_AVAILABLE(NA, WK_IOS_TBA);
</ins><span class="cx"> #else
</span><span class="cx"> - (NSMenu *)_webView:(WKWebView *)webView contextMenu:(NSMenu *)menu forElement:(_WKContextMenuElementInfo *)element WK_AVAILABLE(WK_MAC_TBA, NA);
</span><span class="cx"> - (NSMenu *)_webView:(WKWebView *)webView contextMenu:(NSMenu *)menu forElement:(_WKContextMenuElementInfo *)element userInfo:(id &lt;NSSecureCoding&gt;)userInfo WK_AVAILABLE(WK_MAC_TBA, NA);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoa_WKElementInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKElementInfo.h (192485 => 192486)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKElementInfo.h        2015-11-16 22:10:56 UTC (rev 192485)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKElementInfo.h        2015-11-16 22:38:20 UTC (rev 192486)
</span><span class="lines">@@ -32,6 +32,8 @@
</span><span class="cx"> WK_CLASS_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA)
</span><span class="cx"> @interface _WKElementInfo : NSObject &lt;NSCopying&gt;
</span><span class="cx"> 
</span><ins>+@property (nonatomic, readonly) NSURL *linkURL;
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> WK_ASSUME_NONNULL_END
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoa_WKElementInfomm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKElementInfo.mm (192485 => 192486)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKElementInfo.mm        2015-11-16 22:10:56 UTC (rev 192485)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKElementInfo.mm        2015-11-16 22:38:20 UTC (rev 192486)
</span><span class="lines">@@ -23,8 +23,8 @@
</span><span class="cx">  * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#include &quot;config.h&quot;
-#include &quot;_WKElementInfo.h&quot;
</del><ins>+#import &quot;config.h&quot;
+#import &quot;_WKElementInfoInternal.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="cx"> 
</span><span class="lines">@@ -35,6 +35,11 @@
</span><span class="cx">     return [self retain];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (NSURL *)linkURL
+{
+    return _linkURL.get();
+}
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoa_WKElementInfoInternalh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKElementInfoInternal.h (0 => 192486)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKElementInfoInternal.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKElementInfoInternal.h        2015-11-16 22:38:20 UTC (rev 192486)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+/*
+ * Copyright (C) 2015 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 &quot;_WKElementInfo.h&quot;
+
+#import &lt;wtf/RetainPtr.h&gt;
+
+#if WK_API_ENABLED
+
+@interface _WKElementInfo () {
+@package
+    RetainPtr&lt;NSURL&gt; _linkURL;
+}
+
+@end
+
+#endif // WK_API_ENABLED
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoa_WKPreviewElementInfoh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKPreviewElementInfo.h (0 => 192486)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKPreviewElementInfo.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKPreviewElementInfo.h        2015-11-16 22:38:20 UTC (rev 192486)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+/*
+ * Copyright (C) 2015 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 &lt;WebKit/WKFoundation.h&gt;
+
+#if WK_API_ENABLED &amp;&amp; TARGET_OS_IPHONE
+
+#import &lt;WebKit/_WKElementInfo.h&gt;
+
+WK_ASSUME_NONNULL_BEGIN
+
+WK_CLASS_AVAILABLE(NA, WK_IOS_TBA)
+@interface _WKPreviewElementInfo : _WKElementInfo
+
+@end
+
+WK_ASSUME_NONNULL_END
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoa_WKPreviewElementInfomm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKPreviewElementInfo.mm (0 => 192486)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKPreviewElementInfo.mm                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKPreviewElementInfo.mm        2015-11-16 22:38:20 UTC (rev 192486)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+/*
+ * Copyright (C) 2015 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 &quot;config.h&quot;
+#import &quot;_WKPreviewElementInfoInternal.h&quot;
+
+#import &quot;_WKElementInfoInternal.h&quot;
+#import &lt;wtf/RetainPtr.h&gt;
+
+#if WK_API_ENABLED &amp;&amp; PLATFORM(IOS)
+
+@implementation _WKPreviewElementInfo
+
+- (instancetype)_initWithLinkURL:(NSURL *)url
+{
+    if (!(self = [super init]))
+        return nil;
+
+    _linkURL = adoptNS([url copy]);
+
+    return self;
+}
+
+@end
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoa_WKPreviewElementInfoInternalh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKPreviewElementInfoInternal.h (0 => 192486)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKPreviewElementInfoInternal.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKPreviewElementInfoInternal.h        2015-11-16 22:38:20 UTC (rev 192486)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+/*
+ * Copyright (C) 2015 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 &quot;_WKPreviewElementInfo.h&quot;
+
+#if WK_API_ENABLED &amp;&amp; TARGET_OS_IPHONE
+
+@interface _WKPreviewElementInfo ()
+
+- (instancetype)_initWithLinkURL:(NSURL *)url;
+
+@end
+
+#endif // WK_API_ENABLED
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewInteractionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (192485 => 192486)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm        2015-11-16 22:10:56 UTC (rev 192485)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm        2015-11-16 22:38:20 UTC (rev 192486)
</span><span class="lines">@@ -56,6 +56,7 @@
</span><span class="cx"> #import &quot;_WKFocusedElementInfo.h&quot;
</span><span class="cx"> #import &quot;_WKFormInputSession.h&quot;
</span><span class="cx"> #import &quot;_WKInputDelegate.h&quot;
</span><ins>+#import &quot;_WKPreviewElementInfoInternal.h&quot;
</ins><span class="cx"> #import &lt;CoreText/CTFont.h&gt;
</span><span class="cx"> #import &lt;CoreText/CTFontDescriptor.h&gt;
</span><span class="cx"> #import &lt;MobileCoreServices/UTCoreTypes.h&gt;
</span><span class="lines">@@ -3478,11 +3479,16 @@
</span><span class="cx">     
</span><span class="cx">     String absoluteLinkURL = _positionInformation.url;
</span><span class="cx">     if (_positionInformation.isLink) {
</span><ins>+        NSURL *targetURL = [NSURL _web_URLWithWTFString:_positionInformation.url];
+        id &lt;WKUIDelegatePrivate&gt; uiDelegate = static_cast&lt;id &lt;WKUIDelegatePrivate&gt;&gt;([_webView UIDelegate]);
+        if ([uiDelegate respondsToSelector:@selector(_webView:shouldPreviewElement:)]) {
+            auto previewElementInfo = adoptNS([[_WKPreviewElementInfo alloc] _initWithLinkURL:targetURL]);
+            return [uiDelegate _webView:_webView shouldPreviewElement:previewElementInfo.get()];
+        }
</ins><span class="cx">         if (absoluteLinkURL.isEmpty())
</span><span class="cx">             return NO;
</span><span class="cx">         if (WebCore::protocolIsInHTTPFamily(absoluteLinkURL))
</span><span class="cx">             return YES;
</span><del>-        NSURL *targetURL = [NSURL _web_URLWithWTFString:_positionInformation.url];
</del><span class="cx">         if ([[getDDDetectionControllerClass() tapAndHoldSchemes] containsObject:[targetURL scheme]])
</span><span class="cx">             return YES;
</span><span class="cx">         return NO;
</span><span class="lines">@@ -3561,6 +3567,12 @@
</span><span class="cx">         RetainPtr&lt;_WKActivatedElementInfo&gt; elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeLink URL:targetURL location:_positionInformation.point title:_positionInformation.title rect:_positionInformation.bounds image:_positionInformation.image.get()]);
</span><span class="cx"> 
</span><span class="cx">         RetainPtr&lt;NSArray&gt; actions = [_actionSheetAssistant defaultActionsForLinkSheet:elementInfo.get()];
</span><ins>+        if ([uiDelegate respondsToSelector:@selector(_webView:previewingViewControllerForElement:defaultActions:)]) {
+            auto previewElementInfo = adoptNS([[_WKPreviewElementInfo alloc] _initWithLinkURL:targetURL]);
+            if (UIViewController *controller = [uiDelegate _webView:_webView previewingViewControllerForElement:previewElementInfo.get() defaultActions:actions.get()])
+                return controller;
+        }
+
</ins><span class="cx">         if ([uiDelegate respondsToSelector:@selector(_webView:previewViewControllerForURL:defaultActions:elementInfo:)])
</span><span class="cx">             return [uiDelegate _webView:_webView previewViewControllerForURL:targetURL defaultActions:actions.get() elementInfo:elementInfo.get()];
</span><span class="cx"> 
</span><span class="lines">@@ -3598,6 +3610,11 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if ([uiDelegate respondsToSelector:@selector(_webView:commitPreviewingViewController:)]) {
+        [uiDelegate _webView:_webView commitPreviewingViewController:viewController];
+        return;
+    }
+
</ins><span class="cx">     if ([uiDelegate respondsToSelector:@selector(_webView:commitPreviewedViewController:)]) {
</span><span class="cx">         [uiDelegate _webView:_webView commitPreviewedViewController:viewController];
</span><span class="cx">         return;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (192485 => 192486)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2015-11-16 22:10:56 UTC (rev 192485)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2015-11-16 22:38:20 UTC (rev 192486)
</span><span class="lines">@@ -1230,8 +1230,12 @@
</span><span class="cx">                 935EEBA2127761D0003322B8 /* InjectedBundleBackForwardList.h in Headers */ = {isa = PBXBuildFile; fileRef = 935EEB901277615D003322B8 /* InjectedBundleBackForwardList.h */; };
</span><span class="cx">                 935EEBA3127761D3003322B8 /* InjectedBundleBackForwardListItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 935EEB911277615D003322B8 /* InjectedBundleBackForwardListItem.cpp */; };
</span><span class="cx">                 935EEBA4127761D6003322B8 /* InjectedBundleBackForwardListItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 935EEB921277615D003322B8 /* InjectedBundleBackForwardListItem.h */; };
</span><ins>+                9391074F1BF6BC65008C17AD /* _WKPreviewElementInfoInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9391074E1BF6BC65008C17AD /* _WKPreviewElementInfoInternal.h */; };
</ins><span class="cx">                 9391F2CA121B679A00EBF7E8 /* WebFrameNetworkingContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9391F284121B38F500EBF7E8 /* WebFrameNetworkingContext.mm */; };
</span><span class="cx">                 9391F2CB121B67AD00EBF7E8 /* WebFrameNetworkingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 9391F283121B38F500EBF7E8 /* WebFrameNetworkingContext.h */; };
</span><ins>+                9395E68A1BF2C33200F49BCE /* _WKPreviewElementInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 9395E6891BF2C33200F49BCE /* _WKPreviewElementInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                9395E68C1BF2C35200F49BCE /* _WKPreviewElementInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9395E68B1BF2C35200F49BCE /* _WKPreviewElementInfo.mm */; };
+                9395E68E1BF410FD00F49BCE /* _WKElementInfoInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9395E68D1BF410FD00F49BCE /* _WKElementInfoInternal.h */; };
</ins><span class="cx">                 939AE7661316E99C00AE06A6 /* WebCoreArgumentCoders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 939AE7651316E99C00AE06A6 /* WebCoreArgumentCoders.cpp */; };
</span><span class="cx">                 939F401C19FB0BBC002B2B42 /* WKActionMenuTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 939F401B19FB0BBC002B2B42 /* WKActionMenuTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 93A88B301BC6E99700ABA5C2 /* WebHitTestResultData.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93A88B2E1BC6E98F00ABA5C2 /* WebHitTestResultData.mm */; };
</span><span class="lines">@@ -3475,8 +3479,12 @@
</span><span class="cx">                 935EEB961277616D003322B8 /* WKBundleBackForwardList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleBackForwardList.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 935EEB971277616D003322B8 /* WKBundleBackForwardListItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleBackForwardListItem.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 935EEB981277616D003322B8 /* WKBundleBackForwardListItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleBackForwardListItem.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                9391074E1BF6BC65008C17AD /* _WKPreviewElementInfoInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKPreviewElementInfoInternal.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 9391F283121B38F500EBF7E8 /* WebFrameNetworkingContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFrameNetworkingContext.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 9391F284121B38F500EBF7E8 /* WebFrameNetworkingContext.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebFrameNetworkingContext.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                9395E6891BF2C33200F49BCE /* _WKPreviewElementInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKPreviewElementInfo.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                9395E68B1BF2C35200F49BCE /* _WKPreviewElementInfo.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKPreviewElementInfo.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
+                9395E68D1BF410FD00F49BCE /* _WKElementInfoInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKElementInfoInternal.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 939AE7651316E99C00AE06A6 /* WebCoreArgumentCoders.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCoreArgumentCoders.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 939F401B19FB0BBC002B2B42 /* WKActionMenuTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKActionMenuTypes.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 93A88B2E1BC6E98F00ABA5C2 /* WebHitTestResultData.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebHitTestResultData.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -5394,6 +5402,7 @@
</span><span class="cx">                                 379A873B18BBFF0700588AF2 /* _WKElementActionInternal.h */,
</span><span class="cx">                                 1A5704F01BE0173F00874AF1 /* _WKElementInfo.h */,
</span><span class="cx">                                 1A5704EF1BE0173F00874AF1 /* _WKElementInfo.mm */,
</span><ins>+                                9395E68D1BF410FD00F49BCE /* _WKElementInfoInternal.h */,
</ins><span class="cx">                                 1AD01BC71905D37E00C9C45F /* _WKErrorRecoveryAttempting.h */,
</span><span class="cx">                                 1AD01BC61905D37E00C9C45F /* _WKErrorRecoveryAttempting.mm */,
</span><span class="cx">                                 005D158E18E4C4EB00734619 /* _WKFindDelegate.h */,
</span><span class="lines">@@ -5404,6 +5413,9 @@
</span><span class="cx">                                 37A64E5418F38E3C00EB30F1 /* _WKInputDelegate.h */,
</span><span class="cx">                                 2D790A9C1AD7050D00AB90B3 /* _WKLayoutMode.h */,
</span><span class="cx">                                 9323611D1B015DA800FA9232 /* _WKOverlayScrollbarStyle.h */,
</span><ins>+                                9395E6891BF2C33200F49BCE /* _WKPreviewElementInfo.h */,
+                                9395E68B1BF2C35200F49BCE /* _WKPreviewElementInfo.mm */,
+                                9391074E1BF6BC65008C17AD /* _WKPreviewElementInfoInternal.h */,
</ins><span class="cx">                                 1A43E828188F3CDC009E4D30 /* _WKProcessPoolConfiguration.h */,
</span><span class="cx">                                 1A43E827188F3CDC009E4D30 /* _WKProcessPoolConfiguration.mm */,
</span><span class="cx">                                 7C89D2D61A6C6BE6003A5FDE /* _WKProcessPoolConfigurationInternal.h */,
</span><span class="lines">@@ -7706,6 +7718,7 @@
</span><span class="cx">                                 7C1BA33E1A4A0E600043E249 /* APIDictionary.h in Headers */,
</span><span class="cx">                                 1F7D36C118DA513F00D9D659 /* APIDownloadClient.h in Headers */,
</span><span class="cx">                                 516A4A5D120A2CCD00C05B7F /* APIError.h in Headers */,
</span><ins>+                                9395E68E1BF410FD00F49BCE /* _WKElementInfoInternal.h in Headers */,
</ins><span class="cx">                                 00B9661618E24CBA00CE1F88 /* APIFindClient.h in Headers */,
</span><span class="cx">                                 2DD67A2E1BD819730053B251 /* APIFindMatchesClient.h in Headers */,
</span><span class="cx">                                 37E25D6E18FDE5D6005D3A00 /* APIFormClient.h in Headers */,
</span><span class="lines">@@ -7884,6 +7897,7 @@
</span><span class="cx">                                 1AA5889211EE70400061B882 /* NetscapePluginStream.h in Headers */,
</span><span class="cx">                                 E1798C7A16E6818800240139 /* NetworkBlobRegistry.h in Headers */,
</span><span class="cx">                                 E4436ECC1A0D040B00EAD204 /* NetworkCache.h in Headers */,
</span><ins>+                                9395E68A1BF2C33200F49BCE /* _WKPreviewElementInfo.h in Headers */,
</ins><span class="cx">                                 E49D40D71AD3FB170066B7B9 /* NetworkCacheBlobStorage.h in Headers */,
</span><span class="cx">                                 E489D28A1A0A2DB80078C06A /* NetworkCacheCoder.h in Headers */,
</span><span class="cx">                                 E489D28C1A0A2DB80078C06A /* NetworkCacheCoders.h in Headers */,
</span><span class="lines">@@ -8240,6 +8254,7 @@
</span><span class="cx">                                 939F401C19FB0BBC002B2B42 /* WKActionMenuTypes.h in Headers */,
</span><span class="cx">                                 0FCB4E4818BBE044000FCFC9 /* WKActionSheet.h in Headers */,
</span><span class="cx">                                 0FCB4E4A18BBE044000FCFC9 /* WKActionSheetAssistant.h in Headers */,
</span><ins>+                                9391074F1BF6BC65008C17AD /* _WKPreviewElementInfoInternal.h in Headers */,
</ins><span class="cx">                                 C5FA1ED318E1062200B3F402 /* WKAirPlayRoutePicker.h in Headers */,
</span><span class="cx">                                 BCDDB32D124EC2E10048D13C /* WKAPICast.h in Headers */,
</span><span class="cx">                                 512E34E5130B4D0500ABD19A /* WKApplicationCacheManager.h in Headers */,
</span><span class="lines">@@ -9817,6 +9832,7 @@
</span><span class="cx">                                 E1CC1B9112D7EADF00625838 /* PrintInfoMac.mm in Sources */,
</span><span class="cx">                                 37716A5A195B910500EE8B1B /* ProcessAssertion.cpp in Sources */,
</span><span class="cx">                                 86F9536418FF583C001DB2EF /* ProcessAssertionIOS.mm in Sources */,
</span><ins>+                                9395E68C1BF2C35200F49BCE /* _WKPreviewElementInfo.mm in Sources */,
</ins><span class="cx">                                 1AE117F611DBB30900981615 /* ProcessLauncher.cpp in Sources */,
</span><span class="cx">                                 BC111B1D112F5FE600337BAB /* ProcessLauncherMac.mm in Sources */,
</span><span class="cx">                                 86E67A261910B9D900004AB7 /* ProcessThrottler.cpp in Sources */,
</span></span></pre>
</div>
</div>

</body>
</html>