RESOLVED FIXED 277495
REGRESSION(278195@main): A bitmap image may get the size of a subsampled frame
https://bugs.webkit.org/show_bug.cgi?id=277495
Summary REGRESSION(278195@main): A bitmap image may get the size of a subsampled frame
Said Abou-Hallawa
Reported 2024-08-01 11:46:23 PDT
A subsampled frame can help in displaying the image into a smaller destination rectangle because decoding and displaying it is faster than the default frame. Some of the subsampled frame metadata can be the same as the default frame such as, hasAlpha, orientation and animation duration. But the image size can't be retrieved from subsampled frame. We have to get the size of the default frame to get the image size correctly. 278195@main made it possible to return the size of any cached frame even if it is subsampled frame. To get the size of an image, BitmapImage::size() calls BitmapImageSource::size() which calls BitmapImageDescriptor::size(). BitmapImageDescriptor::sourceSize() calls BitmapImageDescriptor::primaryImageFrameMetadata() which calls BitmapImageSource::primaryImageFrame() which calls BitmapImageSource::frameAtIndexCacheIfNeeded() with std::nullopt for SubsamplingLevel. If the ImageFrame is cached and SubsamplingLevel is equal to std::nullopt, BitmapImageSource::frameAtIndexCacheIfNeeded() will return it because of this code: auto& frame = m_frames[index]; auto subsamplingLevelValue = subsamplingLevel.value_or(frame.subsamplingLevel()); if (frame.isComplete() && subsamplingLevelValue == frame.subsamplingLevel()) return frame; To fix this issue, we need to ensure the default frame is retrieved and cached if the size of the image is required.
Attachments
Said Abou-Hallawa
Comment 1 2024-08-01 11:46:52 PDT
Said Abou-Hallawa
Comment 2 2024-08-01 11:57:37 PDT
EWS
Comment 3 2024-08-01 15:20:45 PDT
Committed 281731@main (2f897eb8b838): <https://commits.webkit.org/281731@main> Reviewed commits have been landed. Closing PR #31607 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.