Bug 273457 - REGRESSION(276827@main): Some animated images that used to work no longer work
Summary: REGRESSION(276827@main): Some animated images that used to work no longer work
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Images (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Said Abou-Hallawa
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2024-04-29 17:54 PDT by Said Abou-Hallawa
Modified: 2024-08-01 11:47 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Said Abou-Hallawa 2024-04-29 17:54:53 PDT
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().
Comment 1 Said Abou-Hallawa 2024-04-29 17:55:14 PDT
rdar://127133070
Comment 2 Said Abou-Hallawa 2024-04-29 18:05:02 PDT
Pull request: https://github.com/WebKit/WebKit/pull/27911
Comment 3 EWS 2024-04-30 16:20:54 PDT
Committed 278195@main (f644ba89b026): <https://commits.webkit.org/278195@main>

Reviewed commits have been landed. Closing PR #27911 and removing active labels.