Changeset 248380 in webkit
- Timestamp:
- Aug 7, 2019 12:05:43 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/PAL/ChangeLog
r248371 r248380 1 2019-08-06 Dean Jackson <dino@apple.com> 2 3 Context menu on a universal link produces a blank preview 4 https://bugs.webkit.org/show_bug.cgi?id=200485 5 <rdar://problem/53699620> 6 7 Reviewed by Tim Horton. 8 9 Define iTunesStoreURL from CoreServices. 10 11 * pal/spi/cocoa/LaunchServicesSPI.h: 12 1 13 2019-08-07 Ryan Haddad <ryanhaddad@apple.com> 2 14 -
trunk/Source/WebCore/PAL/pal/spi/cocoa/LaunchServicesSPI.h
r248371 r248380 34 34 #elif PLATFORM(IOS_FAMILY) 35 35 #import <MobileCoreServices/LSAppLinkPriv.h> 36 #elif PLATFORM(IOS) 37 #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000 38 #import <CoreServices/LSURLOverridePriv.h> 39 #else 40 #import <CoreServices/LSApplicationWorkspace.h> 41 #endif 36 42 #endif 37 43 38 #endif 44 #endif // USE(APPLE_INTERNAL_SDK) 39 45 40 46 #if HAVE(APP_LINKS) … … 74 80 #endif 75 81 82 @interface NSURL () 83 - (NSURL *)iTunesStoreURL; 84 @end 85 76 86 #if PLATFORM(MAC) 77 87 enum LSSessionID { -
trunk/Source/WebKit/ChangeLog
r248373 r248380 1 2019-08-06 Dean Jackson <dino@apple.com> 2 3 Context menu on a universal link produces a blank preview 4 https://bugs.webkit.org/show_bug.cgi?id=200485 5 <rdar://problem/53699620> 6 7 Reviewed by Tim Horton. 8 9 If the context menu is activated on an iTunesStore URL, pass it 10 on to DataDetectors, who should know how to handle it. 11 12 Two drive-by fixes: 13 - make it clear that early returns do not produce a value. Instead call the 14 completion handler first, then return. 15 - The new API DataDetectors case doesn't need to worry about hiding link previews 16 as DataDetectors itself will handle that. 17 18 * UIProcess/ios/WKContentViewInteraction.mm: If the URL is an iTunesStoreURL 19 (as defined by CoreServices), let DataDetectors handle it. 20 (-[WKContentView assignLegacyDataForContextMenuInteraction]): 21 (-[WKContentView continueContextMenuInteraction:]): 22 (-[WKContentView continueContextMenuInteractionWithDataDetectors:]): New method to 23 use DataDetectors if possible. 24 1 25 2019-08-07 Priyanka Agarwal <pagarwal999@apple.com> 2 26 -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r248371 r248380 107 107 #import <pal/spi/cg/CoreGraphicsSPI.h> 108 108 #import <pal/spi/cocoa/DataDetectorsCoreSPI.h> 109 #import <pal/spi/cocoa/LaunchServicesSPI.h> 109 110 #import <pal/spi/ios/DataDetectorsUISPI.h> 110 111 #import <pal/spi/ios/GraphicsServicesSPI.h> … … 7809 7810 // Previously, UIPreviewItemController would detect the case where there was no previewViewController 7810 7811 // and create one. We need to replicate this code for the new API. 7811 if (!previewViewController ) {7812 if (!previewViewController || [(NSURL *)url iTunesStoreURL]) { 7812 7813 auto ddContextMenuActionClass = getDDContextMenuActionClass(); 7813 7814 if ([ddContextMenuActionClass respondsToSelector:@selector(contextMenuConfigurationForURL:identifier:selectedText:results:inView:context:menuIdentifier:)]) { … … 7954 7955 _page->startInteractionWithElementAtPosition(_positionInformation.request.point); 7955 7956 7956 // FIXME: Should we provide an identifier and ASSERT in delegates if we don't match? 7957 return continueWithContextMenuConfiguration([UIContextMenuConfiguration configurationWithIdentifier:nil previewProvider:contentPreviewProvider actionProvider:actionMenuProvider]); 7958 } 7957 continueWithContextMenuConfiguration([UIContextMenuConfiguration configurationWithIdentifier:nil previewProvider:contentPreviewProvider actionProvider:actionMenuProvider]); 7958 return; 7959 } 7960 7961 #if ENABLE(DATA_DETECTION) 7962 if ([(NSURL *)linkURL iTunesStoreURL]) { 7963 if ([self continueContextMenuInteractionWithDataDetectors:continueWithContextMenuConfiguration]) 7964 return; 7965 } 7966 #endif 7959 7967 7960 7968 auto completionBlock = makeBlockPtr([continueWithContextMenuConfiguration = makeBlockPtr(continueWithContextMenuConfiguration), linkURL = WTFMove(linkURL), weakSelf = WeakObjCPtr<WKContentView>(self)] (UIContextMenuConfiguration *configurationFromWKUIDelegate) mutable { 7961 7969 7962 7970 auto strongSelf = weakSelf.get(); 7963 if (!strongSelf) 7964 return continueWithContextMenuConfiguration(nil); 7971 if (!strongSelf) { 7972 continueWithContextMenuConfiguration(nil); 7973 return; 7974 } 7965 7975 7966 7976 if (configurationFromWKUIDelegate) { … … 7997 8007 }; 7998 8008 7999 return continueWithContextMenuConfiguration([UIContextMenuConfiguration configurationWithIdentifier:nil previewProvider:contentPreviewProvider actionProvider:actionMenuProvider]); 8009 continueWithContextMenuConfiguration([UIContextMenuConfiguration configurationWithIdentifier:nil previewProvider:contentPreviewProvider actionProvider:actionMenuProvider]); 8010 return; 8000 8011 } 8001 8012 … … 8008 8019 // FIXME: Support JavaScript urls here. But make sure they don't show a preview. 8009 8020 // <rdar://problem/50572283> 8010 if (!linkURL.protocolIsInHTTPFamily() && !WebCore::DataDetection::canBePresentedByDataDetectors(linkURL)) 8011 return continueWithContextMenuConfiguration(nil); 8012 8013 BEGIN_BLOCK_OBJC_EXCEPTIONS; 8014 auto ddContextMenuActionClass = getDDContextMenuActionClass(); 8015 if ([ddContextMenuActionClass respondsToSelector:@selector(contextMenuConfigurationWithURL:inView:context:menuIdentifier:)]) { 8016 NSDictionary *context = [strongSelf dataDetectionContextForPositionInformation:strongSelf->_positionInformation]; 8017 UIContextMenuConfiguration *configurationFromDD = [ddContextMenuActionClass contextMenuConfigurationForURL:linkURL identifier:strongSelf->_positionInformation.dataDetectorIdentifier selectedText:[strongSelf selectedText] results:strongSelf->_positionInformation.dataDetectorResults.get() inView:strongSelf.get() context:context menuIdentifier:nil]; 8018 strongSelf->_contextMenuActionProviderDelegateNeedsOverride = YES; 8019 strongSelf->_page->startInteractionWithElementAtPosition(strongSelf->_positionInformation.request.point); 8020 if (strongSelf->_showLinkPreviews) 8021 return continueWithContextMenuConfiguration(configurationFromDD); 8022 return continueWithContextMenuConfiguration([UIContextMenuConfiguration configurationWithIdentifier:[configurationFromDD identifier] previewProvider:nil actionProvider:[configurationFromDD actionProvider]]); 8021 if (!linkURL.protocolIsInHTTPFamily() && !WebCore::DataDetection::canBePresentedByDataDetectors(linkURL)) { 8022 continueWithContextMenuConfiguration(nil); 8023 return; 8023 8024 } 8024 END_BLOCK_OBJC_EXCEPTIONS; 8025 #endif 8026 return continueWithContextMenuConfiguration(nil); 8025 8026 if ([strongSelf continueContextMenuInteractionWithDataDetectors:continueWithContextMenuConfiguration.get()]) 8027 return; 8028 #endif 8029 continueWithContextMenuConfiguration(nil); 8027 8030 }); 8028 8031 … … 8048 8051 completionBlock(nil); 8049 8052 } 8053 8054 #if ENABLE(DATA_DETECTION) 8055 - (BOOL)continueContextMenuInteractionWithDataDetectors:(void(^)(UIContextMenuConfiguration *))continueWithContextMenuConfiguration 8056 { 8057 BEGIN_BLOCK_OBJC_EXCEPTIONS; 8058 auto ddContextMenuActionClass = getDDContextMenuActionClass(); 8059 if ([ddContextMenuActionClass respondsToSelector:@selector(contextMenuConfigurationWithURL:inView:context:menuIdentifier:)]) { 8060 URL linkURL = _positionInformation.url; 8061 NSDictionary *context = [self dataDetectionContextForPositionInformation:_positionInformation]; 8062 UIContextMenuConfiguration *configurationFromDD = [ddContextMenuActionClass contextMenuConfigurationForURL:linkURL identifier:_positionInformation.dataDetectorIdentifier selectedText:[self selectedText] results:_positionInformation.dataDetectorResults.get() inView:self context:context menuIdentifier:nil]; 8063 _contextMenuActionProviderDelegateNeedsOverride = YES; 8064 _page->startInteractionWithElementAtPosition(_positionInformation.request.point); 8065 continueWithContextMenuConfiguration(configurationFromDD); 8066 return YES; 8067 } 8068 END_BLOCK_OBJC_EXCEPTIONS; 8069 8070 return NO; 8071 } 8072 #endif 8050 8073 8051 8074 - (NSArray<UIMenuElement *> *)_contextMenuInteraction:(UIContextMenuInteraction *)interaction overrideSuggestedActionsForConfiguration:(UIContextMenuConfiguration *)configuration
Note: See TracChangeset
for help on using the changeset viewer.