Title: [219389] trunk/Source/WebCore
Revision
219389
Author
[email protected]
Date
2017-07-12 03:58:31 -0700 (Wed, 12 Jul 2017)

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (219388 => 219389)


--- trunk/Source/WebCore/ChangeLog	2017-07-12 10:56:22 UTC (rev 219388)
+++ trunk/Source/WebCore/ChangeLog	2017-07-12 10:58:31 UTC (rev 219389)
@@ -1,3 +1,20 @@
+2017-07-12  Carlos Garcia Campos  <[email protected]>
+
+        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.
+
 2017-07-12  Adrian Perez de Castro  <[email protected]>
 
         [SOUP] Do not use C linkage for functions using C++ features

Modified: trunk/Source/WebCore/platform/graphics/ImageFrameCache.cpp (219388 => 219389)


--- trunk/Source/WebCore/platform/graphics/ImageFrameCache.cpp	2017-07-12 10:56:22 UTC (rev 219388)
+++ trunk/Source/WebCore/platform/graphics/ImageFrameCache.cpp	2017-07-12 10:58:31 UTC (rev 219389)
@@ -379,6 +379,7 @@
 void ImageFrameCache::clearMetadata()
 {
     m_frameCount = std::nullopt;
+    m_repetitionCount = std::nullopt;
     m_singlePixelSolidColor = std::nullopt;
     m_encodedDataStatus = std::nullopt;
     m_uti = std::nullopt;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to