Title: [248505] branches/safari-608.1-branch/Source
- Revision
- 248505
- Author
- bshaf...@apple.com
- Date
- 2019-08-10 20:01:56 -0700 (Sat, 10 Aug 2019)
Log Message
Cherry-pick r248469. rdar://problem/54130692
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.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248469 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Diff
Modified: branches/safari-608.1-branch/Source/WebCore/PAL/ChangeLog (248504 => 248505)
--- branches/safari-608.1-branch/Source/WebCore/PAL/ChangeLog 2019-08-11 03:01:50 UTC (rev 248504)
+++ branches/safari-608.1-branch/Source/WebCore/PAL/ChangeLog 2019-08-11 03:01:56 UTC (rev 248505)
@@ -1,3 +1,49 @@
+2019-08-10 Babak Shafiei <bshaf...@apple.com>
+
+ Cherry-pick r248469. rdar://problem/54130692
+
+ 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.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248469 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-08-09 Tim Horton <timothy_hor...@apple.com>
+
+ 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.
+
+ * pal/spi/ios/DataDetectorsUISPI.h:
+
2019-08-06 Kocsen Chung <kocsen_ch...@apple.com>
Cherry-pick r248330. rdar://problem/54018116
Modified: branches/safari-608.1-branch/Source/WebCore/PAL/pal/spi/ios/DataDetectorsUISPI.h (248504 => 248505)
--- branches/safari-608.1-branch/Source/WebCore/PAL/pal/spi/ios/DataDetectorsUISPI.h 2019-08-11 03:01:50 UTC (rev 248504)
+++ branches/safari-608.1-branch/Source/WebCore/PAL/pal/spi/ios/DataDetectorsUISPI.h 2019-08-11 03:01:56 UTC (rev 248505)
@@ -83,6 +83,7 @@
SOFT_LINK_PRIVATE_FRAMEWORK(DataDetectorsUI)
#if HAVE(LINK_PREVIEW) && USE(UICONTEXTMENU)
SOFT_LINK_CLASS(DataDetectorsUI, DDContextMenuAction);
+SOFT_LINK_CLASS(DataDetectorsUI, DDContextMenuConfiguration);
#endif
SOFT_LINK_CLASS(DataDetectorsUI, DDDetectionController)
SOFT_LINK_CONSTANT(DataDetectorsUI, kDataDetectorsLeadingText, const NSString *)
Modified: branches/safari-608.1-branch/Source/WebKit/ChangeLog (248504 => 248505)
--- branches/safari-608.1-branch/Source/WebKit/ChangeLog 2019-08-11 03:01:50 UTC (rev 248504)
+++ branches/safari-608.1-branch/Source/WebKit/ChangeLog 2019-08-11 03:01:56 UTC (rev 248505)
@@ -1,3 +1,64 @@
+2019-08-10 Babak Shafiei <bshaf...@apple.com>
+
+ Cherry-pick r248469. rdar://problem/54130692
+
+ 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.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248469 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-08-09 Tim Horton <timothy_hor...@apple.com>
+
+ 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.
+
+ * 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.
+
2019-08-09 Kocsen Chung <kocsen_ch...@apple.com>
Cherry-pick r248447. rdar://problem/54109873
Modified: branches/safari-608.1-branch/Source/WebKit/Platform/spi/ios/UIKitSPI.h (248504 => 248505)
--- branches/safari-608.1-branch/Source/WebKit/Platform/spi/ios/UIKitSPI.h 2019-08-11 03:01:50 UTC (rev 248504)
+++ branches/safari-608.1-branch/Source/WebKit/Platform/spi/ios/UIKitSPI.h 2019-08-11 03:01:56 UTC (rev 248505)
@@ -90,6 +90,7 @@
#import <UIKit/UIPreviewAction_Private.h>
#import <UIKit/UIPreviewItemController.h>
#if USE(UICONTEXTMENU)
+#import <UIKit/UIContextMenuInteraction_ForSpringBoardOnly.h>
#import <UIKit/UIContextMenuInteraction_ForWebKitOnly.h>
#endif
#endif
Modified: branches/safari-608.1-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (248504 => 248505)
--- branches/safari-608.1-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2019-08-11 03:01:50 UTC (rev 248504)
+++ branches/safari-608.1-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2019-08-11 03:01:56 UTC (rev 248505)
@@ -8196,6 +8196,23 @@
return std::exchange(_contextMenuInteractionTargetedPreview, nil).autorelease();
}
+- (nullable _UIContextMenuStyle *)_contextMenuInteraction:(UIContextMenuInteraction *)interaction styleForMenuWithConfiguration:(UIContextMenuConfiguration *)configuration
+{
+#if defined(DD_CONTEXT_MENU_SPI_VERSION) && DD_CONTEXT_MENU_SPI_VERSION >= 2
+ if ([configuration isKindOfClass:getDDContextMenuConfigurationClass()]) {
+ DDContextMenuConfiguration *ddConfiguration = static_cast<DDContextMenuConfiguration *>(configuration);
+
+ if (ddConfiguration.prefersActionMenuStyle) {
+ _UIContextMenuStyle *style = [_UIContextMenuStyle defaultStyle];
+ style.preferredLayout = _UIContextMenuLayoutActionsOnly;
+ return style;
+ }
+ }
+#endif
+
+ return nil;
+}
+
- (void)contextMenuInteraction:(UIContextMenuInteraction *)interaction willPerformPreviewActionForMenuWithConfiguration:(UIContextMenuConfiguration *)configuration animator:(id<UIContextMenuInteractionCommitAnimating>)animator
{
if (!_webView)
@@ -8247,6 +8264,45 @@
[uiDelegate _webView:_webView contextMenuForElement:_contextMenuElementInfo.get() willCommitWithAnimator:animator];
ALLOW_DEPRECATED_DECLARATIONS_END
}
+
+#if defined(DD_CONTEXT_MENU_SPI_VERSION) && DD_CONTEXT_MENU_SPI_VERSION >= 2
+ if ([configuration isKindOfClass:getDDContextMenuConfigurationClass()]) {
+ DDContextMenuConfiguration *ddConfiguration = static_cast<DDContextMenuConfiguration *>(configuration);
+
+ BOOL shouldExpandPreview = NO;
+ RetainPtr<UIViewController> presentedViewController;
+
+#if defined(DD_CONTEXT_MENU_SPI_VERSION) && DD_CONTEXT_MENU_SPI_VERSION >= 3
+ shouldExpandPreview = !!ddConfiguration.interactionViewControllerProvider;
+ if (shouldExpandPreview)
+ presentedViewController = ddConfiguration.interactionViewControllerProvider();
+#else
+ shouldExpandPreview = ddConfiguration.expandPreviewOnInteraction;
+ presentedViewController = animator.previewViewController;
+#endif
+
+ if (shouldExpandPreview) {
+ animator.preferredCommitStyle = UIContextMenuInteractionCommitStylePop;
+
+ // We will re-present modally on the same VC that is currently presenting the preview in a context menu.
+ RetainPtr<UIViewController> presentingViewController = animator.previewViewController.presentingViewController;
+
+ [animator addAnimations:^{
+ [presentingViewController presentViewController:presentedViewController.get() animated:NO completion:nil];
+ }];
+ return;
+ }
+
+ if (NSURL *interactionURL = ddConfiguration.interactionURL) {
+ animator.preferredCommitStyle = UIContextMenuInteractionCommitStylePop;
+
+ [animator addAnimations:^{
+ [[UIApplication sharedApplication] openURL:interactionURL withCompletionHandler:nil];
+ }];
+ return;
+ }
+ }
+#endif
}
- (void)contextMenuInteraction:(UIContextMenuInteraction *)interaction willEndForConfiguration:(UIContextMenuConfiguration *)configuration animator:(nullable id<UIContextMenuInteractionAnimating>)animator
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes