Title: [240215] trunk/Source/WebCore
Revision
240215
Author
[email protected]
Date
2019-01-20 12:37:30 -0800 (Sun, 20 Jan 2019)

Log Message

Unreviewed, rolling out r238275.

Regressed css3/shapes/shape-outside/shape-image/shape-
image-025.html

Reverted changeset:

"ScalableImageDecoder: don't forcefully decode image data when
querying frame completeness, duration"
https://bugs.webkit.org/show_bug.cgi?id=191354
https://trac.webkit.org/changeset/238275

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (240214 => 240215)


--- trunk/Source/WebCore/ChangeLog	2019-01-20 19:22:46 UTC (rev 240214)
+++ trunk/Source/WebCore/ChangeLog	2019-01-20 20:37:30 UTC (rev 240215)
@@ -1,3 +1,17 @@
+2019-01-20  Michael Catanzaro  <[email protected]>
+
+        Unreviewed, rolling out r238275.
+
+        Regressed css3/shapes/shape-outside/shape-image/shape-
+        image-025.html
+
+        Reverted changeset:
+
+        "ScalableImageDecoder: don't forcefully decode image data when
+        querying frame completeness, duration"
+        https://bugs.webkit.org/show_bug.cgi?id=191354
+        https://trac.webkit.org/changeset/238275
+
 2019-01-19  Zalan Bujtas  <[email protected]>
 
         [LFC][BFC] <body>'s overflow property value is propagated to viewport

Modified: trunk/Source/WebCore/platform/image-decoders/ScalableImageDecoder.cpp (240214 => 240215)


--- trunk/Source/WebCore/platform/image-decoders/ScalableImageDecoder.cpp	2019-01-20 19:22:46 UTC (rev 240214)
+++ trunk/Source/WebCore/platform/image-decoders/ScalableImageDecoder.cpp	2019-01-20 20:37:30 UTC (rev 240215)
@@ -172,11 +172,11 @@
 bool ScalableImageDecoder::frameIsCompleteAtIndex(size_t index) const
 {
     LockHolder lockHolder(m_mutex);
-    if (index >= m_frameBufferCache.size())
-        return false;
-
-    auto& frame = m_frameBufferCache[index];
-    return frame.isComplete();
+    // FIXME(176089): asking whether enough data has been appended for a decode
+    // operation to succeed should not require decoding the entire frame.
+    // This function should be implementable in a way that allows const.
+    auto* buffer = const_cast<ScalableImageDecoder*>(this)->frameBufferAtIndex(index);
+    return buffer && buffer->isComplete();
 }
 
 bool ScalableImageDecoder::frameHasAlphaAtIndex(size_t index) const
@@ -184,11 +184,9 @@
     LockHolder lockHolder(m_mutex);
     if (m_frameBufferCache.size() <= index)
         return true;
-
-    auto& frame = m_frameBufferCache[index];
-    if (!frame.isComplete())
-        return true;
-    return frame.hasAlpha();
+    if (m_frameBufferCache[index].isComplete())
+        return m_frameBufferCache[index].hasAlpha();
+    return true;
 }
 
 unsigned ScalableImageDecoder::frameBytesAtIndex(size_t index, SubsamplingLevel) const
@@ -203,21 +201,20 @@
 Seconds ScalableImageDecoder::frameDurationAtIndex(size_t index) const
 {
     LockHolder lockHolder(m_mutex);
-    if (index >= m_frameBufferCache.size())
+    // FIXME(176089): asking for the duration of a sub-image should not require decoding
+    // the entire frame. This function should be implementable in a way that
+    // allows const.
+    auto* buffer = const_cast<ScalableImageDecoder*>(this)->frameBufferAtIndex(index);
+    if (!buffer || buffer->isInvalid())
         return 0_s;
-
-    auto& frame = m_frameBufferCache[index];
-    if (!frame.isComplete())
-        return 0_s;
-
+    
     // Many annoying ads specify a 0 duration to make an image flash as quickly as possible.
     // We follow Firefox's behavior and use a duration of 100 ms for any frames that specify
     // a duration of <= 10 ms. See <rdar://problem/7689300> and <http://webkit.org/b/36082>
     // for more information.
-    auto duration = frame.duration();
-    if (duration < 11_ms)
+    if (buffer->duration() < 11_ms)
         return 100_ms;
-    return duration;
+    return buffer->duration();
 }
 
 NativeImagePtr ScalableImageDecoder::createFrameImageAtIndex(size_t index, SubsamplingLevel, const DecodingOptions&)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to