Changeset 219389 in webkit


Ignore:
Timestamp:
Jul 12, 2017 3:58:31 AM (7 years ago)
Author:
Carlos Garcia Campos
Message:

ImageDecoder: Gifs with infinite animation only play once very often
https://bugs.webkit.org/show_bug.cgi?id=173403

Reviewed by Michael Catanzaro.

It doesn't always happen, it's easier to reproduce when loading big files from the network, but it also depends
on every file. The problem is that ImageFrameCache is caching the repetition count value always when the size is
already available. In the case of gif files, the loop count value can be at any point of the image stream, so
having the size available doesn't mean we also have the loop count. So, if the value is queried before it's
available, the default value is cached (repeat once) and then always used. We should clear the cached value when
new data is added to the decoder, like we do with other cached values that can change when more data is decoded.

  • platform/graphics/ImageFrameCache.cpp:

(WebCore::ImageFrameCache::clearMetadata): Clear m_repetitionCount.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r219387 r219389  
     12017-07-12  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        ImageDecoder: Gifs with infinite animation only play once very often
     4        https://bugs.webkit.org/show_bug.cgi?id=173403
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        It doesn't always happen, it's easier to reproduce when loading big files from the network, but it also depends
     9        on every file. The problem is that ImageFrameCache is caching the repetition count value always when the size is
     10        already available. In the case of gif files, the loop count value can be at any point of the image stream, so
     11        having the size available doesn't mean we also have the loop count. So, if the value is queried before it's
     12        available, the default value is cached (repeat once) and then always used. We should clear the cached value when
     13        new data is added to the decoder, like we do with other cached values that can change when more data is decoded.
     14
     15        * platform/graphics/ImageFrameCache.cpp:
     16        (WebCore::ImageFrameCache::clearMetadata): Clear m_repetitionCount.
     17
    1182017-07-12  Adrian Perez de Castro  <aperez@igalia.com>
    219
  • trunk/Source/WebCore/platform/graphics/ImageFrameCache.cpp

    r218818 r219389  
    380380{
    381381    m_frameCount = std::nullopt;
     382    m_repetitionCount = std::nullopt;
    382383    m_singlePixelSolidColor = std::nullopt;
    383384    m_encodedDataStatus = std::nullopt;
Note: See TracChangeset for help on using the changeset viewer.