[Webkit-unassigned] [Bug 277495] New: REGRESSION(278195 at main): A bitmap image may get the size of a subsampled frame

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Aug 1 11:46:23 PDT 2024


https://bugs.webkit.org/show_bug.cgi?id=277495

            Bug ID: 277495
           Summary: REGRESSION(278195 at main): A bitmap image may get the
                    size of a subsampled frame
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Images
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: sabouhallawa at apple.com
                CC: sabouhallawa at apple.com

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 at 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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240801/e8dbd979/attachment.htm>


More information about the webkit-unassigned mailing list