Title: [247920] trunk/Source/WebKit
- Revision
- 247920
- Author
- [email protected]
- Date
- 2019-07-29 14:19:41 -0700 (Mon, 29 Jul 2019)
Log Message
Contextual menu does not present when holding an embedded photo but works with link and attachments
https://bugs.webkit.org/show_bug.cgi?id=200239
<rdar://problem/53318733>
Reviewed by Tim Horton.
If the user long-pressed on an image, and the client implemented the new API but did
not provide a configuration, we were not falling back to the default behaviour of
giving a menu allowing the user to copy/share/save the image.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView continueContextMenuInteraction:]): If we get through the delegates,
and the element is an image, return the default configuration.
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (247919 => 247920)
--- trunk/Source/WebKit/ChangeLog 2019-07-29 20:30:41 UTC (rev 247919)
+++ trunk/Source/WebKit/ChangeLog 2019-07-29 21:19:41 UTC (rev 247920)
@@ -1,3 +1,19 @@
+2019-07-29 Dean Jackson <[email protected]>
+
+ Contextual menu does not present when holding an embedded photo but works with link and attachments
+ https://bugs.webkit.org/show_bug.cgi?id=200239
+ <rdar://problem/53318733>
+
+ Reviewed by Tim Horton.
+
+ If the user long-pressed on an image, and the client implemented the new API but did
+ not provide a configuration, we were not falling back to the default behaviour of
+ giving a menu allowing the user to copy/share/save the image.
+
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView continueContextMenuInteraction:]): If we get through the delegates,
+ and the element is an image, return the default configuration.
+
2019-07-29 Chris Dumez <[email protected]>
Remove unnecessary null check under WebResourceLoadStatisticsStore::hasStorageAccess()
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (247919 => 247920)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2019-07-29 20:30:41 UTC (rev 247919)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2019-07-29 21:19:41 UTC (rev 247920)
@@ -7963,6 +7963,35 @@
return;
}
+ if (strongSelf->_positionInformation.isImage) {
+ ASSERT(strongSelf->_positionInformation.image);
+ auto cgImage = strongSelf->_positionInformation.image->makeCGImageCopy();
+
+ strongSelf->_contextMenuActionProviderDelegateNeedsOverride = NO;
+
+ auto elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithInteractionInformationAtPosition:strongSelf->_positionInformation]);
+
+ UIContextMenuActionProvider actionMenuProvider = [weakSelf, elementInfo] (NSArray<UIMenuElement *> *) -> UIMenu * {
+ auto strongSelf = weakSelf.get();
+ if (!strongSelf)
+ return nil;
+
+ RetainPtr<NSArray<_WKElementAction *>> defaultActionsFromAssistant = [strongSelf->_actionSheetAssistant defaultActionsForImageSheet:elementInfo.get()];
+ auto actions = menuElementsFromDefaultActions(defaultActionsFromAssistant, elementInfo);
+ return [UIMenu menuWithTitle:@"" children:actions];
+ };
+
+ UIContextMenuContentPreviewProvider contentPreviewProvider = [weakSelf, cgImage, elementInfo] () -> UIViewController * {
+ auto strongSelf = weakSelf.get();
+ if (!strongSelf)
+ return nil;
+
+ return [[WKImagePreviewViewController alloc] initWithCGImage:cgImage defaultActions:nil elementInfo:elementInfo.get()];
+ };
+
+ return continueWithContextMenuConfiguration([UIContextMenuConfiguration configurationWithIdentifier:nil previewProvider:contentPreviewProvider actionProvider:actionMenuProvider]);
+ }
+
// At this point we have an object we might want to show a context menu for, but the
// client was unable to handle it. Before giving up, we ask DataDetectors.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes