Tapping and holding a link should have a share option
[WebKit-https.git] / Source / WebKit2 / UIProcess / ios / WKPDFView.mm
index e8d8cc069bcd16620f6df6451fd67605421510c4..7144d43b0288199f27b5cf5b5feda3b96bacbfd5 100644 (file)
@@ -105,6 +105,8 @@ typedef struct {
     _WKFindOptions _nextCachedFindOptionsAffectingResults;
 
     dispatch_queue_t _findQueue;
+
+    RetainPtr<UIWKSelectionAssistant> _webSelectionAssistant;
 }
 
 - (instancetype)web_initWithFrame:(CGRect)frame webView:(WKWebView *)webView
@@ -718,6 +720,13 @@ static NSStringCompareOptions stringCompareOptions(_WKFindOptions options)
     _webView->_page->navigateToPDFLinkWithSimulatedClick(_positionInformation.url, roundedIntPoint(location), roundedIntPoint(screenPoint));
 }
 
+- (void)actionSheetAssistant:(WKActionSheetAssistant *)assistant shareElementWithURL:(NSURL *)url rect:(CGRect)boundingRect
+{
+    _webSelectionAssistant = adoptNS([[UIWKSelectionAssistant alloc] initWithView:self]);
+    [_webSelectionAssistant showShareSheetFor:url.absoluteString fromRect:boundingRect];
+    _webSelectionAssistant = nil;
+}
+
 #if HAVE(APP_LINKS)
 - (BOOL)actionSheetAssistant:(WKActionSheetAssistant *)assistant shouldIncludeAppLinkActionsForElement:(_WKActivatedElementInfo *)element
 {