Changeset 248469 in webkit


Ignore:
Timestamp:
Aug 9, 2019 12:50:44 PM (5 years ago)
Author:
timothy_horton@apple.com
Message:

Tapping buttons in Data Detectors lookup previews doesn't work
https://bugs.webkit.org/show_bug.cgi?id=200579
<rdar://problem/54056519>

Reviewed by Megan Gardner.

Source/WebCore/PAL:

  • pal/spi/ios/DataDetectorsUISPI.h:

Source/WebKit:

  • Platform/spi/ios/UIKitSPI.h:
  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView _contextMenuInteraction:styleForMenuWithConfiguration:]):
If a Data Detectors context menu wants the action menu style, provide it.

(-[WKContentView contextMenuInteraction:willPerformPreviewActionForMenuWithConfiguration:animator:]):
If a Data Detectors context menu provides a view controller to present
on context menu commit, present it. We present on top of the same view
controller that is currently presenting the context menu, but modally
instead of inside the context menu.

If a Data Detectors context menu instead provides a URL to launch on
context menu commit, call openURL.

In both cases, change the commit style to pop, since we're committing
instead of dismissing.

Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/PAL/ChangeLog

    r248381 r248469  
     12019-08-09  Tim Horton  <timothy_horton@apple.com>
     2
     3        Tapping buttons in Data Detectors lookup previews doesn't work
     4        https://bugs.webkit.org/show_bug.cgi?id=200579
     5        <rdar://problem/54056519>
     6
     7        Reviewed by Megan Gardner.
     8
     9        * pal/spi/ios/DataDetectorsUISPI.h:
     10
    1112019-08-07  Dean Jackson  <dino@apple.com>
    212
  • trunk/Source/WebCore/PAL/pal/spi/ios/DataDetectorsUISPI.h

    r247355 r248469  
    8484#if HAVE(LINK_PREVIEW) && USE(UICONTEXTMENU)
    8585SOFT_LINK_CLASS(DataDetectorsUI, DDContextMenuAction);
     86SOFT_LINK_CLASS(DataDetectorsUI, DDContextMenuConfiguration);
    8687#endif
    8788SOFT_LINK_CLASS(DataDetectorsUI, DDDetectionController)
  • trunk/Source/WebKit/ChangeLog

    r248456 r248469  
     12019-08-09  Tim Horton  <timothy_horton@apple.com>
     2
     3        Tapping buttons in Data Detectors lookup previews doesn't work
     4        https://bugs.webkit.org/show_bug.cgi?id=200579
     5        <rdar://problem/54056519>
     6
     7        Reviewed by Megan Gardner.
     8
     9        * Platform/spi/ios/UIKitSPI.h:
     10        * UIProcess/ios/WKContentViewInteraction.mm:
     11        (-[WKContentView _contextMenuInteraction:styleForMenuWithConfiguration:]):
     12        If a Data Detectors context menu wants the action menu style, provide it.
     13
     14        (-[WKContentView contextMenuInteraction:willPerformPreviewActionForMenuWithConfiguration:animator:]):
     15        If a Data Detectors context menu provides a view controller to present
     16        on context menu commit, present it. We present on top of the same view
     17        controller that is currently presenting the context menu, but modally
     18        instead of inside the context menu.
     19
     20        If a Data Detectors context menu instead provides a URL to launch on
     21        context menu commit, call openURL.
     22
     23        In both cases, change the commit style to pop, since we're committing
     24        instead of dismissing.
     25
    1262019-08-08  Dean Jackson  <dino@apple.com>
    227
  • trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h

    r248455 r248469  
    9191#import <UIKit/UIPreviewItemController.h>
    9292#if USE(UICONTEXTMENU)
     93#import <UIKit/UIContextMenuInteraction_ForSpringBoardOnly.h>
    9394#import <UIKit/UIContextMenuInteraction_ForWebKitOnly.h>
    9495#endif
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r248456 r248469  
    82268226}
    82278227
     8228- (nullable _UIContextMenuStyle *)_contextMenuInteraction:(UIContextMenuInteraction *)interaction styleForMenuWithConfiguration:(UIContextMenuConfiguration *)configuration
     8229{
     8230#if defined(DD_CONTEXT_MENU_SPI_VERSION) && DD_CONTEXT_MENU_SPI_VERSION >= 2
     8231    if ([configuration isKindOfClass:getDDContextMenuConfigurationClass()]) {
     8232        DDContextMenuConfiguration *ddConfiguration = static_cast<DDContextMenuConfiguration *>(configuration);
     8233
     8234        if (ddConfiguration.prefersActionMenuStyle) {
     8235            _UIContextMenuStyle *style = [_UIContextMenuStyle defaultStyle];
     8236            style.preferredLayout = _UIContextMenuLayoutActionsOnly;
     8237            return style;
     8238        }
     8239    }
     8240#endif
     8241
     8242    return nil;
     8243}
     8244
    82288245- (void)contextMenuInteraction:(UIContextMenuInteraction *)interaction willPerformPreviewActionForMenuWithConfiguration:(UIContextMenuConfiguration *)configuration animator:(id<UIContextMenuInteractionCommitAnimating>)animator
    82298246{
     
    82778294        ALLOW_DEPRECATED_DECLARATIONS_END
    82788295    }
     8296
     8297#if defined(DD_CONTEXT_MENU_SPI_VERSION) && DD_CONTEXT_MENU_SPI_VERSION >= 2
     8298    if ([configuration isKindOfClass:getDDContextMenuConfigurationClass()]) {
     8299        DDContextMenuConfiguration *ddConfiguration = static_cast<DDContextMenuConfiguration *>(configuration);
     8300
     8301        BOOL shouldExpandPreview = NO;
     8302        RetainPtr<UIViewController> presentedViewController;
     8303
     8304#if defined(DD_CONTEXT_MENU_SPI_VERSION) && DD_CONTEXT_MENU_SPI_VERSION >= 3
     8305        shouldExpandPreview = !!ddConfiguration.interactionViewControllerProvider;
     8306        if (shouldExpandPreview)
     8307            presentedViewController = ddConfiguration.interactionViewControllerProvider();
     8308#else
     8309        shouldExpandPreview = ddConfiguration.expandPreviewOnInteraction;
     8310        presentedViewController = animator.previewViewController;
     8311#endif
     8312
     8313        if (shouldExpandPreview) {
     8314            animator.preferredCommitStyle = UIContextMenuInteractionCommitStylePop;
     8315
     8316            // We will re-present modally on the same VC that is currently presenting the preview in a context menu.
     8317            RetainPtr<UIViewController> presentingViewController = animator.previewViewController.presentingViewController;
     8318
     8319            [animator addAnimations:^{
     8320                [presentingViewController presentViewController:presentedViewController.get() animated:NO completion:nil];
     8321            }];
     8322            return;
     8323        }
     8324
     8325        if (NSURL *interactionURL = ddConfiguration.interactionURL) {
     8326            animator.preferredCommitStyle = UIContextMenuInteractionCommitStylePop;
     8327
     8328            [animator addAnimations:^{
     8329                [[UIApplication sharedApplication] openURL:interactionURL withCompletionHandler:nil];
     8330            }];
     8331            return;
     8332        }
     8333    }
     8334#endif
    82798335}
    82808336
Note: See TracChangeset for help on using the changeset viewer.