Changeset 247321 in webkit
- Timestamp:
- Jul 10, 2019 1:04:26 PM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r247317 r247321 1 2019-07-10 Tim Horton <timothy_horton@apple.com> 2 3 Context menus are not presented for WKWebViews that don't have UIDelegates 4 https://bugs.webkit.org/show_bug.cgi?id=199678 5 6 Reviewed by Dean Jackson. 7 8 * UIProcess/ios/WKContentViewInteraction.mm: 9 (-[WKContentView continueContextMenuInteraction:]): 10 Remove this unnecessary early-return if we don't have a UIDelegate. 11 We have a default behavior that we totally want to happen. 12 Also, rename completion() to continueWithContextMenuConfiguration() 13 to reduce confusion between completion() and completionBlock() in 14 this method. 15 1 16 2019-07-10 Commit Queue <commit-queue@webkit.org> 2 17 -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r247265 r247321 7802 7802 } 7803 7803 7804 - (void)continueContextMenuInteraction:(void(^)(UIContextMenuConfiguration *))co mpletion7804 - (void)continueContextMenuInteraction:(void(^)(UIContextMenuConfiguration *))continueWithContextMenuConfiguration 7805 7805 { 7806 7806 if (!_positionInformation.touchCalloutEnabled) 7807 return co mpletion(nil);7807 return continueWithContextMenuConfiguration(nil); 7808 7808 7809 7809 if (!_positionInformation.isLink && !_positionInformation.isImage && !_positionInformation.isAttachment) 7810 return co mpletion(nil);7810 return continueWithContextMenuConfiguration(nil); 7811 7811 7812 7812 URL linkURL = _positionInformation.url; 7813 7813 7814 7814 if (_positionInformation.isLink && linkURL.isEmpty()) 7815 return co mpletion(nil);7815 return continueWithContextMenuConfiguration(nil); 7816 7816 7817 7817 auto uiDelegate = static_cast<id<WKUIDelegatePrivate>>(_webView.UIDelegate); 7818 if (!uiDelegate)7819 return completion(nil);7820 7818 7821 7819 if (needsDeprecatedPreviewAPI(uiDelegate)) { 7822 7823 7820 if (_positionInformation.isLink) { 7824 7821 ALLOW_DEPRECATED_DECLARATIONS_BEGIN … … 7826 7823 auto previewElementInfo = adoptNS([[WKPreviewElementInfo alloc] _initWithLinkURL:linkURL]); 7827 7824 if (![uiDelegate webView:_webView shouldPreviewElement:previewElementInfo.get()]) 7828 return co mpletion(nil);7825 return continueWithContextMenuConfiguration(nil); 7829 7826 } 7830 7827 ALLOW_DEPRECATED_DECLARATIONS_END … … 7835 7832 #if ENABLE(DATA_DETECTION) 7836 7833 if (!WebCore::DataDetection::canBePresentedByDataDetectors(linkURL)) 7837 return co mpletion(nil);7834 return continueWithContextMenuConfiguration(nil); 7838 7835 #endif 7839 7836 } … … 7866 7863 7867 7864 // FIXME: Should we provide an identifier and ASSERT in delegates if we don't match? 7868 return co mpletion([UIContextMenuConfiguration configurationWithIdentifier:nil previewProvider:contentPreviewProvider actionProvider:actionMenuProvider]);7869 } 7870 7871 auto completionBlock = makeBlockPtr([co mpletion = makeBlockPtr(completion), linkURL = WTFMove(linkURL), weakSelf = WeakObjCPtr<WKContentView>(self)] (UIContextMenuConfiguration *configurationFromWKUIDelegate) mutable {7865 return continueWithContextMenuConfiguration([UIContextMenuConfiguration configurationWithIdentifier:nil previewProvider:contentPreviewProvider actionProvider:actionMenuProvider]); 7866 } 7867 7868 auto completionBlock = makeBlockPtr([continueWithContextMenuConfiguration = makeBlockPtr(continueWithContextMenuConfiguration), linkURL = WTFMove(linkURL), weakSelf = WeakObjCPtr<WKContentView>(self)] (UIContextMenuConfiguration *configurationFromWKUIDelegate) mutable { 7872 7869 7873 7870 auto strongSelf = weakSelf.get(); 7874 7871 if (!strongSelf) 7875 return co mpletion(nil);7872 return continueWithContextMenuConfiguration(nil); 7876 7873 7877 7874 if (configurationFromWKUIDelegate) { 7878 7875 strongSelf->_contextMenuActionProviderDelegateNeedsOverride = YES; 7879 co mpletion(configurationFromWKUIDelegate);7876 continueWithContextMenuConfiguration(configurationFromWKUIDelegate); 7880 7877 return; 7881 7878 } … … 7890 7887 // <rdar://problem/50572283> 7891 7888 if (!linkURL.protocolIsInHTTPFamily() && !WebCore::DataDetection::canBePresentedByDataDetectors(linkURL)) 7892 return co mpletion(nil);7889 return continueWithContextMenuConfiguration(nil); 7893 7890 7894 7891 BEGIN_BLOCK_OBJC_EXCEPTIONS; … … 7899 7896 strongSelf->_contextMenuActionProviderDelegateNeedsOverride = YES; 7900 7897 if (strongSelf->_showLinkPreviews) 7901 return co mpletion(configurationFromDD);7902 return co mpletion([UIContextMenuConfiguration configurationWithIdentifier:[configurationFromDD identifier] previewProvider:nil actionProvider:[configurationFromDD actionProvider]]);7898 return continueWithContextMenuConfiguration(configurationFromDD); 7899 return continueWithContextMenuConfiguration([UIContextMenuConfiguration configurationWithIdentifier:[configurationFromDD identifier] previewProvider:nil actionProvider:[configurationFromDD actionProvider]]); 7903 7900 } 7904 7901 END_BLOCK_OBJC_EXCEPTIONS; 7905 7902 #endif 7906 return co mpletion(nil);7903 return continueWithContextMenuConfiguration(nil); 7907 7904 }); 7908 7905
Note: See TracChangeset
for help on using the changeset viewer.