<!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>[197596] trunk/Source</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/197596">197596</a></dd>
<dt>Author</dt> <dd>enrica@apple.com</dd>
<dt>Date</dt> <dd>2016-03-04 15:55:55 -0800 (Fri, 04 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add a mechanism to customize the long press action.
https://bugs.webkit.org/show_bug.cgi?id=154995
rdar://problem/24823732

Reviewed by Tim Horton.

Source/WebCore:

We want to allow long press on attachment elements as well.

* WebCore.xcodeproj/project.pbxproj: Making HTMLAttachmentElement.h private.
* html/HTMLAttachmentElement.h: Adding exported functions.

Source/WebKit2:

Adding a new private delegate method to allow clients to
replace the action sheet displayed for images and links.
The change also adds support for attachment elements.

* Shared/ios/InteractionInformationAtPosition.h:
* Shared/ios/InteractionInformationAtPosition.mm:
(WebKit::InteractionInformationAtPosition::encode):
(WebKit::InteractionInformationAtPosition::decode):
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/API/Cocoa/_WKActivatedElementInfo.h:
* UIProcess/ios/WKActionSheetAssistant.h:
* UIProcess/ios/WKActionSheetAssistant.mm:
(-[WKActionSheetAssistant showImageSheet]):
(-[WKActionSheetAssistant showLinkSheet]):
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _showImageSheet]):
(-[WKContentView _showAttachmentSheet]):
(-[WKContentView _showLinkSheet]):
(-[WKContentView _actionForLongPress]):
(-[WKContentView actionSheetAssistant:shouldIncludeAppLinkActionsForElement:]):
(-[WKContentView actionSheetAssistant:showCustomSheetForElement:]):
(-[WKContentView actionSheetAssistant:decideActionsForElement:defaultActions:]):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getPositionInformation):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLAttachmentElementh">trunk/Source/WebCore/html/HTMLAttachmentElement.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharediosInteractionInformationAtPositionh">trunk/Source/WebKit2/Shared/ios/InteractionInformationAtPosition.h</a></li>
<li><a href="#trunkSourceWebKit2SharediosInteractionInformationAtPositionmm">trunk/Source/WebKit2/Shared/ios/InteractionInformationAtPosition.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKUIDelegatePrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoa_WKActivatedElementInfoh">trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKActivatedElementInfo.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKActionSheetAssistanth">trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKActionSheetAssistantmm">trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewInteractionmm">trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm">trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (197595 => 197596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-03-04 23:33:22 UTC (rev 197595)
+++ trunk/Source/WebCore/ChangeLog        2016-03-04 23:55:55 UTC (rev 197596)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-03-03  Enrica Casucci  &lt;enrica@apple.com&gt;
+
+        Add a mechanism to customize the long press action.
+        https://bugs.webkit.org/show_bug.cgi?id=154995
+        rdar://problem/24823732
+
+        Reviewed by Tim Horton.
+
+        We want to allow long press on attachment elements as well.
+
+        * WebCore.xcodeproj/project.pbxproj: Making HTMLAttachmentElement.h private.
+        * html/HTMLAttachmentElement.h: Adding exported functions.
+
</ins><span class="cx"> 2016-03-04  Andreas Kling  &lt;akling@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] Throw away compiled RegExp code when navigating to a new page.
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (197595 => 197596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-03-04 23:33:22 UTC (rev 197595)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-03-04 23:55:55 UTC (rev 197596)
</span><span class="lines">@@ -2743,7 +2743,7 @@
</span><span class="cx">                 7C5343FC17B74B63004232F0 /* JSMediaQueryListListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C5343FA17B74B63004232F0 /* JSMediaQueryListListener.cpp */; };
</span><span class="cx">                 7C5343FD17B74B63004232F0 /* JSMediaQueryListListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C5343FB17B74B63004232F0 /* JSMediaQueryListListener.h */; };
</span><span class="cx">                 7C5F28FB1A827D8400C0F31F /* HTMLAttachmentElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C5F28F91A827D8400C0F31F /* HTMLAttachmentElement.cpp */; };
</span><del>-                7C5F28FC1A827D8400C0F31F /* HTMLAttachmentElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C5F28FA1A827D8400C0F31F /* HTMLAttachmentElement.h */; };
</del><ins>+                7C5F28FC1A827D8400C0F31F /* HTMLAttachmentElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C5F28FA1A827D8400C0F31F /* HTMLAttachmentElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 7C73FB07191EF417007DE061 /* UserMessageHandlersNamespace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C73FB05191EF416007DE061 /* UserMessageHandlersNamespace.cpp */; };
</span><span class="cx">                 7C73FB08191EF417007DE061 /* UserMessageHandlersNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C73FB06191EF417007DE061 /* UserMessageHandlersNamespace.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 7C73FB0C191EF5A8007DE061 /* JSUserMessageHandlersNamespace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C73FB0A191EF5A8007DE061 /* JSUserMessageHandlersNamespace.cpp */; };
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLAttachmentElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLAttachmentElement.h (197595 => 197596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLAttachmentElement.h        2016-03-04 23:33:22 UTC (rev 197595)
+++ trunk/Source/WebCore/html/HTMLAttachmentElement.h        2016-03-04 23:55:55 UTC (rev 197596)
</span><span class="lines">@@ -37,10 +37,10 @@
</span><span class="cx"> class HTMLAttachmentElement final : public HTMLElement {
</span><span class="cx"> public:
</span><span class="cx">     static Ref&lt;HTMLAttachmentElement&gt; create(const QualifiedName&amp;, Document&amp;);
</span><del>-    File* file() const;
</del><ins>+    WEBCORE_EXPORT File* file() const;
</ins><span class="cx">     void setFile(File*);
</span><span class="cx"> 
</span><del>-    String attachmentTitle() const;
</del><ins>+    WEBCORE_EXPORT String attachmentTitle() const;
</ins><span class="cx">     String attachmentType() const;
</span><span class="cx"> 
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (197595 => 197596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-03-04 23:33:22 UTC (rev 197595)
+++ trunk/Source/WebKit2/ChangeLog        2016-03-04 23:55:55 UTC (rev 197596)
</span><span class="lines">@@ -1,3 +1,36 @@
</span><ins>+2016-03-03  Enrica Casucci  &lt;enrica@apple.com&gt;
+
+        Add a mechanism to customize the long press action.
+        https://bugs.webkit.org/show_bug.cgi?id=154995
+        rdar://problem/24823732
+
+        Reviewed by Tim Horton.
+
+        Adding a new private delegate method to allow clients to
+        replace the action sheet displayed for images and links.
+        The change also adds support for attachment elements.
+
+        * Shared/ios/InteractionInformationAtPosition.h:
+        * Shared/ios/InteractionInformationAtPosition.mm:
+        (WebKit::InteractionInformationAtPosition::encode):
+        (WebKit::InteractionInformationAtPosition::decode):
+        * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
+        * UIProcess/API/Cocoa/_WKActivatedElementInfo.h:
+        * UIProcess/ios/WKActionSheetAssistant.h:
+        * UIProcess/ios/WKActionSheetAssistant.mm:
+        (-[WKActionSheetAssistant showImageSheet]):
+        (-[WKActionSheetAssistant showLinkSheet]):
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _showImageSheet]):
+        (-[WKContentView _showAttachmentSheet]):
+        (-[WKContentView _showLinkSheet]):
+        (-[WKContentView _actionForLongPress]):
+        (-[WKContentView actionSheetAssistant:shouldIncludeAppLinkActionsForElement:]):
+        (-[WKContentView actionSheetAssistant:showCustomSheetForElement:]):
+        (-[WKContentView actionSheetAssistant:decideActionsForElement:defaultActions:]):
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::getPositionInformation):
+
</ins><span class="cx"> 2016-03-04  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [WK2] Gather resource load statistics
</span></span></pre></div>
<a id="trunkSourceWebKit2SharediosInteractionInformationAtPositionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/ios/InteractionInformationAtPosition.h (197595 => 197596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/ios/InteractionInformationAtPosition.h        2016-03-04 23:33:22 UTC (rev 197595)
+++ trunk/Source/WebKit2/Shared/ios/InteractionInformationAtPosition.h        2016-03-04 23:55:55 UTC (rev 197596)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx">     bool touchCalloutEnabled { true };
</span><span class="cx">     bool isLink { false };
</span><span class="cx">     bool isImage { false };
</span><ins>+    bool isAttachment { false };
</ins><span class="cx">     bool isAnimatedImage { false };
</span><span class="cx">     bool isElement { false };
</span><span class="cx"> #if ENABLE(DATA_DETECTION)
</span></span></pre></div>
<a id="trunkSourceWebKit2SharediosInteractionInformationAtPositionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/ios/InteractionInformationAtPosition.mm (197595 => 197596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/ios/InteractionInformationAtPosition.mm        2016-03-04 23:33:22 UTC (rev 197595)
+++ trunk/Source/WebKit2/Shared/ios/InteractionInformationAtPosition.mm        2016-03-04 23:55:55 UTC (rev 197596)
</span><span class="lines">@@ -48,6 +48,7 @@
</span><span class="cx">     encoder &lt;&lt; touchCalloutEnabled;
</span><span class="cx">     encoder &lt;&lt; isLink;
</span><span class="cx">     encoder &lt;&lt; isImage;
</span><ins>+    encoder &lt;&lt; isAttachment;
</ins><span class="cx">     encoder &lt;&lt; isAnimatedImage;
</span><span class="cx">     encoder &lt;&lt; isElement;
</span><span class="cx">     encoder &lt;&lt; url;
</span><span class="lines">@@ -98,6 +99,9 @@
</span><span class="cx">     if (!decoder.decode(result.isImage))
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><ins>+    if (!decoder.decode(result.isAttachment))
+        return false;
+    
</ins><span class="cx">     if (!decoder.decode(result.isAnimatedImage))
</span><span class="cx">         return false;
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKUIDelegatePrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h (197595 => 197596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h        2016-03-04 23:33:22 UTC (rev 197595)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h        2016-03-04 23:55:55 UTC (rev 197596)
</span><span class="lines">@@ -71,6 +71,7 @@
</span><span class="cx"> - (void)_webView:(WKWebView *)webView commitPreviewedImageWithURL:(NSURL *)imageURL WK_AVAILABLE(NA, 9_0);
</span><span class="cx"> - (void)_webView:(WKWebView *)webView didDismissPreviewViewController:(UIViewController *)previewedViewController committing:(BOOL)committing WK_AVAILABLE(NA, 9_0);
</span><span class="cx"> - (void)_webView:(WKWebView *)webView didDismissPreviewViewController:(UIViewController *)previewedViewController WK_AVAILABLE(NA, 9_0);
</span><ins>+- (BOOL)_webView:(WKWebView *)webView showCustomSheetForElement:(_WKActivatedElementInfo *)element WK_AVAILABLE(NA, WK_IOS_TBA);
</ins><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></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoa_WKActivatedElementInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKActivatedElementInfo.h (197595 => 197596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKActivatedElementInfo.h        2016-03-04 23:33:22 UTC (rev 197595)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKActivatedElementInfo.h        2016-03-04 23:55:55 UTC (rev 197596)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> typedef NS_ENUM(NSInteger, _WKActivatedElementType) {
</span><span class="cx">     _WKActivatedElementTypeLink,
</span><span class="cx">     _WKActivatedElementTypeImage,
</span><ins>+    _WKActivatedElementTypeAttachment WK_ENUM_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA),
</ins><span class="cx"> } WK_ENUM_AVAILABLE(10_10, 8_0);
</span><span class="cx"> 
</span><span class="cx"> WK_CLASS_AVAILABLE(10_10, 8_0)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKActionSheetAssistanth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.h (197595 => 197596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.h        2016-03-04 23:33:22 UTC (rev 197595)
+++ trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.h        2016-03-04 23:55:55 UTC (rev 197596)
</span><span class="lines">@@ -52,6 +52,7 @@
</span><span class="cx"> - (RetainPtr&lt;NSArray&gt;)actionSheetAssistant:(WKActionSheetAssistant *)assistant decideActionsForElement:(_WKActivatedElementInfo *)element defaultActions:(RetainPtr&lt;NSArray&gt;)defaultActions;
</span><span class="cx"> 
</span><span class="cx"> @optional
</span><ins>+- (BOOL)actionSheetAssistant:(WKActionSheetAssistant *)assistant showCustomSheetForElement:(_WKActivatedElementInfo *)element;
</ins><span class="cx"> - (void)updatePositionInformationForActionSheetAssistant:(WKActionSheetAssistant *)assistant;
</span><span class="cx"> - (void)actionSheetAssistant:(WKActionSheetAssistant *)assistant willStartInteractionWithElement:(_WKActivatedElementInfo *)element;
</span><span class="cx"> - (void)actionSheetAssistantDidStopInteraction:(WKActionSheetAssistant *)assistant;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKActionSheetAssistantmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.mm (197595 => 197596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.mm        2016-03-04 23:33:22 UTC (rev 197595)
+++ trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.mm        2016-03-04 23:55:55 UTC (rev 197596)
</span><span class="lines">@@ -281,6 +281,8 @@
</span><span class="cx"> 
</span><span class="cx">     NSURL *targetURL = [NSURL _web_URLWithWTFString:positionInformation.url];
</span><span class="cx">     auto elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeImage URL:targetURL location:positionInformation.point title:positionInformation.title rect:positionInformation.bounds image:positionInformation.image.get()]);
</span><ins>+    if ([delegate respondsToSelector:@selector(actionSheetAssistant:showCustomSheetForElement:)] &amp;&amp; [delegate actionSheetAssistant:self showCustomSheetForElement:elementInfo.get()])
+        return;
</ins><span class="cx">     auto defaultActions = [self defaultActionsForImageSheet:elementInfo.get()];
</span><span class="cx"> 
</span><span class="cx">     RetainPtr&lt;NSArray&gt; actions = [delegate actionSheetAssistant:self decideActionsForElement:elementInfo.get() defaultActions:WTFMove(defaultActions)];
</span><span class="lines">@@ -395,6 +397,9 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     auto elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeLink URL:targetURL location:positionInformation.point title:positionInformation.title rect:positionInformation.bounds image:positionInformation.image.get()]);
</span><ins>+    if ([delegate respondsToSelector:@selector(actionSheetAssistant:showCustomSheetForElement:)] &amp;&amp; [delegate actionSheetAssistant:self showCustomSheetForElement:elementInfo.get()])
+        return;
+
</ins><span class="cx">     auto defaultActions = [self defaultActionsForLinkSheet:elementInfo.get()];
</span><span class="cx"> 
</span><span class="cx">     RetainPtr&lt;NSArray&gt; actions = [delegate actionSheetAssistant:self decideActionsForElement:elementInfo.get() defaultActions:WTFMove(defaultActions)];
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewInteractionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (197595 => 197596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm        2016-03-04 23:33:22 UTC (rev 197595)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm        2016-03-04 23:55:55 UTC (rev 197596)
</span><span class="lines">@@ -1083,6 +1083,14 @@
</span><span class="cx">     [_actionSheetAssistant showImageSheet];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)_showAttachmentSheet
+{
+    id &lt;WKUIDelegatePrivate&gt; uiDelegate = static_cast&lt;id &lt;WKUIDelegatePrivate&gt;&gt;([_webView UIDelegate]);
+    
+    if ([uiDelegate respondsToSelector:@selector(_webView:showCustomSheetForElement:)])
+        [uiDelegate _webView:_webView showCustomSheetForElement:[[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeAttachment URL:[NSURL _web_URLWithWTFString:_positionInformation.url] location:_positionInformation.point title:_positionInformation.title rect:_positionInformation.bounds image:nil]];
+}
+
</ins><span class="cx"> - (void)_showLinkSheet
</span><span class="cx"> {
</span><span class="cx">     [_actionSheetAssistant showLinkSheet];
</span><span class="lines">@@ -1107,6 +1115,9 @@
</span><span class="cx">             return @selector(_showDataDetectorsSheet);
</span><span class="cx">         return @selector(_showLinkSheet);
</span><span class="cx">     }
</span><ins>+    
+    if (_positionInformation.isAttachment)
+        return @selector(_showAttachmentSheet);
</ins><span class="cx"> 
</span><span class="cx">     return nil;
</span><span class="cx"> }
</span><span class="lines">@@ -3545,6 +3556,21 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+- (BOOL)actionSheetAssistant:(WKActionSheetAssistant *)assistant showCustomSheetForElement:(_WKActivatedElementInfo *)element
+{
+    id &lt;WKUIDelegatePrivate&gt; uiDelegate = static_cast&lt;id &lt;WKUIDelegatePrivate&gt;&gt;([_webView UIDelegate]);
+    
+    if ([uiDelegate respondsToSelector:@selector(_webView:showCustomSheetForElement:)]) {
+        if ([uiDelegate _webView:_webView showCustomSheetForElement:element]) {
+            // Prevent tap-and-hold and drag.
+            [UIApp _cancelAllTouches];
+            return YES;
+        }
+    }
+
+    return NO;
+}
+
</ins><span class="cx"> - (RetainPtr&lt;NSArray&gt;)actionSheetAssistant:(WKActionSheetAssistant *)assistant decideActionsForElement:(_WKActivatedElementInfo *)element defaultActions:(RetainPtr&lt;NSArray&gt;)defaultActions
</span><span class="cx"> {
</span><span class="cx">     return _page-&gt;uiClient().actionsForElement(element, WTFMove(defaultActions));
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (197595 => 197596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2016-03-04 23:33:22 UTC (rev 197595)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2016-03-04 23:55:55 UTC (rev 197596)
</span><span class="lines">@@ -56,12 +56,14 @@
</span><span class="cx"> #import &lt;WebCore/Element.h&gt;
</span><span class="cx"> #import &lt;WebCore/ElementAncestorIterator.h&gt;
</span><span class="cx"> #import &lt;WebCore/EventHandler.h&gt;
</span><ins>+#import &lt;WebCore/File.h&gt;
</ins><span class="cx"> #import &lt;WebCore/FloatQuad.h&gt;
</span><span class="cx"> #import &lt;WebCore/FocusController.h&gt;
</span><span class="cx"> #import &lt;WebCore/Frame.h&gt;
</span><span class="cx"> #import &lt;WebCore/FrameLoaderClient.h&gt;
</span><span class="cx"> #import &lt;WebCore/FrameView.h&gt;
</span><span class="cx"> #import &lt;WebCore/GeometryUtilities.h&gt;
</span><ins>+#import &lt;WebCore/HTMLAttachmentElement.h&gt;
</ins><span class="cx"> #import &lt;WebCore/HTMLElementTypeHelpers.h&gt;
</span><span class="cx"> #import &lt;WebCore/HTMLFormElement.h&gt;
</span><span class="cx"> #import &lt;WebCore/HTMLImageElement.h&gt;
</span><span class="lines">@@ -2243,8 +2245,16 @@
</span><span class="cx">             m_page-&gt;focusController().setFocusedFrame(result.innerNodeFrame());
</span><span class="cx">             info.bounds = renderer-&gt;absoluteBoundingBoxRect(true);
</span><span class="cx">             // We don't want to select blocks that are larger than 97% of the visible area of the document.
</span><del>-            const static CGFloat factor = 0.97;
-            info.isSelectable = renderer-&gt;style().userSelect() != SELECT_NONE &amp;&amp; info.bounds.height() &lt; result.innerNodeFrame()-&gt;view()-&gt;unobscuredContentRect().height() * factor;
</del><ins>+            if (is&lt;HTMLAttachmentElement&gt;(*hitNode)) {
+                info.isAttachment = true;
+                const HTMLAttachmentElement&amp; attachment = downcast&lt;HTMLAttachmentElement&gt;(*hitNode);
+                info.title = attachment.attachmentTitle();
+                if (attachment.file())
+                    info.url = downcast&lt;HTMLAttachmentElement&gt;(*hitNode).file()-&gt;path();
+            } else {
+                const static CGFloat factor = 0.97;
+                info.isSelectable = renderer-&gt;style().userSelect() != SELECT_NONE &amp;&amp; info.bounds.height() &lt; result.innerNodeFrame()-&gt;view()-&gt;unobscuredContentRect().height() * factor;
+            }
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>