Changeset 246575 in webkit


Ignore:
Timestamp:
Jun 18, 2019 3:55:22 PM (5 years ago)
Author:
achristensen@apple.com
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:
Location:
trunk/Source/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r246570 r246575  
     12019-06-18  Alex Christensen  <achristensen@webkit.org>
     2
     3        Update WebKit API to separately retrieve actions and use context menus
     4        https://bugs.webkit.org/show_bug.cgi?id=198974
     5        <rdar://problem/50735687>
     6
     7        Reviewed by Tim Horton.
     8
     9        Update API and SPI, and add infrastructure for asynchronously requesting interaction information.
     10
     11        * UIProcess/API/Cocoa/WKUIDelegate.h:
     12        * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
     13
    1142019-06-18  Daniel Bates  <dabates@apple.com>
    215
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegate.h

    r245691 r246575  
    4040@class WKWindowFeatures;
    4141
     42#if TARGET_OS_IPHONE
     43@class WKContextMenuElementInfo;
     44@class UIContextMenuConfiguration;
     45@protocol UIContextMenuInteractionCommitAnimating;
     46#endif
     47
    4248/*! A class conforming to the WKUIDelegate protocol provides methods for
    4349 presenting native UI on behalf of a webpage.
     
    130136 limited to links. In the future, it could be invoked for additional elements.
    131137 */
    132 - (BOOL)webView:(WKWebView *)webView shouldPreviewElement:(WKPreviewElementInfo *)elementInfo WK_API_DEPRECATED("This API will be replaced", ios(10.0, WK_IOS_TBA));
     138- (BOOL)webView:(WKWebView *)webView shouldPreviewElement:(WKPreviewElementInfo *)elementInfo WK_API_DEPRECATED_WITH_REPLACEMENT("webView:contextMenuConfigurationForElement:completionHandler:", ios(10.0, WK_IOS_TBA));
    133139
    134140/*! @abstract Allows your app to provide a custom view controller to show when the given element is peeked.
     
    145151 if a non-nil view controller was returned.
    146152 */
    147 - (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));
     153- (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));
    148154
    149155/*! @abstract Allows your app to pop to the view controller it created.
     
    151157 @param previewingViewController The view controller that is being popped.
    152158 */
    153 - (void)webView:(WKWebView *)webView commitPreviewingViewController:(UIViewController *)previewingViewController WK_API_DEPRECATED("This API will be replaced", ios(10.0, WK_IOS_TBA));
     159- (void)webView:(WKWebView *)webView commitPreviewingViewController:(UIViewController *)previewingViewController WK_API_DEPRECATED("webView:contextMenuForElement:willCommitWithAnimator:", ios(10.0, WK_IOS_TBA));
     160
     161/**
     162 * @abstract Called when a context menu interaction begins.
     163 *
     164 * @param webView The web view invoking the delegate method.
     165 * @param elementInfo The elementInfo for the element the user is touching.
     166 * @param completionHandler A completion handler to call once a it has been decided whether or not to show a context menu.
     167 * Pass a valid UIContextMenuConfiguration to show a context menu, or pass nil to not show a context menu.
     168 */
     169
     170- (void)webView:(WKWebView *)webView contextMenuConfigurationForElement:(WKContextMenuElementInfo *)elementInfo completionHandler:(void (^)(UIContextMenuConfiguration * _Nullable configuration))completionHandler WK_API_AVAILABLE(ios(WK_IOS_TBA));
     171
     172/**
     173 * @abstract Called when the context menu configured by the UIContextMenuConfiguration from
     174 * webView:contextMenuConfigurationForElement:completionHandler: is committed.
     175 *
     176 * @param webView The web view invoking the delegate method.
     177 * @param elementInfo The elementInfo for the element the user is touching.
     178 * @param animator The animator to use for the commit animation.
     179 */
     180
     181- (void)webView:(WKWebView *)webView contextMenuForElement:(WKContextMenuElementInfo *)elementInfo willCommitWithAnimator:(id<UIContextMenuInteractionCommitAnimating>)animator WK_API_AVAILABLE(ios(WK_IOS_TBA));
     182
     183/**
     184 * @abstract Called when the context menu will be presented.
     185 *
     186 * @param webView The web view invoking the delegate method.
     187 * @param elementInfo The elementInfo for the element the user is touching.
     188 */
     189
     190- (void)webView:(WKWebView *)webView contextMenuWillPresentForElement:(WKContextMenuElementInfo *)elementInfo WK_API_AVAILABLE(ios(WK_IOS_TBA));
     191
     192/**
     193 * @abstract Called when the context menu ends.
     194 *
     195 * @param webView The web view invoking the delegate method.
     196 * @param elementInfo The elementInfo for the element the user is touching.
     197 */
     198
     199- (void)webView:(WKWebView *)webView contextMenuDidEndForElement:(WKContextMenuElementInfo *)elementInfo WK_API_AVAILABLE(ios(WK_IOS_TBA));
    154200
    155201#endif // TARGET_OS_IPHONE
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h

    r246224 r246575  
    148148
    149149#if TARGET_OS_IOS
    150 // This needs to be removed once there is an API version to continue to do callbacks for image element context menus.
     150// This must be kept to continue to do callbacks for image element context menus.
    151151- (void)_webView:(WKWebView *)webView contextMenuConfigurationForElement:(WKContextMenuElementInfo *)elementInfo completionHandler:(void(^)(UIContextMenuConfiguration *))completionHandler WK_API_AVAILABLE(ios(WK_IOS_TBA));
    152152
    153 // These can be removed once there is an API version.
    154 - (void)_webView:(WKWebView *)webView contextMenuForElement:(WKContextMenuElementInfo *)elementInfo willCommitWithAnimator:(id<UIContextMenuInteractionCommitAnimating>)animator WK_API_AVAILABLE(ios(WK_IOS_TBA));
    155 - (void)_webView:(WKWebView *)webView contextMenuWillPresentForElement:(WKContextMenuElementInfo *)elementInfo WK_API_AVAILABLE(ios(WK_IOS_TBA));
    156 - (void)_webView:(WKWebView *)webView contextMenuDidEndForElement:(WKContextMenuElementInfo *)elementInfo WK_API_AVAILABLE(ios(WK_IOS_TBA));
     153// These can be removed once the API version is adopted by all clients.
     154- (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));
     155- (void)_webView:(WKWebView *)webView contextMenuWillPresentForElement:(WKContextMenuElementInfo *)elementInfo WK_API_DEPRECATED_WITH_REPLACEMENT("webView:contextMenuWillPresentForElement:", ios(WK_IOS_TBA, WK_IOS_TBA));
     156- (void)_webView:(WKWebView *)webView contextMenuDidEndForElement:(WKContextMenuElementInfo *)elementInfo WK_API_DEPRECATED_WITH_REPLACEMENT("webView:contextMenuDidEndForElement:", ios(WK_IOS_TBA, WK_IOS_TBA));
    157157#endif
    158158
Note: See TracChangeset for help on using the changeset viewer.