Before 276827@main, ImageSource::frameAtIndexCacheIfNeeded() used to take an std::optional<SubsamplingLevel> whose value can be ignored when it passed as std::nullopt. When it is present and its value is different from the current subsamplingLevel, the ImageFrame NativeImage should be destroyed. After 276827@main, BitmapImageSource::frameAtIndexCacheIfNeeded() is now taking SubsamplingLevel with a default value equal to SubsamplingLevel::Default. For all metadata expect the size, this parameter is not passed. This means if a NativeImage with subsamplingLevel != SubsamplingLevel::Default is cached in the current ImageFrame and then a metadata like 'orientation' is requested, this NativeImage will be destroyed. This broke large animated images which can be subsampled. This code in BitmapImageSource::imageFrameDecodeAtIndexHasFinished() causes the image not to be displayed. cacheNativeImageAtIndex(index, subsamplingLevel, options, nativeImage.releaseNonNull()); imageFrameDecodeAtIndexHasFinished(index, animatingState, frameDecodingStatusAtIndex(index)); After caching the NativeImage by calling cacheNativeImageAtIndex(), frameDecodingStatusAtIndex() will destroy this NativeImage immediately because it calls frameAtIndexCacheIfNeeded() which calls destroyNativeImageAtIndex().
rdar://127133070
Pull request: https://github.com/WebKit/WebKit/pull/27911
Committed 278195@main (f644ba89b026): <https://commits.webkit.org/278195@main> Reviewed commits have been landed. Closing PR #27911 and removing active labels.