Diff
Modified: trunk/Source/WTF/ChangeLog (289680 => 289681)
--- trunk/Source/WTF/ChangeLog 2022-02-12 00:42:00 UTC (rev 289680)
+++ trunk/Source/WTF/ChangeLog 2022-02-12 01:12:05 UTC (rev 289681)
@@ -1,3 +1,16 @@
+2022-02-11 Wenson Hsieh <[email protected]>
+
+ [iOS] Add a "Copy Cropped Image" context menu item when long pressing images
+ https://bugs.webkit.org/show_bug.cgi?id=236511
+ rdar://88817219
+
+ Reviewed by Devin Rousso.
+
+ Add a compile-time flag to guard availability of the UniformTypeIdentifiers framework. See WebKit/ChangeLog for
+ more information.
+
+ * wtf/PlatformHave.h:
+
2022-02-11 Don Olmstead <[email protected]>
[CMake] Check for MAP_ALIGNED support
Modified: trunk/Source/WTF/wtf/PlatformHave.h (289680 => 289681)
--- trunk/Source/WTF/wtf/PlatformHave.h 2022-02-12 00:42:00 UTC (rev 289680)
+++ trunk/Source/WTF/wtf/PlatformHave.h 2022-02-12 01:12:05 UTC (rev 289681)
@@ -1131,6 +1131,10 @@
#define HAVE_UNIFIED_SPEECHSYNTHESIS_FIX_FOR_81465164 1
#endif
+#if PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 110000)
+#define HAVE_UNIFORM_TYPE_IDENTIFIERS_FRAMEWORK 1
+#endif
+
#if PLATFORM(COCOA)
#define HAVE_AV_DELEGATING_PLAYBACK_COORDINATOR 1
#endif
Modified: trunk/Source/WebKit/ChangeLog (289680 => 289681)
--- trunk/Source/WebKit/ChangeLog 2022-02-12 00:42:00 UTC (rev 289680)
+++ trunk/Source/WebKit/ChangeLog 2022-02-12 01:12:05 UTC (rev 289681)
@@ -1,3 +1,96 @@
+2022-02-11 Wenson Hsieh <[email protected]>
+
+ [iOS] Add a "Copy Cropped Image" context menu item when long pressing images
+ https://bugs.webkit.org/show_bug.cgi?id=236511
+ rdar://88817219
+
+ Reviewed by Devin Rousso.
+
+ Add support for a new context menu item on iOS that allows the user to copy a cropped version of the source
+ image, after invoking markup UI. See below for more details.
+
+ * Configurations/WebKit.xcconfig:
+
+ Link against UniformTypeIdentifiers on macOS 11+, rather than macOS 12+.
+
+ * Platform/cocoa/CocoaImage.h:
+ * Platform/cocoa/CocoaImage.mm:
+ (WebKit::transcode):
+ (WebKit::transcodeWithPreferredMIMEType):
+
+ Move a helper function that transcodes an image to a given UTI into CocoaImage.h, as a standalone function.
+ Also, add a separate helper function here that transcodes an image to a given MIME type (with a fallback UTI, in
+ case the MIME type cannot be mapped to a suitable UTI that conforms to any image UTI). The new call sites of
+ this function are in WKContentViewInteraction.mm.
+
+ * Platform/cocoa/TextRecognitionUtilities.mm:
+ * Shared/ios/InteractionInformationAtPosition.h:
+ * Shared/ios/InteractionInformationAtPosition.mm:
+ (WebKit::InteractionInformationAtPosition::encode const):
+ (WebKit::InteractionInformationAtPosition::decode):
+
+ Add a new `imageMIMEType` member to represent the MIME type of the source image used to generate the bitmap
+ image data in `image`.
+
+ * SourcesCocoa.txt: Add CocoaImage.mm.
+ * UIProcess/API/Cocoa/_WKActivatedElementInfo.mm:
+ (-[_WKActivatedElementInfo _initWithInteractionInformationAtPosition:userInfo:]):
+ (-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:imageMIMEType:]):
+ (-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:imageMIMEType:userInfo:]):
+ (-[_WKActivatedElementInfo imageMIMEType]):
+
+ Add plumbing for `imageMIMEType` from InteractionInformationAtPosition (position information) into
+ _WKActivatedElementInfo, as an internal method. We use this information below, to transcode the resulting image
+ back to the source image format after applying markup, when invoking the new "Copy Cropped Image" item.
+
+ (-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:]): Deleted.
+ (-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:userInfo:]): Deleted.
+ * UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h:
+ * UIProcess/API/Cocoa/_WKElementAction.h:
+ * UIProcess/API/Cocoa/_WKElementAction.mm:
+ (+[_WKElementAction _elementActionWithType:customTitle:assistant:]):
+ (+[_WKElementAction imageForElementActionType:]):
+
+ Add support for the new "Copy Cropped Image" item tag (`_WKElementActionTypeCopyCroppedImage`).
+
+ (elementActionTypeToUIActionIdentifier):
+ (uiActionIdentifierToElementActionType):
+ * UIProcess/ios/WKActionSheetAssistant.h:
+ * UIProcess/ios/WKActionSheetAssistant.mm:
+ (-[WKActionSheetAssistant showImageSheet]):
+ (-[WKActionSheetAssistant defaultActionsForLinkSheet:]):
+ (-[WKActionSheetAssistant defaultActionsForImageSheet:]):
+ (-[WKActionSheetAssistant showLinkSheet]):
+ (-[WKActionSheetAssistant handleElementActionWithType:element:needsInteraction:]):
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView _showAttachmentSheet]):
+ (-[WKContentView performImageAnalysisMarkup:]):
+
+ Use the new `transcodeWithPreferredMIMEType` helper method here.
+
+ (-[WKContentView doAfterComputingImageAnalysisResultsForMarkup:]):
+
+ Remove the TIFF transcoding workaround from this method (see associated changes in Radar for more information).
+
+ (-[WKContentView actionSheetAssistant:copyCroppedImage:sourceMIMEType:]):
+
+ Handle the new action by calling into VisionKit to adjust the source image as needed, and then transcode the
+ resulting CGImageRef back to a format that matches the source image; finally, write this transcoded
+ representation to the general pasteboard.
+
+ (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
+ (-[WKContentView _presentedViewControllerForPreviewItemController:]):
+
+ Pass `imageMIMEType` from position information into the activated element info initializer in several places.
+
+ (WebKit::transcode): Deleted.
+ * WebKit.xcodeproj/project.pbxproj:
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::imagePositionInformation):
+ (WebKit::elementPositionInformation):
+
+ Populate `imageMIMEType` in position information.
+
2022-02-11 Said Abou-Hallawa <[email protected]>
[GPU Process] [CG] Add an ArgumentCoder for CFCharacterSetRef
Modified: trunk/Source/WebKit/Configurations/WebKit.xcconfig (289680 => 289681)
--- trunk/Source/WebKit/Configurations/WebKit.xcconfig 2022-02-12 00:42:00 UTC (rev 289680)
+++ trunk/Source/WebKit/Configurations/WebKit.xcconfig 2022-02-12 01:12:05 UTC (rev 289681)
@@ -123,8 +123,8 @@
WK_UNIFORM_TYPE_IDENTIFIERS_LDFLAGS_iphonesimulator = $(WK_UNIFORM_TYPE_IDENTIFIERS_LDFLAGS$(WK_IOS_14));
WK_UNIFORM_TYPE_IDENTIFIERS_LDFLAGS_maccatalyst = $(WK_UNIFORM_TYPE_IDENTIFIERS_LDFLAGS$(WK_IOS_14));
WK_UNIFORM_TYPE_IDENTIFIERS_LDFLAGS_IOS_SINCE_14 = -framework UniformTypeIdentifiers;
-WK_UNIFORM_TYPE_IDENTIFIERS_LDFLAGS_macosx = $(WK_UNIFORM_TYPE_IDENTIFIERS_LDFLAGS$(WK_MACOS_1200));
-WK_UNIFORM_TYPE_IDENTIFIERS_LDFLAGS_MACOS_SINCE_1200 = -framework UniformTypeIdentifiers;
+WK_UNIFORM_TYPE_IDENTIFIERS_LDFLAGS_macosx = $(WK_UNIFORM_TYPE_IDENTIFIERS_LDFLAGS$(WK_MACOS_1100));
+WK_UNIFORM_TYPE_IDENTIFIERS_LDFLAGS_MACOS_SINCE_1100 = -framework UniformTypeIdentifiers;
WK_UNIFORM_TYPE_IDENTIFIERS_LDFLAGS_watchos = -framework UniformTypeIdentifiers;
WK_UNIFORM_TYPE_IDENTIFIERS_LDFLAGS_watchsimulator = -framework UniformTypeIdentifiers;
WK_UNIFORM_TYPE_IDENTIFIERS_LDFLAGS_appletvos = -framework UniformTypeIdentifiers;
Modified: trunk/Source/WebKit/Platform/cocoa/CocoaImage.h (289680 => 289681)
--- trunk/Source/WebKit/Platform/cocoa/CocoaImage.h 2022-02-12 00:42:00 UTC (rev 289680)
+++ trunk/Source/WebKit/Platform/cocoa/CocoaImage.h 2022-02-12 01:12:05 UTC (rev 289681)
@@ -23,7 +23,9 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <wtf/Compiler.h>
+#import <CoreGraphics/CoreGraphics.h>
+#import <wtf/Compiler.h>
+#import <wtf/RetainPtr.h>
#if USE(APPKIT)
OBJC_CLASS NSImage;
@@ -32,3 +34,12 @@
OBJC_CLASS UIImage;
using CocoaImage = UIImage;
#endif
+
+OBJC_CLASS NSData;
+
+namespace WebKit {
+
+RetainPtr<NSData> transcode(CGImageRef, CFStringRef typeIdentifier);
+std::pair<RetainPtr<NSData>, RetainPtr<CFStringRef>> transcodeWithPreferredMIMEType(CGImageRef, CFStringRef preferredMIMEType, CFStringRef fallbackTypeIdentifier);
+
+} // namespace WebKit
Added: trunk/Source/WebKit/Platform/cocoa/CocoaImage.mm (0 => 289681)
--- trunk/Source/WebKit/Platform/cocoa/CocoaImage.mm (rev 0)
+++ trunk/Source/WebKit/Platform/cocoa/CocoaImage.mm 2022-02-12 01:12:05 UTC (rev 289681)
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "CocoaImage.h"
+
+#import <WebCore/UTIRegistry.h>
+
+#if HAVE(UNIFORM_TYPE_IDENTIFIERS_FRAMEWORK)
+#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
+#else
+#import <CoreServices/CoreServices.h>
+#endif
+
+namespace WebKit {
+
+RetainPtr<NSData> transcode(CGImageRef image, CFStringRef typeIdentifier)
+{
+ if (!image)
+ return nil;
+
+ auto data = "" alloc] init]);
+ auto destination = adoptCF(CGImageDestinationCreateWithData((__bridge CFMutableDataRef)data.get(), typeIdentifier, 1, nil));
+ CGImageDestinationAddImage(destination.get(), image, nil);
+ if (!CGImageDestinationFinalize(destination.get()))
+ return nil;
+
+ return data;
+}
+
+std::pair<RetainPtr<NSData>, RetainPtr<CFStringRef>> transcodeWithPreferredMIMEType(CGImageRef image, CFStringRef preferredMIMEType, CFStringRef fallbackTypeIdentifier)
+{
+ auto targetType = RetainPtr { fallbackTypeIdentifier };
+ if (CFStringGetLength(preferredMIMEType)) {
+#if HAVE(UNIFORM_TYPE_IDENTIFIERS_FRAMEWORK)
+ auto preferredTypeIdentifier = RetainPtr { (__bridge CFStringRef)[UTType typeWithMIMEType:(__bridge NSString *)preferredMIMEType conformingToType:UTTypeImage].identifier };
+#else
+ auto preferredTypeIdentifier = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, preferredMIMEType, kUTTypeImage));
+#endif
+ if (WebCore::isSupportedImageType(preferredTypeIdentifier.get()))
+ targetType = WTFMove(preferredTypeIdentifier);
+ }
+ return { transcode(image, targetType.get()), targetType };
+}
+
+} // namespace WebKit
Modified: trunk/Source/WebKit/Platform/cocoa/TextRecognitionUtilities.mm (289680 => 289681)
--- trunk/Source/WebKit/Platform/cocoa/TextRecognitionUtilities.mm 2022-02-12 00:42:00 UTC (rev 289680)
+++ trunk/Source/WebKit/Platform/cocoa/TextRecognitionUtilities.mm 2022-02-12 01:12:05 UTC (rev 289681)
@@ -28,6 +28,7 @@
#if ENABLE(IMAGE_ANALYSIS)
+#import "CocoaImage.h"
#import "Logging.h"
#import <WebCore/TextRecognitionResult.h>
#import <pal/spi/cocoa/FeatureFlagsSPI.h>
Modified: trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.h (289680 => 289681)
--- trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.h 2022-02-12 00:42:00 UTC (rev 289680)
+++ trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.h 2022-02-12 01:12:05 UTC (rev 289681)
@@ -88,6 +88,7 @@
WebCore::FloatPoint adjustedPointForNodeRespondingToClickEvents;
URL url;
URL imageURL;
+ String imageMIMEType;
String title;
String idAttribute;
WebCore::IntRect bounds;
Modified: trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm (289680 => 289681)
--- trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm 2022-02-12 00:42:00 UTC (rev 289680)
+++ trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm 2022-02-12 01:12:05 UTC (rev 289681)
@@ -56,6 +56,7 @@
encoder << adjustedPointForNodeRespondingToClickEvents;
encoder << url;
encoder << imageURL;
+ encoder << imageMIMEType;
encoder << title;
encoder << idAttribute;
encoder << bounds;
@@ -149,6 +150,9 @@
if (!decoder.decode(result.imageURL))
return false;
+ if (!decoder.decode(result.imageMIMEType))
+ return false;
+
if (!decoder.decode(result.title))
return false;
Modified: trunk/Source/WebKit/SourcesCocoa.txt (289680 => 289681)
--- trunk/Source/WebKit/SourcesCocoa.txt 2022-02-12 00:42:00 UTC (rev 289680)
+++ trunk/Source/WebKit/SourcesCocoa.txt 2022-02-12 01:12:05 UTC (rev 289681)
@@ -83,6 +83,7 @@
Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp
Platform/classifier/ResourceLoadStatisticsClassifier.cpp
+Platform/cocoa/CocoaImage.mm
Platform/cocoa/LayerHostingContext.mm
Platform/cocoa/PaymentAuthorizationPresenter.mm
Platform/cocoa/PaymentAuthorizationViewController.mm
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKActivatedElementInfo.mm (289680 => 289681)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKActivatedElementInfo.mm 2022-02-12 00:42:00 UTC (rev 289680)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKActivatedElementInfo.mm 2022-02-12 01:12:05 UTC (rev 289681)
@@ -43,6 +43,7 @@
WebCore::IntPoint _interactionLocation;
RetainPtr<NSString> _ID;
RefPtr<WebKit::ShareableBitmap> _image;
+ RetainPtr<NSString> _imageMIMEType;
RetainPtr<CocoaImage> _cocoaImage;
#if PLATFORM(IOS_FAMILY)
RetainPtr<NSDictionary> _userInfo;
@@ -63,6 +64,7 @@
_URL = information.url;
_imageURL = information.imageURL;
+ _imageMIMEType = information.imageMIMEType;
_interactionLocation = information.request.point;
_title = information.title;
_boundingRect = information.bounds;
@@ -86,12 +88,12 @@
}
#endif
-- (instancetype)_initWithType:(_WKActivatedElementType)type URL:(NSURL *)url imageURL:(NSURL *)imageURL location:(const WebCore::IntPoint&)location title:(NSString *)title ID:(NSString *)ID rect:(CGRect)rect image:(WebKit::ShareableBitmap*)image
+- (instancetype)_initWithType:(_WKActivatedElementType)type URL:(NSURL *)url imageURL:(NSURL *)imageURL location:(const WebCore::IntPoint&)location title:(NSString *)title ID:(NSString *)ID rect:(CGRect)rect image:(WebKit::ShareableBitmap*)image imageMIMEType:(NSString *)imageMIMEType
{
- return [self _initWithType:type URL:url imageURL:imageURL location:location title:title ID:ID rect:rect image:image userInfo:nil];
+ return [self _initWithType:type URL:url imageURL:imageURL location:location title:title ID:ID rect:rect image:image imageMIMEType:imageMIMEType userInfo:nil];
}
-- (instancetype)_initWithType:(_WKActivatedElementType)type URL:(NSURL *)url imageURL:(NSURL *)imageURL location:(const WebCore::IntPoint&)location title:(NSString *)title ID:(NSString *)ID rect:(CGRect)rect image:(WebKit::ShareableBitmap*)image userInfo:(NSDictionary *)userInfo
+- (instancetype)_initWithType:(_WKActivatedElementType)type URL:(NSURL *)url imageURL:(NSURL *)imageURL location:(const WebCore::IntPoint&)location title:(NSString *)title ID:(NSString *)ID rect:(CGRect)rect image:(WebKit::ShareableBitmap*)image imageMIMEType:(NSString *)imageMIMEType userInfo:(NSDictionary *)userInfo
{
if (!(self = [super init]))
return nil;
@@ -98,6 +100,7 @@
_URL = adoptNS([url copy]);
_imageURL = adoptNS([imageURL copy]);
+ _imageMIMEType = adoptNS(imageMIMEType.copy);
_interactionLocation = location;
_title = adoptNS([title copy]);
_boundingRect = rect;
@@ -126,6 +129,11 @@
return _title.get();
}
+- (NSString *)imageMIMEType
+{
+ return _imageMIMEType.get();
+}
+
- (NSString *)ID
{
return _ID.get();
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h (289680 => 289681)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h 2022-02-12 00:42:00 UTC (rev 289680)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h 2022-02-12 01:12:05 UTC (rev 289681)
@@ -40,9 +40,10 @@
+ (instancetype)activatedElementInfoWithInteractionInformationAtPosition:(const WebKit::InteractionInformationAtPosition&)information userInfo:(NSDictionary *)userInfo;
- (instancetype)_initWithInteractionInformationAtPosition:(const WebKit::InteractionInformationAtPosition&)information userInfo:(NSDictionary *)userInfo;
#endif
-- (instancetype)_initWithType:(_WKActivatedElementType)type URL:(NSURL *)url imageURL:(NSURL *)imageURL location:(const WebCore::IntPoint&)location title:(NSString *)title ID:(NSString *)ID rect:(CGRect)rect image:(WebKit::ShareableBitmap*)image;
-- (instancetype)_initWithType:(_WKActivatedElementType)type URL:(NSURL *)url imageURL:(NSURL *)imageURL location:(const WebCore::IntPoint&)location title:(NSString *)title ID:(NSString *)ID rect:(CGRect)rect image:(WebKit::ShareableBitmap*)image userInfo:(NSDictionary *)userInfo;
+- (instancetype)_initWithType:(_WKActivatedElementType)type URL:(NSURL *)url imageURL:(NSURL *)imageURL location:(const WebCore::IntPoint&)location title:(NSString *)title ID:(NSString *)ID rect:(CGRect)rect image:(WebKit::ShareableBitmap*)image imageMIMEType:(NSString *)imageMIMEType;
+- (instancetype)_initWithType:(_WKActivatedElementType)type URL:(NSURL *)url imageURL:(NSURL *)imageURL location:(const WebCore::IntPoint&)location title:(NSString *)title ID:(NSString *)ID rect:(CGRect)rect image:(WebKit::ShareableBitmap*)image imageMIMEType:(NSString *)imageMIMEType userInfo:(NSDictionary *)userInfo;
+@property (nonatomic, readonly) NSString *imageMIMEType;
@property (nonatomic, readonly) WebCore::IntPoint _interactionLocation;
@end
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKElementAction.h (289680 => 289681)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKElementAction.h 2022-02-12 00:42:00 UTC (rev 289680)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKElementAction.h 2022-02-12 01:12:05 UTC (rev 289681)
@@ -56,6 +56,7 @@
_WKElementActionToggleShowLinkPreviews WK_API_AVAILABLE(macos(10.15), ios(13.0)),
_WKElementActionTypeImageExtraction WK_API_AVAILABLE(ios(15.0)),
_WKElementActionTypeRevealImage WK_API_AVAILABLE(ios(15.0)),
+ _WKElementActionTypeCopyCroppedImage WK_API_AVAILABLE(ios(WK_IOS_TBA)),
} WK_API_AVAILABLE(macos(10.10), ios(8.0));
WK_CLASS_AVAILABLE(macos(10.10), ios(8.0))
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKElementAction.mm (289680 => 289681)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKElementAction.mm 2022-02-12 00:42:00 UTC (rev 289680)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKElementAction.mm 2022-02-12 01:12:05 UTC (rev 289681)
@@ -63,6 +63,7 @@
UIActionIdentifier const WKElementActionTypeToggleShowLinkPreviewsIdentifier = @"WKElementActionTypeToggleShowLinkPreviews";
static UIActionIdentifier const WKElementActionTypeImageExtractionIdentifier = @"WKElementActionTypeImageExtraction";
static UIActionIdentifier const WKElementActionTypeRevealImageIdentifier = @"WKElementActionTypeRevealImage";
+static UIActionIdentifier const WKElementActionTypeCopyCroppedImageIdentifier = @"WKElementActionTypeCopyCroppedImage";
static NSString * const webkitShowLinkPreviewsPreferenceKey = @"WebKitShowLinkPreviews";
static NSString * const webkitShowLinkPreviewsPreferenceChangedNotification = @"WebKitShowLinkPreviewsPreferenceChanged";
@@ -177,6 +178,14 @@
};
#endif
break;
+ case _WKElementActionTypeCopyCroppedImage:
+#if ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS)
+ title = WEB_UI_STRING("Copy Cropped Image", "Title for Copy Cropped Image");
+ handler = ^(WKActionSheetAssistant *assistant, _WKActivatedElementInfo *actionInfo) {
+ [assistant handleElementActionWithType:type element:actionInfo needsInteraction:YES];
+ };
+#endif
+ break;
default:
[NSException raise:NSInvalidArgumentException format:@"There is no standard web element action of type %ld.", (long)type];
return nil;
@@ -255,6 +264,8 @@
#else
return nil;
#endif
+ case _WKElementActionTypeCopyCroppedImage:
+ return [UIImage systemImageNamed:@"person.fill.viewfinder"];
}
}
@@ -289,6 +300,8 @@
return WKElementActionTypeImageExtractionIdentifier;
case _WKElementActionTypeRevealImage:
return WKElementActionTypeRevealImageIdentifier;
+ case _WKElementActionTypeCopyCroppedImage:
+ return WKElementActionTypeCopyCroppedImageIdentifier;
}
}
@@ -322,6 +335,8 @@
return _WKElementActionTypeImageExtraction;
if ([identifier isEqualToString:WKElementActionTypeRevealImageIdentifier])
return _WKElementActionTypeRevealImage;
+ if ([identifier isEqualToString:WKElementActionTypeCopyCroppedImageIdentifier])
+ return _WKElementActionTypeCopyCroppedImage;
return _WKElementActionTypeCustom;
}
Modified: trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.h (289680 => 289681)
--- trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.h 2022-02-12 00:42:00 UTC (rev 289680)
+++ trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.h 2022-02-12 01:12:05 UTC (rev 289681)
@@ -85,6 +85,9 @@
- (BOOL)actionSheetAssistant:(WKActionSheetAssistant *)assistant shouldIncludeLookUpImageActionForElement:(_WKActivatedElementInfo *)element;
- (void)actionSheetAssistant:(WKActionSheetAssistant *)assistant lookUpImage:(UIImage *)image imageURL:(NSURL *)imageURL title:(NSString *)title imageBounds:(CGRect)imageBounds;
#endif
+#if ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS)
+- (void)actionSheetAssistant:(WKActionSheetAssistant *)assistant copyCroppedImage:(UIImage *)image sourceMIMEType:(NSString *)sourceMIMEType;
+#endif
@end
#if USE(UICONTEXTMENU)
Modified: trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm (289680 => 289681)
--- trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm 2022-02-12 00:42:00 UTC (rev 289680)
+++ trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm 2022-02-12 01:12:05 UTC (rev 289681)
@@ -29,7 +29,7 @@
#if PLATFORM(IOS_FAMILY)
#import "APIUIClient.h"
-#import "TCCSoftLink.h"
+#import "TextRecognitionUtilities.h"
#import "UIKitSPI.h"
#import "WKActionSheet.h"
#import "WKContentViewInteraction.h"
@@ -62,6 +62,8 @@
SOFT_LINK_CLASS(SafariServices, SSReadingList)
#endif
+#import "TCCSoftLink.h"
+
OBJC_CLASS DDAction;
#if HAVE(APP_LINKS)
@@ -397,7 +399,7 @@
if (!targetURL)
targetURL = alternateURL;
auto elementBounds = _positionInformation->bounds;
- auto elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeImage URL:targetURL imageURL:imageURL location:_positionInformation->request.point title:_positionInformation->title ID:_positionInformation->idAttribute rect:elementBounds image:_positionInformation->image.get() userInfo:userInfo]);
+ auto elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeImage URL:targetURL imageURL:imageURL location:_positionInformation->request.point title:_positionInformation->title ID:_positionInformation->idAttribute rect:elementBounds image:_positionInformation->image.get() imageMIMEType:_positionInformation->imageMIMEType userInfo:userInfo]);
if ([delegate respondsToSelector:@selector(actionSheetAssistant:showCustomSheetForElement:)] && [delegate actionSheetAssistant:self showCustomSheetForElement:elementInfo.get()])
return;
auto defaultActions = [self defaultActionsForImageSheet:elementInfo.get()];
@@ -551,14 +553,20 @@
[defaultActions addObject:[_WKElementAction _elementActionWithType:_WKElementActionTypeShare assistant:self]];
}
+ if (elementInfo.type == _WKActivatedElementTypeImage || [elementInfo image]) {
+#if ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS)
+ if (WebKit::isImageAnalysisMarkupSystemFeatureEnabled()) {
+ // FIXME (rdar://88834304): This should be additionally gated on the relevant VisionKit SPI.
+ [defaultActions addObject:[_WKElementAction _elementActionWithType:_WKElementActionTypeCopyCroppedImage assistant:self]];
+ }
+#endif
#if ENABLE(IMAGE_ANALYSIS)
- if (elementInfo.type == _WKActivatedElementTypeImage || [elementInfo image]) {
if ([_delegate respondsToSelector:@selector(actionSheetAssistant:shouldIncludeShowTextActionForElement:)] && [_delegate actionSheetAssistant:self shouldIncludeShowTextActionForElement:elementInfo])
[defaultActions addObject:[_WKElementAction _elementActionWithType:_WKElementActionTypeImageExtraction assistant:self]];
if ([_delegate respondsToSelector:@selector(actionSheetAssistant:shouldIncludeLookUpImageActionForElement:)] && [_delegate actionSheetAssistant:self shouldIncludeLookUpImageActionForElement:elementInfo])
[defaultActions addObject:[_WKElementAction _elementActionWithType:_WKElementActionTypeRevealImage assistant:self]];
+#endif
}
-#endif
return defaultActions;
}
@@ -582,6 +590,12 @@
[defaultActions addObject:[_WKElementAction _elementActionWithType:_WKElementActionTypeSaveImage assistant:self]];
[defaultActions addObject:[_WKElementAction _elementActionWithType:_WKElementActionTypeCopy assistant:self]];
+#if ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS)
+ if (WebKit::isImageAnalysisMarkupSystemFeatureEnabled()) {
+ // FIXME (rdar://88834304): This should be additionally gated on the relevant VisionKit SPI.
+ [defaultActions addObject:[_WKElementAction _elementActionWithType:_WKElementActionTypeCopyCroppedImage assistant:self]];
+ }
+#endif
#if ENABLE(IMAGE_ANALYSIS)
if ([_delegate respondsToSelector:@selector(actionSheetAssistant:shouldIncludeShowTextActionForElement:)] && [_delegate actionSheetAssistant:self shouldIncludeShowTextActionForElement:elementInfo])
@@ -614,7 +628,7 @@
return;
}
- auto elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeLink URL:targetURL imageURL:(NSURL*)_positionInformation->imageURL location:_positionInformation->request.point title:_positionInformation->title ID:_positionInformation->idAttribute rect:_positionInformation->bounds image:_positionInformation->image.get()]);
+ auto elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeLink URL:targetURL imageURL:(NSURL*)_positionInformation->imageURL location:_positionInformation->request.point title:_positionInformation->title ID:_positionInformation->idAttribute rect:_positionInformation->bounds image:_positionInformation->image.get() imageMIMEType:_positionInformation->imageMIMEType]);
if ([_delegate respondsToSelector:@selector(actionSheetAssistant:showCustomSheetForElement:)] && [_delegate actionSheetAssistant:self showCustomSheetForElement:elementInfo.get()]) {
_needsLinkIndicator = NO;
return;
@@ -1033,6 +1047,11 @@
[delegate actionSheetAssistant:self lookUpImage:element.image imageURL:element.imageURL title:element.title imageBounds:element.boundingRect];
#endif
break;
+ case _WKElementActionTypeCopyCroppedImage:
+#if ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS)
+ [delegate actionSheetAssistant:self copyCroppedImage:element.image sourceMIMEType:element.imageMIMEType];
+#endif
+ break;
default:
ASSERT_NOT_REACHED();
break;
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (289680 => 289681)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2022-02-12 00:42:00 UTC (rev 289680)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2022-02-12 01:12:05 UTC (rev 289681)
@@ -29,6 +29,7 @@
#if PLATFORM(IOS_FAMILY)
#import "APIUIClient.h"
+#import "CocoaImage.h"
#import "CompletionHandlerCallChecker.h"
#import "DocumentEditingContext.h"
#import "InputViewUpdateDeferrer.h"
@@ -376,20 +377,6 @@
bool m_shouldPreventTextSelection { false };
};
-static RetainPtr<NSData> transcode(CGImageRef image, CFStringRef typeIdentifier)
-{
- if (!image)
- return nil;
-
- auto data = "" alloc] init]);
- auto destination = adoptCF(CGImageDestinationCreateWithData((__bridge CFMutableDataRef)data.get(), typeIdentifier, 1, nil));
- CGImageDestinationAddImage(destination.get(), image, nil);
- if (!CGImageDestinationFinalize(destination.get()))
- return nil;
-
- return data;
-}
-
#endif // ENABLE(IMAGE_ANALYSIS)
} // namespace WebKit
@@ -2629,7 +2616,7 @@
if (![uiDelegate respondsToSelector:@selector(_webView:showCustomSheetForElement:)])
return;
- auto element = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeAttachment URL:(NSURL *)_positionInformation.url imageURL:(NSURL *)_positionInformation.imageURL location:_positionInformation.request.point title:_positionInformation.title ID:_positionInformation.idAttribute rect:_positionInformation.bounds image:nil]);
+ auto element = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeAttachment URL:(NSURL *)_positionInformation.url imageURL:(NSURL *)_positionInformation.imageURL location:_positionInformation.request.point title:_positionInformation.title ID:_positionInformation.idAttribute rect:_positionInformation.bounds image:nil imageMIMEType:_positionInformation.imageMIMEType]);
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
[uiDelegate _webView:self.webView showCustomSheetForElement:element.get()];
ALLOW_DEPRECATED_DECLARATIONS_END
@@ -4700,15 +4687,8 @@
return;
auto [elementContext, image, preferredMIMEType] = *_imageAnalysisMarkupData;
- auto targetType = RetainPtr { UTTypeTIFF.identifier };
- if (!preferredMIMEType.isEmpty()) {
- NSString *preferredTypeIdentifier = [UTType typeWithMIMEType:preferredMIMEType conformingToType:UTTypeImage].identifier;
- if (WebCore::isSupportedImageType(preferredTypeIdentifier))
- targetType = preferredTypeIdentifier;
- }
-
- if (auto data = "" (__bridge CFStringRef)targetType.get()); [data length])
- _page->replaceSelectionWithPasteboardData({ String { targetType.get() } }, { static_cast<const uint8_t*>([data bytes]), [data length] });
+ if (auto [data, type] = WebKit::transcodeWithPreferredMIMEType(image.get(), preferredMIMEType.createCFString().get(), (__bridge CFStringRef)UTTypeTIFF.identifier); data)
+ _page->replaceSelectionWithPasteboardData({ String { type.get() } }, { static_cast<const uint8_t*>([data bytes]), [data length] });
}
- (void)doAfterComputingImageAnalysisResultsForMarkup:(CompletionHandler<void()>&&)completion
@@ -4750,20 +4730,7 @@
return;
}
- // FIXME: Check to see if we can avoid this extra transcoding step once VisionKit starts using `mediaanalysisd` for this.
- auto tiffData = WebKit::transcode(cgImage.get(), (__bridge CFStringRef)UTTypeTIFF.identifier);
- if (![tiffData length]) {
- completion();
- return;
- }
-
- RetainPtr transcodedImage = [UIImage imageWithData:tiffData.get()];
- if (!transcodedImage) {
- completion();
- return;
- }
-
- WebKit::requestImageAnalysisMarkup([transcodedImage CGImage], [sourceMIMEType, context, completion = WTFMove(completion), weakSelf](CGImageRef result) mutable {
+ WebKit::requestImageAnalysisMarkup(cgImage.get(), [sourceMIMEType, context, completion = WTFMove(completion), weakSelf](CGImageRef result) mutable {
auto strongSelf = weakSelf.get();
if (!strongSelf) {
completion();
@@ -10880,6 +10847,30 @@
#endif // ENABLE(IMAGE_ANALYSIS)
+#if ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS)
+
+- (void)actionSheetAssistant:(WKActionSheetAssistant *)assistant copyCroppedImage:(UIImage *)image sourceMIMEType:(NSString *)sourceMIMEType
+{
+ auto changeCount = UIPasteboard.generalPasteboard.changeCount;
+ WebKit::requestImageAnalysisMarkup(image.CGImage, [changeCount, weakSelf = WeakObjCPtr<WKContentView>(self), originalImage = RetainPtr { image }, sourceMIMEType = RetainPtr { sourceMIMEType }](CGImageRef result) mutable {
+ auto strongSelf = weakSelf.get();
+ if (!strongSelf)
+ return;
+
+ auto [data, type] = WebKit::transcodeWithPreferredMIMEType(result ?: [originalImage CGImage], (__bridge CFStringRef)sourceMIMEType.get(), (__bridge CFStringRef)UTTypeTIFF.identifier);
+ if (!data)
+ return;
+
+ [UIPasteboard _performAsDataOwner:[strongSelf _dataOwnerForCopy] block:[data = "" type = WTFMove(type), changeCount] {
+ auto pasteboard = UIPasteboard.generalPasteboard;
+ if (changeCount == pasteboard.changeCount)
+ [pasteboard setData:data.get() forPasteboardType:(__bridge NSString *)type.get()];
+ }];
+ });
+}
+
+#endif // ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS)
+
#if USE(APPLE_INTERNAL_SDK)
#import <WebKitAdditions/WKContentViewInteractionAdditionsAfter.mm>
#else
@@ -11967,7 +11958,7 @@
dataForPreview.get()[UIPreviewDataLink] = (NSURL *)_positionInformation.imageURL;
} else if (canShowAttachmentPreview) {
*type = UIPreviewItemTypeAttachment;
- auto element = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeAttachment URL:(NSURL *)linkURL imageURL:(NSURL *)_positionInformation.imageURL location:_positionInformation.request.point title:_positionInformation.title ID:_positionInformation.idAttribute rect:_positionInformation.bounds image:nil]);
+ auto element = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeAttachment URL:(NSURL *)linkURL imageURL:(NSURL *)_positionInformation.imageURL location:_positionInformation.request.point title:_positionInformation.title ID:_positionInformation.idAttribute rect:_positionInformation.bounds image:nil imageMIMEType:_positionInformation.imageMIMEType]);
NSUInteger index = [uiDelegate _webView:self.webView indexIntoAttachmentListForElement:element.get()];
if (index != NSNotFound) {
BOOL sourceIsManaged = NO;
@@ -12004,7 +11995,7 @@
// Treat animated images like a link preview
if (isValidURLForImagePreview && _positionInformation.isAnimatedImage) {
- RetainPtr<_WKActivatedElementInfo> animatedImageElementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeImage URL:targetURL imageURL:nil location:_positionInformation.request.point title:_positionInformation.title ID:_positionInformation.idAttribute rect:_positionInformation.bounds image:_positionInformation.image.get()]);
+ auto animatedImageElementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeImage URL:targetURL imageURL:nil location:_positionInformation.request.point title:_positionInformation.title ID:_positionInformation.idAttribute rect:_positionInformation.bounds image:_positionInformation.image.get() imageMIMEType:_positionInformation.imageMIMEType]);
if ([uiDelegate respondsToSelector:@selector(_webView:previewViewControllerForAnimatedImageAtURL:defaultActions:elementInfo:imageSize:)]) {
RetainPtr<NSArray> actions = [_actionSheetAssistant defaultActionsForImageSheet:animatedImageElementInfo.get()];
@@ -12014,7 +12005,7 @@
}
}
- RetainPtr<_WKActivatedElementInfo> elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeLink URL:targetURL imageURL:nil location:_positionInformation.request.point title:_positionInformation.title ID:_positionInformation.idAttribute rect:_positionInformation.bounds image:_positionInformation.image.get()]);
+ auto elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeLink URL:targetURL imageURL:nil location:_positionInformation.request.point title:_positionInformation.title ID:_positionInformation.idAttribute rect:_positionInformation.bounds image:_positionInformation.image.get() imageMIMEType:_positionInformation.imageMIMEType]);
auto actions = [_actionSheetAssistant defaultActionsForLinkSheet:elementInfo.get()];
if ([uiDelegate respondsToSelector:@selector(webView:previewingViewControllerForElement:defaultActions:)]) {
@@ -12059,7 +12050,7 @@
imageInfo = userInfo;
}
- RetainPtr<_WKActivatedElementInfo> elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeImage URL:alternateURL.get() imageURL:nil location:_positionInformation.request.point title:_positionInformation.title ID:_positionInformation.idAttribute rect:_positionInformation.bounds image:_positionInformation.image.get() userInfo:imageInfo.get()]);
+ auto elementInfo = adoptNS([[_WKActivatedElementInfo alloc] _initWithType:_WKActivatedElementTypeImage URL:alternateURL.get() imageURL:nil location:_positionInformation.request.point title:_positionInformation.title ID:_positionInformation.idAttribute rect:_positionInformation.bounds image:_positionInformation.image.get() imageMIMEType:_positionInformation.imageMIMEType userInfo:imageInfo.get()]);
_page->startInteractionWithPositionInformation(_positionInformation);
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (289680 => 289681)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2022-02-12 00:42:00 UTC (rev 289680)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2022-02-12 01:12:05 UTC (rev 289681)
@@ -6591,6 +6591,7 @@
F4DBC0BD276AA6A70001D169 /* _WKModalContainerInfo.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKModalContainerInfo.mm; sourceTree = "<group>"; };
F4DBC0C0276AA6CA0001D169 /* _WKModalContainerInfoInternal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _WKModalContainerInfoInternal.h; sourceTree = "<group>"; };
F4E2B44A268FDE1A00327ABC /* TapHandlingResult.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TapHandlingResult.h; path = ios/TapHandlingResult.h; sourceTree = "<group>"; };
+ F4E47BB527B5AE5B00813B38 /* CocoaImage.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = CocoaImage.mm; sourceTree = "<group>"; };
F4EB4AFC269CD23600D297AE /* OSStateSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSStateSPI.h; sourceTree = "<group>"; };
F4F59AD32065A5C9006CAA46 /* WKSelectMenuListViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKSelectMenuListViewController.mm; path = ios/forms/WKSelectMenuListViewController.mm; sourceTree = "<group>"; };
F4F59AD42065A5CA006CAA46 /* WKSelectMenuListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKSelectMenuListViewController.h; path = ios/forms/WKSelectMenuListViewController.h; sourceTree = "<group>"; };
@@ -9352,6 +9353,7 @@
isa = PBXGroup;
children = (
4482734624528F6000A95493 /* CocoaImage.h */,
+ F4E47BB527B5AE5B00813B38 /* CocoaImage.mm */,
BCE0937614FB128B001138D9 /* LayerHostingContext.h */,
BCE0937514FB128B001138D9 /* LayerHostingContext.mm */,
A1798B3D222D97A2000764BD /* PaymentAuthorizationPresenter.h */,
Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (289680 => 289681)
--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2022-02-12 00:42:00 UTC (rev 289680)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2022-02-12 01:12:05 UTC (rev 289681)
@@ -2845,6 +2845,7 @@
auto& [renderImage, image] = *rendererAndImage;
info.isImage = true;
info.imageURL = element.document().completeURL(renderImage.cachedImage()->url().string());
+ info.imageMIMEType = image.mimeType();
info.isAnimatedImage = image.isAnimated();
info.elementContainsImageOverlay = is<HTMLElement>(element) && ImageOverlay::hasOverlay(downcast<HTMLElement>(element));
@@ -2911,6 +2912,7 @@
if (auto rendererAndImage = imageRendererAndImage(element)) {
auto& [renderImage, image] = *rendererAndImage;
info.imageURL = element.document().completeURL(renderImage.cachedImage()->url().string());
+ info.imageMIMEType = image.mimeType();
info.image = createShareableBitmap(renderImage, { screenSize() * page.corePage()->deviceScaleFactor(), AllowAnimatedImages::Yes, UseSnapshotForTransparentImages::Yes });
}
}