New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Cocoa] Support AVIF images for macOS Ventura and iOS 16 #1717
[Cocoa] Support AVIF images for macOS Ventura and iOS 16 #1717
Conversation
@@ -93,7 +93,7 @@ constexpr ComparableCaseFoldingASCIILiteral supportedImageMIMETypeArray[] = { | |||
#if USE(CG) || ENABLE(APNG) | |||
"image/apng", | |||
#endif | |||
#if USE(AVIF) | |||
#if HAVE(AVIF) || USE(AVIF) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uh oh. Why is there both HAVE(AVIF)
and USE(AVIF)
? Can we consolidate them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HAVE(AVIF) is used by Apple ports where the system frameworks provide the needed support to render these images.
USE(AVIF) is used by non Apple ports. It is defined in Source/cmake/OptionsWPE.cmake and Source/cmake/OptionsGTK.cmake. They use libavif to handle the AVIF images. If we want to merge HAVE(AVIF) and USE(AVIF) and merge HAVE(WEBP) and USE(WEBP), I think it is better to handle this in a separate patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make sure we have a bug open for the separate patch? (Presumably the separate patch would be for both AVIF and WEBP.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
120c22a
to
67b4e14
Compare
@@ -76,7 +76,7 @@ static RetainPtr<CFMutableDictionaryRef> createImageSourceOptions() | |||
CFDictionarySetValue(options.get(), kCGImageSourceUseHardwareAcceleration, kCFBooleanFalse); | |||
|
|||
#if HAVE(IMAGE_RESTRICTED_DECODING) && USE(APPLE_INTERNAL_SDK) | |||
if (ImageDecoderCG::decodingHEICEnabled()) | |||
if (ImageDecoderCG::decodingHEICEnabled() || ImageDecoderCG::decodingAVIFEnabled()) | |||
CFDictionarySetValue(options.get(), kCGImageSourceEnableRestrictedDecoding, kCFBooleanTrue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still not super clear if this line has any repercussions beyond HEIC or AVIF, but okay.
https://bugs.webkit.org/show_bug.cgi?id=241904 rdar://95742091 Reviewed by Myles C. Maxfield. Add the mime type and the UTI of the AVIF to the list of the allowed image formats. The system frameworks will be used to render the AVIF images on macOS Ventura and iOS 16. Because of sand-boxing limitations, software decoding has to be used for AVIF images. * LayoutTests/platform/mac/TestExpectations: * Source/WTF/wtf/PlatformHave.h: * Source/WebCore/loader/cache/CachedResourceRequest.cpp: (WebCore::acceptHeaderValueForImageResource): * Source/WebCore/platform/MIMETypeRegistry.cpp: * Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp: (WebCore::createImageSourceOptions): * Source/WebCore/platform/graphics/cg/UTIRegistry.cpp: (WebCore::defaultSupportedImageTypes): Canonical link: https://commits.webkit.org/251850@main
67b4e14
to
59d774a
Compare
Committed 251850@main (59d774a): https://commits.webkit.org/251850@main Reviewed commits have been landed. Closing PR #1717 and removing active labels. |
59d774a