Title: [246575] trunk/Source/WebKit
- Revision
- 246575
- Author
- achristen...@apple.com
- Date
- 2019-06-18 15:55:22 -0700 (Tue, 18 Jun 2019)
Log Message
Update WebKit API to separately retrieve actions and use context menus
https://bugs.webkit.org/show_bug.cgi?id=198974
<rdar://problem/50735687>
Reviewed by Tim Horton.
Update API and SPI, and add infrastructure for asynchronously requesting interaction information.
* UIProcess/API/Cocoa/WKUIDelegate.h:
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (246574 => 246575)
--- trunk/Source/WebKit/ChangeLog 2019-06-18 22:31:28 UTC (rev 246574)
+++ trunk/Source/WebKit/ChangeLog 2019-06-18 22:55:22 UTC (rev 246575)
@@ -1,3 +1,16 @@
+2019-06-18 Alex Christensen <achristen...@webkit.org>
+
+ Update WebKit API to separately retrieve actions and use context menus
+ https://bugs.webkit.org/show_bug.cgi?id=198974
+ <rdar://problem/50735687>
+
+ Reviewed by Tim Horton.
+
+ Update API and SPI, and add infrastructure for asynchronously requesting interaction information.
+
+ * UIProcess/API/Cocoa/WKUIDelegate.h:
+ * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
+
2019-06-18 Daniel Bates <daba...@apple.com>
REGRESSION (r240757): Cannot dismiss the keyboard on http://apple.com/apple-tv-plus
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegate.h (246574 => 246575)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegate.h 2019-06-18 22:31:28 UTC (rev 246574)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegate.h 2019-06-18 22:55:22 UTC (rev 246575)
@@ -39,6 +39,12 @@
@class WKWebViewConfiguration;
@class WKWindowFeatures;
+#if TARGET_OS_IPHONE
+@class WKContextMenuElementInfo;
+@class UIContextMenuConfiguration;
+@protocol UIContextMenuInteractionCommitAnimating;
+#endif
+
/*! A class conforming to the WKUIDelegate protocol provides methods for
presenting native UI on behalf of a webpage.
*/
@@ -129,7 +135,7 @@
This method will only be invoked for elements that have default preview in WebKit, which is
limited to links. In the future, it could be invoked for additional elements.
*/
-- (BOOL)webView:(WKWebView *)webView shouldPreviewElement:(WKPreviewElementInfo *)elementInfo WK_API_DEPRECATED("This API will be replaced", ios(10.0, WK_IOS_TBA));
+- (BOOL)webView:(WKWebView *)webView shouldPreviewElement:(WKPreviewElementInfo *)elementInfo WK_API_DEPRECATED_WITH_REPLACEMENT("webView:contextMenuConfigurationForElement:completionHandler:", ios(10.0, WK_IOS_TBA));
/*! @abstract Allows your app to provide a custom view controller to show when the given element is peeked.
@param webView The web view invoking the delegate method.
@@ -144,14 +150,54 @@
Returning nil will result in WebKit's default preview behavior. webView:commitPreviewingViewController: will only be invoked
if a non-nil view controller was returned.
*/
-- (nullable UIViewController *)webView:(WKWebView *)webView previewingViewControllerForElement:(WKPreviewElementInfo *)elementInfo defaultActions:(NSArray<id <WKPreviewActionItem>> *)previewActions WK_API_DEPRECATED("This API will be replaced", ios(10.0, WK_IOS_TBA));
+- (nullable UIViewController *)webView:(WKWebView *)webView previewingViewControllerForElement:(WKPreviewElementInfo *)elementInfo defaultActions:(NSArray<id <WKPreviewActionItem>> *)previewActions WK_API_DEPRECATED_WITH_REPLACEMENT("webView:contextMenuConfigurationForElement:completionHandler:", ios(10.0, WK_IOS_TBA));
/*! @abstract Allows your app to pop to the view controller it created.
@param webView The web view invoking the delegate method.
@param previewingViewController The view controller that is being popped.
*/
-- (void)webView:(WKWebView *)webView commitPreviewingViewController:(UIViewController *)previewingViewController WK_API_DEPRECATED("This API will be replaced", ios(10.0, WK_IOS_TBA));
+- (void)webView:(WKWebView *)webView commitPreviewingViewController:(UIViewController *)previewingViewController WK_API_DEPRECATED("webView:contextMenuForElement:willCommitWithAnimator:", ios(10.0, WK_IOS_TBA));
+/**
+ * @abstract Called when a context menu interaction begins.
+ *
+ * @param webView The web view invoking the delegate method.
+ * @param elementInfo The elementInfo for the element the user is touching.
+ * @param completionHandler A completion handler to call once a it has been decided whether or not to show a context menu.
+ * Pass a valid UIContextMenuConfiguration to show a context menu, or pass nil to not show a context menu.
+ */
+
+- (void)webView:(WKWebView *)webView contextMenuConfigurationForElement:(WKContextMenuElementInfo *)elementInfo completionHandler:(void (^)(UIContextMenuConfiguration * _Nullable configuration))completionHandler WK_API_AVAILABLE(ios(WK_IOS_TBA));
+
+/**
+ * @abstract Called when the context menu configured by the UIContextMenuConfiguration from
+ * webView:contextMenuConfigurationForElement:completionHandler: is committed.
+ *
+ * @param webView The web view invoking the delegate method.
+ * @param elementInfo The elementInfo for the element the user is touching.
+ * @param animator The animator to use for the commit animation.
+ */
+
+- (void)webView:(WKWebView *)webView contextMenuForElement:(WKContextMenuElementInfo *)elementInfo willCommitWithAnimator:(id<UIContextMenuInteractionCommitAnimating>)animator WK_API_AVAILABLE(ios(WK_IOS_TBA));
+
+/**
+ * @abstract Called when the context menu will be presented.
+ *
+ * @param webView The web view invoking the delegate method.
+ * @param elementInfo The elementInfo for the element the user is touching.
+ */
+
+- (void)webView:(WKWebView *)webView contextMenuWillPresentForElement:(WKContextMenuElementInfo *)elementInfo WK_API_AVAILABLE(ios(WK_IOS_TBA));
+
+/**
+ * @abstract Called when the context menu ends.
+ *
+ * @param webView The web view invoking the delegate method.
+ * @param elementInfo The elementInfo for the element the user is touching.
+ */
+
+- (void)webView:(WKWebView *)webView contextMenuDidEndForElement:(WKContextMenuElementInfo *)elementInfo WK_API_AVAILABLE(ios(WK_IOS_TBA));
+
#endif // TARGET_OS_IPHONE
#if !TARGET_OS_IPHONE
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h (246574 => 246575)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h 2019-06-18 22:31:28 UTC (rev 246574)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h 2019-06-18 22:55:22 UTC (rev 246575)
@@ -147,13 +147,13 @@
- (void)_webView:(WKWebView *)webView didDismissPreviewViewController:(UIViewController *)previewedViewController WK_API_DEPRECATED_WITH_REPLACEMENT("webView:dismissContextMenu:", ios(9.0, WK_IOS_TBA));
#if TARGET_OS_IOS
-// This needs to be removed once there is an API version to continue to do callbacks for image element context menus.
+// This must be kept to continue to do callbacks for image element context menus.
- (void)_webView:(WKWebView *)webView contextMenuConfigurationForElement:(WKContextMenuElementInfo *)elementInfo completionHandler:(void(^)(UIContextMenuConfiguration *))completionHandler WK_API_AVAILABLE(ios(WK_IOS_TBA));
-// These can be removed once there is an API version.
-- (void)_webView:(WKWebView *)webView contextMenuForElement:(WKContextMenuElementInfo *)elementInfo willCommitWithAnimator:(id<UIContextMenuInteractionCommitAnimating>)animator WK_API_AVAILABLE(ios(WK_IOS_TBA));
-- (void)_webView:(WKWebView *)webView contextMenuWillPresentForElement:(WKContextMenuElementInfo *)elementInfo WK_API_AVAILABLE(ios(WK_IOS_TBA));
-- (void)_webView:(WKWebView *)webView contextMenuDidEndForElement:(WKContextMenuElementInfo *)elementInfo WK_API_AVAILABLE(ios(WK_IOS_TBA));
+// These can be removed once the API version is adopted by all clients.
+- (void)_webView:(WKWebView *)webView contextMenuForElement:(WKContextMenuElementInfo *)elementInfo willCommitWithAnimator:(id<UIContextMenuInteractionCommitAnimating>)animator WK_API_DEPRECATED_WITH_REPLACEMENT("webView:contextMenuForElement:willCommitWithAnimator:", ios(WK_IOS_TBA, WK_IOS_TBA));
+- (void)_webView:(WKWebView *)webView contextMenuWillPresentForElement:(WKContextMenuElementInfo *)elementInfo WK_API_DEPRECATED_WITH_REPLACEMENT("webView:contextMenuWillPresentForElement:", ios(WK_IOS_TBA, WK_IOS_TBA));
+- (void)_webView:(WKWebView *)webView contextMenuDidEndForElement:(WKContextMenuElementInfo *)elementInfo WK_API_DEPRECATED_WITH_REPLACEMENT("webView:contextMenuDidEndForElement:", ios(WK_IOS_TBA, WK_IOS_TBA));
#endif
- (BOOL)_webView:(WKWebView *)webView showCustomSheetForElement:(_WKActivatedElementInfo *)element WK_API_AVAILABLE(ios(10.0));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes