Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3c5fe4025419671f8a72aa954d94925c90bdb671
      
https://github.com/WebKit/WebKit/commit/3c5fe4025419671f8a72aa954d94925c90bdb671
  Author: Darin Adler <[email protected]>
  Date:   2026-07-11 (Sat, 11 Jul 2026)

  Changed paths:
    M Source/WebKit/Shared/Cocoa/InteractionInformationAtPosition.h
    M Source/WebKit/Shared/Cocoa/InteractionInformationAtPosition.mm
    M 
Source/WebKit/Shared/Cocoa/InteractionInformationAtPosition.serialization.in
    M Source/WebKit/UIProcess/API/Cocoa/_WKActivatedElementInfo.mm
    M Source/WebKit/UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h
    M Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm
    M Source/WebKit/WebProcess/WebPage/Cocoa/PositionInformationForWebPage.mm
    A Tools/TestWebKitAPI/Resources/cocoa/svg-image-in-link.html
    A Tools/TestWebKitAPI/Resources/cocoa/svg-image.html
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ios/ActionSheetTests.mm

  Log Message:
  -----------
  SVG images like the logo at singlethreadfarms.com have non-working Save to 
Photos menu item
https://bugs.webkit.org/show_bug.cgi?id=318765
rdar://181399508

Reviewed by Wenson Hsieh.

Added an isBitmapImage check so we won't have a Save to Photos menu item unless 
the
resource data is image data. This matches what UIImageWriteToSavedPhotosAlbum 
can do.

* Source/WebKit/Shared/Cocoa/InteractionInformationAtPosition.h: Added 
hasSaveableImage.
* Source/WebKit/Shared/Cocoa/InteractionInformationAtPosition.mm: Ditto.
(WebKit::InteractionInformationAtPosition::InteractionInformationAtPosition):
* Source/WebKit/Shared/Cocoa/InteractionInformationAtPosition.serialization.in: 
Ditto.

* Source/WebKit/UIProcess/API/Cocoa/_WKActivatedElementInfo.mm: Renamed 
_animatedImage
to _isAnimatedImage for consistency. Moved _isImage and 
_isUsingAlternateURLForImage
inside PLATFORM(IOS_FAMILY) since they are always NO otherwise. Added 
_hasSaveableImage.
(-[_WKActivatedElementInfo setFromInformation:]): Added method so the two _init 
method
families can share code, while preserving behavior for all existing fields. 
Added the
code to set _hasSaveableImage here.
(-[_WKActivatedElementInfo 
_initWithInteractionInformationAtPosition:isUsingAlternateURLForImage:userInfo:]):
Use setForInformation.
(-[_WKActivatedElementInfo 
_initWithType:URL:imageURL:image:userInfo:information:]):
Merged the unused longer method into this one, use setForInformation.
(-[_WKActivatedElementInfo isAnimatedImage]): Updated for the above changes.
(-[_WKActivatedElementInfo _hasSaveableImage]): Added.
(-[_WKActivatedElementInfo userInfo]):
(-[_WKActivatedElementInfo 
_initWithType:URL:imageURL:location:title:ID:rect:image:imageMIMEType:isAnimatedImage:isAnimating:animationsUnderElement:userInfo:]):
 Deleted.

* Source/WebKit/UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h: Put 
header
inside PLATFORM(IOS_FAMILY) since it is not used on Mac. Added 
_hasSaveableImage.

* Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm:
(-[WKActionSheetAssistant defaultActionsForLinkSheet:]): Check 
_hasSaveableImage.
Also removed null check of imageURL since _canShowSaveImageActionForImageURL: 
now
checks for that.
(-[WKActionSheetAssistant _canShowSaveImageActionForImageURL:]): Added a check 
for
a null imageURL so the caller doesn't have to do it.
(-[WKActionSheetAssistant defaultActionsForImageSheet:]): Check 
_hasSaveableImage.

* Source/WebKit/WebProcess/WebPage/Cocoa/PositionInformationForWebPage.mm:
(WebKit::imagePositionInformation): Set hasSaveableImage, only true for bitmap 
images
that are not the null image.

* Tools/TestWebKitAPI/Resources/cocoa/svg-image-in-link.html: Added.
* Tools/TestWebKitAPI/Resources/cocoa/svg-image.html: Added.

* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/ios/ActionSheetTests.mm:
(ActionSheetTests.SVGImageSaveImageActionIsExcluded): Added.
(ActionSheetTests.LinkedSVGImageSaveImageActionIsExcluded): Added.
(TestWebKitAPI::TEST(ActionSheetTests, SVGImageSaveImageActionIsExcluded)):
(TestWebKitAPI::TEST(ActionSheetTests, 
LinkedSVGImageSaveImageActionIsExcluded)):

Canonical link: https://commits.webkit.org/316983@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to