Title: [248573] branches/safari-608-branch/Source
- Revision
- 248573
- Author
- [email protected]
- Date
- 2019-08-12 16:42:30 -0700 (Mon, 12 Aug 2019)
Log Message
Cherry-pick r248469. rdar://problem/54130688
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-branch/Source/WebCore/PAL/ChangeLog (248572 => 248573)
--- branches/safari-608-branch/Source/WebCore/PAL/ChangeLog 2019-08-12 23:42:27 UTC (rev 248572)
+++ branches/safari-608-branch/Source/WebCore/PAL/ChangeLog 2019-08-12 23:42:30 UTC (rev 248573)
@@ -1,5 +1,51 @@
2019-08-12 Alan Coon <[email protected]>
+ Cherry-pick r248469. rdar://problem/54130688
+
+ 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 <[email protected]>
+
+ 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-12 Alan Coon <[email protected]>
+
Cherry-pick r248381. rdar://problem/54018115
Context menu on a universal link produces a blank preview
Modified: branches/safari-608-branch/Source/WebCore/PAL/pal/spi/ios/DataDetectorsUISPI.h (248572 => 248573)
--- branches/safari-608-branch/Source/WebCore/PAL/pal/spi/ios/DataDetectorsUISPI.h 2019-08-12 23:42:27 UTC (rev 248572)
+++ branches/safari-608-branch/Source/WebCore/PAL/pal/spi/ios/DataDetectorsUISPI.h 2019-08-12 23:42:30 UTC (rev 248573)
@@ -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-branch/Source/WebKit/ChangeLog (248572 => 248573)
--- branches/safari-608-branch/Source/WebKit/ChangeLog 2019-08-12 23:42:27 UTC (rev 248572)
+++ branches/safari-608-branch/Source/WebKit/ChangeLog 2019-08-12 23:42:30 UTC (rev 248573)
@@ -1,5 +1,66 @@
2019-08-12 Alan Coon <[email protected]>
+ Cherry-pick r248469. rdar://problem/54130688
+
+ 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 <[email protected]>
+
+ 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-12 Alan Coon <[email protected]>
+
Cherry-pick r248456. rdar://problem/54109877
REGRESSION (52279987): Most of the WKUIDelegate contextMenu delegate methods are not being called
Modified: branches/safari-608-branch/Source/WebKit/Platform/spi/ios/UIKitSPI.h (248572 => 248573)
--- branches/safari-608-branch/Source/WebKit/Platform/spi/ios/UIKitSPI.h 2019-08-12 23:42:27 UTC (rev 248572)
+++ branches/safari-608-branch/Source/WebKit/Platform/spi/ios/UIKitSPI.h 2019-08-12 23:42:30 UTC (rev 248573)
@@ -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-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (248572 => 248573)
--- branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2019-08-12 23:42:27 UTC (rev 248572)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2019-08-12 23:42:30 UTC (rev 248573)
@@ -8212,6 +8212,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)
@@ -8263,6 +8280,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
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes