WebKit Bugzilla
Attachment 372505 Details for
Bug 199045
: No menu pop-up when long pressing on a link in Firefox app
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-199045-20190620105839.patch (text/plain), 9.88 KB, created by
Dean Jackson
on 2019-06-19 17:58:40 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Dean Jackson
Created:
2019-06-19 17:58:40 PDT
Size:
9.88 KB
patch
obsolete
>Subversion Revision: 246601 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index ca245beb3969c159e67e518c551b78c24a8ae48a..9d2743f98991261890524fd785477ed62ec5667b 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,26 @@ >+2019-06-19 Dean Jackson <dino@apple.com> >+ >+ No menu pop-up when long pressing on a link in Firefox app >+ https://bugs.webkit.org/show_bug.cgi?id=199045 >+ <rdar://problem/51422407> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add a version check for linking on-or-after iOS 13. When >+ that isn't true, we don't use UIContextMenuInteraction >+ and instead fall back on the legacy UIPreviewItem API. >+ >+ * UIProcess/Cocoa/VersionChecks.h: Add FirstThatHasUIContextMenuInteraction. >+ * UIProcess/ios/WKContentViewInteraction.h: >+ * UIProcess/ios/WKContentViewInteraction.mm: >+ (-[WKContentView _shouldUseContextMenus]): New method to decide if we should >+ use context menus or preview items. >+ (-[WKContentView setupInteraction]): Make the decision at runtime rather than >+ compile time. >+ (-[WKContentView _contentsOfUserInterfaceItem:]): Ditto. >+ (-[WKContentView _registerPreview]): Ditto. >+ (-[WKContentView _unregisterPreview]): Ditto. >+ > 2019-06-19 Alex Christensen <achristensen@webkit.org> > > Update preview API deprecation message. >diff --git a/Source/WebKit/UIProcess/Cocoa/VersionChecks.h b/Source/WebKit/UIProcess/Cocoa/VersionChecks.h >index d15521d5e2d6b791cefd617757887c372dd14575..ed2ac70d08b27ff857d2d8c5c968dec8196debaf 100644 >--- a/Source/WebKit/UIProcess/Cocoa/VersionChecks.h >+++ b/Source/WebKit/UIProcess/Cocoa/VersionChecks.h >@@ -72,6 +72,7 @@ enum class SDKVersion : uint32_t { > FirstThatDecidesPolicyBeforeLoadingQuickLookPreview = DYLD_IOS_VERSION_FIRST_THAT_DECIDES_POLICY_BEFORE_LOADING_QUICK_LOOK_PREVIEW, > FirstWithExceptionsForRelatedWebViewsUsingDifferentDataStores = DYLD_IOS_VERSION_FIRST_WITH_EXCEPTIONS_FOR_RELATED_WEBVIEWS_USING_DIFFERENT_DATA_STORES, > FirstWithModernCompabilityModeByDefault = DYLD_IOS_VERSION_FIRST_WITH_MODERN_COMPATIBILITY_MODE_BY_DEFAULT, >+ FirstThatHasUIContextMenuInteraction = DYLD_IOS_VERSION_13_0, > #elif PLATFORM(MAC) > FirstWithNetworkCache = DYLD_MACOSX_VERSION_10_11, > FirstWithExceptionsForDuplicateCompletionHandlerCalls = DYLD_MACOSX_VERSION_10_13, >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >index 30c0adb21ab7cb1dd7d928244813e62a308c43d5..7b6ef589532aa78a69c481fa351b9e3a8e00d1a9 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h >@@ -249,9 +249,8 @@ struct WKAutoCorrectionData { > RetainPtr<UIViewController> _contextMenuLegacyPreviewController; > RetainPtr<UIMenu> _contextMenuLegacyMenu; > BOOL _contextMenuHasRequestedLegacyData; >-#else >- RetainPtr<UIPreviewItemController> _previewItemController; > #endif >+ RetainPtr<UIPreviewItemController> _previewItemController; > #endif > > std::unique_ptr<WebKit::SmartMagnificationController> _smartMagnificationController; >@@ -535,10 +534,11 @@ FOR_EACH_PRIVATE_WKCONTENTVIEW_ACTION(DECLARE_WKCONTENTVIEW_ACTION_FOR_WEB_VIEW) > > #if HAVE(LINK_PREVIEW) > #if USE(UICONTEXTMENU) >-@interface WKContentView (WKInteractionPreview) <UIContextMenuInteractionDelegate> >+@interface WKContentView (WKInteractionPreview) <UIContextMenuInteractionDelegate, UIPreviewItemDelegate> > #else > @interface WKContentView (WKInteractionPreview) <UIPreviewItemDelegate> > #endif >+- (bool)_shouldUseContextMenus; > - (void)_registerPreview; > - (void)_unregisterPreview; > @end >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >index c8c4dc5c460466b427b3acb908c7a4bad91f1ca4..de259b6fa065f2b10c3f840bc77eb7f54241e01b 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -42,6 +42,7 @@ > #import "SmartMagnificationController.h" > #import "TextInputSPI.h" > #import "UIKitSPI.h" >+#import "VersionChecks.h" > #import "WKActionSheetAssistant.h" > #import "WKContextMenuElementInfoInternal.h" > #import "WKDatePickerViewController.h" >@@ -768,9 +769,11 @@ static inline bool hasFocusedElement(WebKit::FocusedElementInformation focusedEl > [_highlightLongPressGestureRecognizer setDelay:highlightDelay]; > [_highlightLongPressGestureRecognizer setDelegate:self]; > >-#if HAVE(LINK_PREVIEW) && !USE(UICONTEXTMENU) >- [self addGestureRecognizer:_highlightLongPressGestureRecognizer.get()]; >- [self _createAndConfigureLongPressGestureRecognizer]; >+#if HAVE(LINK_PREVIEW) >+ if (![self _shouldUseContextMenus]) { >+ [self addGestureRecognizer:_highlightLongPressGestureRecognizer.get()]; >+ [self _createAndConfigureLongPressGestureRecognizer]; >+ } > #endif > > #if ENABLE(DATA_INTERACTION) >@@ -7367,12 +7370,11 @@ static WebEventFlags webEventFlagsForUIKeyModifierFlags(UIKeyModifierFlags flags > > #if HAVE(LINK_PREVIEW) > if ([userInterfaceItem isEqualToString:@"linkPreviewPopoverContents"]) { >-#if USE(UICONTEXTMENU) >- return @{ userInterfaceItem: @{ @"pageURL": WTF::userVisibleString(_positionInformation.url) } }; >-#else >+ if ([self _shouldUseContextMenus]) >+ return @{ userInterfaceItem: @{ @"pageURL": WTF::userVisibleString(_positionInformation.url) } }; >+ > NSString *url = [_previewItemController previewData][UIPreviewDataLink]; > return @{ userInterfaceItem: @{ @"pageURL": url } }; >-#endif > } > #endif > >@@ -7411,35 +7413,68 @@ static NSString *previewIdentifierForElementAction(_WKElementAction *action) > return nil; > } > >-#if USE(UICONTEXTMENU) >- > @implementation WKContentView (WKInteractionPreview) > >+- (bool)_shouldUseContextMenus >+{ >+#if USE(UICONTEXTMENU) >+ return linkedOnOrAfter(WebKit::SDKVersion::FirstThatHasUIContextMenuInteraction); >+#endif >+ return false; >+} >+ > - (void)_registerPreview > { > if (!_webView.allowsLinkPreview) > return; > >- _contextMenuInteraction = adoptNS([[UIContextMenuInteraction alloc] initWithDelegate:self]); >- _contextMenuHasRequestedLegacyData = NO; >- [self addInteraction:_contextMenuInteraction.get()]; >+#if USE(UICONTEXTMENU) >+ if ([self _shouldUseContextMenus]) { >+ _contextMenuInteraction = adoptNS([[UIContextMenuInteraction alloc] initWithDelegate:self]); >+ _contextMenuHasRequestedLegacyData = NO; >+ [self addInteraction:_contextMenuInteraction.get()]; > >- [self _showLinkPreviewsPreferenceChanged:nil]; >+ [self _showLinkPreviewsPreferenceChanged:nil]; > >- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_showLinkPreviewsPreferenceChanged:) name:webkitShowLinkPreviewsPreferenceChangedNotification object:nil]; >+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_showLinkPreviewsPreferenceChanged:) name:webkitShowLinkPreviewsPreferenceChangedNotification object:nil]; >+ >+ return; >+ } >+#endif >+ >+ if (!_webView.allowsLinkPreview) >+ return; >+ >+ _previewItemController = adoptNS([[UIPreviewItemController alloc] initWithView:self]); >+ [_previewItemController setDelegate:self]; >+ _previewGestureRecognizer = _previewItemController.get().presentationGestureRecognizer; >+ if ([_previewItemController respondsToSelector:@selector(presentationSecondaryGestureRecognizer)]) >+ _previewSecondaryGestureRecognizer = _previewItemController.get().presentationSecondaryGestureRecognizer; > } > > - (void)_unregisterPreview > { >- if (!_contextMenuInteraction) >- return; >+#if USE(UICONTEXTMENU) >+ if ([self _shouldUseContextMenus]) { >+ if (!_contextMenuInteraction) >+ return; > >- [self removeInteraction:_contextMenuInteraction.get()]; >- _contextMenuInteraction = nil; >+ [self removeInteraction:_contextMenuInteraction.get()]; >+ _contextMenuInteraction = nil; >+ >+ [[NSNotificationCenter defaultCenter] removeObserver:self name:webkitShowLinkPreviewsPreferenceChangedNotification object:nil]; >+ return; >+ } >+#endif > >- [[NSNotificationCenter defaultCenter] removeObserver:self name:webkitShowLinkPreviewsPreferenceChangedNotification object:nil]; >+ [_previewItemController setDelegate:nil]; >+ _previewGestureRecognizer = nil; >+ _previewSecondaryGestureRecognizer = nil; >+ _previewItemController = nil; > } > >+#if USE(UICONTEXTMENU) >+ > - (void)_showLinkPreviewsPreferenceChanged:(NSNotification *)notification > { > Boolean keyExistsAndHasValidFormat = false; >@@ -7987,31 +8022,7 @@ static RetainPtr<UITargetedPreview> createTargetedPreview(UIImage *image, UIView > _contextMenuElementInfo = nullptr; > } > >-@end >- >-#else >- >-@implementation WKContentView (WKInteractionPreview) >- >-- (void)_registerPreview >-{ >- if (!_webView.allowsLinkPreview) >- return; >- >- _previewItemController = adoptNS([[UIPreviewItemController alloc] initWithView:self]); >- [_previewItemController setDelegate:self]; >- _previewGestureRecognizer = _previewItemController.get().presentationGestureRecognizer; >- if ([_previewItemController respondsToSelector:@selector(presentationSecondaryGestureRecognizer)]) >- _previewSecondaryGestureRecognizer = _previewItemController.get().presentationSecondaryGestureRecognizer; >-} >- >-- (void)_unregisterPreview >-{ >- [_previewItemController setDelegate:nil]; >- _previewGestureRecognizer = nil; >- _previewSecondaryGestureRecognizer = nil; >- _previewItemController = nil; >-} >+#endif // USE(UICONTEXTMENU) > > - (BOOL)_interactionShouldBeginFromPreviewItemController:(UIPreviewItemController *)controller forPosition:(CGPoint)position > { >@@ -8337,8 +8348,6 @@ static RetainPtr<UITargetedPreview> createTargetedPreview(UIImage *image, UIView > > @end > >-#endif // USE(UICONTEXTMENU) >- > #endif // HAVE(LINK_PREVIEW) > > // UITextRange, UITextPosition and UITextSelectionRect implementations for WK2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
thorton
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 199045
: 372505 |
372506
|
372511