Title: [247321] trunk/Source/WebKit
- Revision
- 247321
- Author
- [email protected]
- Date
- 2019-07-10 13:04:26 -0700 (Wed, 10 Jul 2019)
Log Message
Context menus are not presented for WKWebViews that don't have UIDelegates
https://bugs.webkit.org/show_bug.cgi?id=199678
Reviewed by Dean Jackson.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView continueContextMenuInteraction:]):
Remove this unnecessary early-return if we don't have a UIDelegate.
We have a default behavior that we totally want to happen.
Also, rename completion() to continueWithContextMenuConfiguration()
to reduce confusion between completion() and completionBlock() in
this method.
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (247320 => 247321)
--- trunk/Source/WebKit/ChangeLog 2019-07-10 20:02:30 UTC (rev 247320)
+++ trunk/Source/WebKit/ChangeLog 2019-07-10 20:04:26 UTC (rev 247321)
@@ -1,3 +1,18 @@
+2019-07-10 Tim Horton <[email protected]>
+
+ Context menus are not presented for WKWebViews that don't have UIDelegates
+ https://bugs.webkit.org/show_bug.cgi?id=199678
+
+ Reviewed by Dean Jackson.
+
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView continueContextMenuInteraction:]):
+ Remove this unnecessary early-return if we don't have a UIDelegate.
+ We have a default behavior that we totally want to happen.
+ Also, rename completion() to continueWithContextMenuConfiguration()
+ to reduce confusion between completion() and completionBlock() in
+ this method.
+
2019-07-10 Commit Queue <[email protected]>
Unreviewed, rolling out r247223.
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (247320 => 247321)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2019-07-10 20:02:30 UTC (rev 247320)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2019-07-10 20:04:26 UTC (rev 247321)
@@ -7801,31 +7801,28 @@
} forRequest:request];
}
-- (void)continueContextMenuInteraction:(void(^)(UIContextMenuConfiguration *))completion
+- (void)continueContextMenuInteraction:(void(^)(UIContextMenuConfiguration *))continueWithContextMenuConfiguration
{
if (!_positionInformation.touchCalloutEnabled)
- return completion(nil);
+ return continueWithContextMenuConfiguration(nil);
if (!_positionInformation.isLink && !_positionInformation.isImage && !_positionInformation.isAttachment)
- return completion(nil);
+ return continueWithContextMenuConfiguration(nil);
URL linkURL = _positionInformation.url;
if (_positionInformation.isLink && linkURL.isEmpty())
- return completion(nil);
+ return continueWithContextMenuConfiguration(nil);
auto uiDelegate = static_cast<id<WKUIDelegatePrivate>>(_webView.UIDelegate);
- if (!uiDelegate)
- return completion(nil);
if (needsDeprecatedPreviewAPI(uiDelegate)) {
-
if (_positionInformation.isLink) {
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
if ([uiDelegate respondsToSelector:@selector(webView:shouldPreviewElement:)]) {
auto previewElementInfo = adoptNS([[WKPreviewElementInfo alloc] _initWithLinkURL:linkURL]);
if (![uiDelegate webView:_webView shouldPreviewElement:previewElementInfo.get()])
- return completion(nil);
+ return continueWithContextMenuConfiguration(nil);
}
ALLOW_DEPRECATED_DECLARATIONS_END
@@ -7834,7 +7831,7 @@
if (!linkURL.protocolIsInHTTPFamily()) {
#if ENABLE(DATA_DETECTION)
if (!WebCore::DataDetection::canBePresentedByDataDetectors(linkURL))
- return completion(nil);
+ return continueWithContextMenuConfiguration(nil);
#endif
}
}
@@ -7865,18 +7862,18 @@
};
// FIXME: Should we provide an identifier and ASSERT in delegates if we don't match?
- return completion([UIContextMenuConfiguration configurationWithIdentifier:nil previewProvider:contentPreviewProvider actionProvider:actionMenuProvider]);
+ return continueWithContextMenuConfiguration([UIContextMenuConfiguration configurationWithIdentifier:nil previewProvider:contentPreviewProvider actionProvider:actionMenuProvider]);
}
- auto completionBlock = makeBlockPtr([completion = makeBlockPtr(completion), linkURL = WTFMove(linkURL), weakSelf = WeakObjCPtr<WKContentView>(self)] (UIContextMenuConfiguration *configurationFromWKUIDelegate) mutable {
+ auto completionBlock = makeBlockPtr([continueWithContextMenuConfiguration = makeBlockPtr(continueWithContextMenuConfiguration), linkURL = WTFMove(linkURL), weakSelf = WeakObjCPtr<WKContentView>(self)] (UIContextMenuConfiguration *configurationFromWKUIDelegate) mutable {
auto strongSelf = weakSelf.get();
if (!strongSelf)
- return completion(nil);
+ return continueWithContextMenuConfiguration(nil);
if (configurationFromWKUIDelegate) {
strongSelf->_contextMenuActionProviderDelegateNeedsOverride = YES;
- completion(configurationFromWKUIDelegate);
+ continueWithContextMenuConfiguration(configurationFromWKUIDelegate);
return;
}
@@ -7889,7 +7886,7 @@
// FIXME: Support _javascript_ urls here. But make sure they don't show a preview.
// <rdar://problem/50572283>
if (!linkURL.protocolIsInHTTPFamily() && !WebCore::DataDetection::canBePresentedByDataDetectors(linkURL))
- return completion(nil);
+ return continueWithContextMenuConfiguration(nil);
BEGIN_BLOCK_OBJC_EXCEPTIONS;
auto ddContextMenuActionClass = getDDContextMenuActionClass();
@@ -7898,12 +7895,12 @@
UIContextMenuConfiguration *configurationFromDD = [ddContextMenuActionClass contextMenuConfigurationForURL:linkURL identifier:strongSelf->_positionInformation.dataDetectorIdentifier selectedText:[strongSelf selectedText] results:strongSelf->_positionInformation.dataDetectorResults.get() inView:strongSelf.get() context:context menuIdentifier:nil];
strongSelf->_contextMenuActionProviderDelegateNeedsOverride = YES;
if (strongSelf->_showLinkPreviews)
- return completion(configurationFromDD);
- return completion([UIContextMenuConfiguration configurationWithIdentifier:[configurationFromDD identifier] previewProvider:nil actionProvider:[configurationFromDD actionProvider]]);
+ return continueWithContextMenuConfiguration(configurationFromDD);
+ return continueWithContextMenuConfiguration([UIContextMenuConfiguration configurationWithIdentifier:[configurationFromDD identifier] previewProvider:nil actionProvider:[configurationFromDD actionProvider]]);
}
END_BLOCK_OBJC_EXCEPTIONS;
#endif
- return completion(nil);
+ return continueWithContextMenuConfiguration(nil);
});
_contextMenuActionProviderDelegateNeedsOverride = NO;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes