- Revision
- 191805
- Author
- bda...@apple.com
- Date
- 2015-10-30 12:38:40 -0700 (Fri, 30 Oct 2015)
Log Message
Tapping and holding a link should have a share option
https://bugs.webkit.org/show_bug.cgi?id=150693
-and corresponding-
rdar://problem/21319702
Reviewed by Tim Horton.
Source/WebCore:
* English.lproj/Localizable.strings:
Source/WebKit2:
New _WKElementActionType called _WKElementActionTypeShare.
* UIProcess/API/Cocoa/_WKElementAction.h:
* UIProcess/API/Cocoa/_WKElementAction.mm:
(+[_WKElementAction _elementActionWithType:customTitle:assistant:]):
_WKElementActionTypeShare is part of the default actions for links.
* UIProcess/ios/WKActionSheetAssistant.h:
* UIProcess/ios/WKActionSheetAssistant.mm:
(-[WKActionSheetAssistant defaultActionsForLinkSheet:]):
Handle the sharing part!
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView actionSheetAssistant:shareElementWithURL:rect:]):
To support this in PDF, PDF need to create a _webSelectionAssistant.
* UIProcess/ios/WKPDFView.mm:
(-[WKPDFView web_initWithFrame:webView:]):
(-[WKPDFView actionSheetAssistant:openElementAtLocation:]):
(-[WKPDFView actionSheetAssistant:shareElementWithURL:rect:]):
(-[WKPDFView actionSheetAssistant:shouldIncludeAppLinkActionsForElement:]):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (191804 => 191805)
--- trunk/Source/WebCore/ChangeLog 2015-10-30 19:09:13 UTC (rev 191804)
+++ trunk/Source/WebCore/ChangeLog 2015-10-30 19:38:40 UTC (rev 191805)
@@ -1,3 +1,14 @@
+2015-10-30 Beth Dakin <bda...@apple.com>
+
+ Tapping and holding a link should have a share option
+ https://bugs.webkit.org/show_bug.cgi?id=150693
+ -and corresponding-
+ rdar://problem/21319702
+
+ Reviewed by Tim Horton.
+
+ * English.lproj/Localizable.strings:
+
2015-10-30 Joseph Pecoraro <pecor...@apple.com>
Minor CGColor leaks seen on bots allocated in WebSystemBackdropLayer.mm
Modified: trunk/Source/WebCore/English.lproj/Localizable.strings (191804 => 191805)
--- trunk/Source/WebCore/English.lproj/Localizable.strings 2015-10-30 19:09:13 UTC (rev 191804)
+++ trunk/Source/WebCore/English.lproj/Localizable.strings 2015-10-30 19:38:40 UTC (rev 191805)
@@ -496,6 +496,9 @@
/* Undo action name */
"Set Writing Direction (Undo action name)" = "Set Writing Direction";
+/* Title for Share action button */
+"Share…" = "Share…";
+
/* Show colors context menu item */
"Show Colors" = "Show Colors";
Modified: trunk/Source/WebKit2/ChangeLog (191804 => 191805)
--- trunk/Source/WebKit2/ChangeLog 2015-10-30 19:09:13 UTC (rev 191804)
+++ trunk/Source/WebKit2/ChangeLog 2015-10-30 19:38:40 UTC (rev 191805)
@@ -1,3 +1,33 @@
+2015-10-30 Beth Dakin <bda...@apple.com>
+
+ Tapping and holding a link should have a share option
+ https://bugs.webkit.org/show_bug.cgi?id=150693
+ -and corresponding-
+ rdar://problem/21319702
+
+ Reviewed by Tim Horton.
+
+ New _WKElementActionType called _WKElementActionTypeShare.
+ * UIProcess/API/Cocoa/_WKElementAction.h:
+ * UIProcess/API/Cocoa/_WKElementAction.mm:
+ (+[_WKElementAction _elementActionWithType:customTitle:assistant:]):
+
+ _WKElementActionTypeShare is part of the default actions for links.
+ * UIProcess/ios/WKActionSheetAssistant.h:
+ * UIProcess/ios/WKActionSheetAssistant.mm:
+ (-[WKActionSheetAssistant defaultActionsForLinkSheet:]):
+
+ Handle the sharing part!
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView actionSheetAssistant:shareElementWithURL:rect:]):
+
+ To support this in PDF, PDF need to create a _webSelectionAssistant.
+ * UIProcess/ios/WKPDFView.mm:
+ (-[WKPDFView web_initWithFrame:webView:]):
+ (-[WKPDFView actionSheetAssistant:openElementAtLocation:]):
+ (-[WKPDFView actionSheetAssistant:shareElementWithURL:rect:]):
+ (-[WKPDFView actionSheetAssistant:shouldIncludeAppLinkActionsForElement:]):
+
2015-10-30 Tim Horton <timothy_hor...@apple.com>
WKView being inside WKWebView leads to weird API issues
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKElementAction.h (191804 => 191805)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKElementAction.h 2015-10-30 19:09:13 UTC (rev 191804)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKElementAction.h 2015-10-30 19:38:40 UTC (rev 191805)
@@ -43,6 +43,7 @@
_WKElementActionTypeAddToReadingList,
_WKElementActionTypeOpenInDefaultBrowser WK_ENUM_AVAILABLE(NA, 9_0),
_WKElementActionTypeOpenInExternalApplication WK_ENUM_AVAILABLE(NA, 9_0),
+ _WKElementActionTypeShare WK_ENUM_AVAILABLE(NA, WK_IOS_TBA),
#endif
} WK_ENUM_AVAILABLE(10_10, 8_0);
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKElementAction.mm (191804 => 191805)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKElementAction.mm 2015-10-30 19:09:13 UTC (rev 191804)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKElementAction.mm 2015-10-30 19:38:40 UTC (rev 191805)
@@ -127,6 +127,12 @@
};
break;
#endif
+ case _WKElementActionTypeShare:
+ title = WEB_UI_STRING("Share…", "Title for Share action button");
+ handler = ^(WKActionSheetAssistant *assistant, _WKActivatedElementInfo *actionInfo) {
+ [assistant.delegate actionSheetAssistant:assistant shareElementWithURL:actionInfo.URL rect:actionInfo.boundingRect];
+ };
+ break;
default:
[NSException raise:NSInvalidArgumentException format:@"There is no standard web element action of type %ld.", (long)type];
return nil;
Modified: trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.h (191804 => 191805)
--- trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.h 2015-10-30 19:09:13 UTC (rev 191804)
+++ trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.h 2015-10-30 19:38:40 UTC (rev 191805)
@@ -45,6 +45,7 @@
- (const WebKit::InteractionInformationAtPosition&)positionInformationForActionSheetAssistant:(WKActionSheetAssistant *)assistant;
- (void)actionSheetAssistant:(WKActionSheetAssistant *)assistant performAction:(WebKit::SheetAction)action;
- (void)actionSheetAssistant:(WKActionSheetAssistant *)assistant openElementAtLocation:(CGPoint)location;
+- (void)actionSheetAssistant:(WKActionSheetAssistant *)assistant shareElementWithURL:(NSURL *)url rect:(CGRect)boundingRect;
#if HAVE(APP_LINKS)
- (BOOL)actionSheetAssistant:(WKActionSheetAssistant *)assistant shouldIncludeAppLinkActionsForElement:(_WKActivatedElementInfo *)element;
#endif
Modified: trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.mm (191804 => 191805)
--- trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.mm 2015-10-30 19:09:13 UTC (rev 191804)
+++ trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.mm 2015-10-30 19:38:40 UTC (rev 191805)
@@ -343,8 +343,10 @@
if ([getSSReadingListClass() supportsURL:targetURL])
[defaultActions addObject:[_WKElementAction _elementActionWithType:_WKElementActionTypeAddToReadingList assistant:self]];
#endif
- if (![[targetURL scheme] length] || [[targetURL scheme] caseInsensitiveCompare:@"_javascript_"] != NSOrderedSame)
+ if (![[targetURL scheme] length] || [[targetURL scheme] caseInsensitiveCompare:@"_javascript_"] != NSOrderedSame) {
[defaultActions addObject:[_WKElementAction _elementActionWithType:_WKElementActionTypeCopy assistant:self]];
+ [defaultActions addObject:[_WKElementAction _elementActionWithType:_WKElementActionTypeShare assistant:self]];
+ }
return defaultActions;
}
Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (191804 => 191805)
--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm 2015-10-30 19:09:13 UTC (rev 191804)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm 2015-10-30 19:38:40 UTC (rev 191805)
@@ -3370,6 +3370,14 @@
[self _attemptClickAtLocation:location];
}
+- (void)actionSheetAssistant:(WKActionSheetAssistant *)assistant shareElementWithURL:(NSURL *)url rect:(CGRect)boundingRect
+{
+ if (_textSelectionAssistant)
+ [_textSelectionAssistant showShareSheetFor:url.absoluteString fromRect:boundingRect];
+ else if (_webSelectionAssistant)
+ [_webSelectionAssistant showShareSheetFor:url.absoluteString fromRect:boundingRect];
+}
+
#if HAVE(APP_LINKS)
- (BOOL)actionSheetAssistant:(WKActionSheetAssistant *)assistant shouldIncludeAppLinkActionsForElement:(_WKActivatedElementInfo *)element
{
Modified: trunk/Source/WebKit2/UIProcess/ios/WKPDFView.mm (191804 => 191805)
--- trunk/Source/WebKit2/UIProcess/ios/WKPDFView.mm 2015-10-30 19:09:13 UTC (rev 191804)
+++ trunk/Source/WebKit2/UIProcess/ios/WKPDFView.mm 2015-10-30 19:38:40 UTC (rev 191805)
@@ -105,6 +105,8 @@
_WKFindOptions _nextCachedFindOptionsAffectingResults;
dispatch_queue_t _findQueue;
+
+ RetainPtr<UIWKSelectionAssistant> _webSelectionAssistant;
}
- (instancetype)web_initWithFrame:(CGRect)frame webView:(WKWebView *)webView
@@ -718,6 +720,13 @@
_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
{