<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[181553] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/181553">181553</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-03-16 07:24:46 -0700 (Mon, 16 Mar 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add APNG support
https://bugs.webkit.org/show_bug.cgi?id=17022

Patch by Max Stepin &lt;maxstepin@gmail.com&gt; on 2015-03-16
Reviewed by Carlos Garcia Campos.

Source/WebCore:

Test: fast/images/animated-png.html

* platform/image-decoders/ImageDecoder.h:
(WebCore::ImageFrame::divide255):
(WebCore::ImageFrame::overRGBA):
* platform/image-decoders/png/PNGImageDecoder.cpp:
(WebCore::frameHeader):
(WebCore::readChunks):
(WebCore::PNGImageReader::PNGImageReader):
(WebCore::PNGImageDecoder::PNGImageDecoder):
(WebCore::PNGImageDecoder::frameBufferAtIndex):
(WebCore::PNGImageDecoder::headerAvailable):
(WebCore::PNGImageDecoder::rowAvailable):
(WebCore::PNGImageDecoder::pngComplete):
(WebCore::PNGImageDecoder::readChunks):
(WebCore::PNGImageDecoder::frameHeader):
(WebCore::PNGImageDecoder::init):
(WebCore::PNGImageDecoder::clearFrameBufferCache):
(WebCore::PNGImageDecoder::initFrameBuffer):
(WebCore::PNGImageDecoder::frameComplete):
(WebCore::PNGImageDecoder::processingStart):
(WebCore::PNGImageDecoder::processingFinish):
(WebCore::PNGImageDecoder::fallbackNotAnimated):
* platform/image-decoders/png/PNGImageDecoder.h:
(WebCore::PNGImageDecoder::frameCount):
(WebCore::PNGImageDecoder::repetitionCount):
(WebCore::PNGImageDecoder::isComplete):

Source/WTF:

* wtf/FeatureDefines.h:

LayoutTests:

* fast/images/animated-png-expected.html: Added.
* fast/images/animated-png.html: Added.
* fast/images/resources/apng00-ref.png: Added.
* fast/images/resources/apng00.png: Added.
* fast/images/resources/apng01-ref.png: Added.
* fast/images/resources/apng01.png: Added.
* fast/images/resources/apng02-ref.png: Added.
* fast/images/resources/apng02.png: Added.
* fast/images/resources/apng04-ref.png: Added.
* fast/images/resources/apng04.png: Added.
* fast/images/resources/apng08-ref.png: Added.
* fast/images/resources/apng08.png: Added.
* fast/images/resources/apng10-ref.png: Added.
* fast/images/resources/apng10.png: Added.
* fast/images/resources/apng11-ref.png: Added.
* fast/images/resources/apng11.png: Added.
* fast/images/resources/apng12-ref.png: Added.
* fast/images/resources/apng12.png: Added.
* fast/images/resources/apng14-ref.png: Added.
* fast/images/resources/apng14.png: Added.
* fast/images/resources/apng18-ref.png: Added.
* fast/images/resources/apng18.png: Added.
* fast/images/resources/apng24-ref.png: Added.
* fast/images/resources/apng24.png: Added.
* fast/images/resources/apng26-ref.png: Added.
* fast/images/resources/apng26.png: Added.
* platform/mac/TestExpectations:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacTestExpectations">trunk/LayoutTests/platform/mac/TestExpectations</a></li>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfFeatureDefinesh">trunk/Source/WTF/wtf/FeatureDefines.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformimagedecodersImageDecoderh">trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h</a></li>
<li><a href="#trunkSourceWebCoreplatformimagedecoderspngPNGImageDecodercpp">trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformimagedecoderspngPNGImageDecoderh">trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastimagesanimatedpngexpectedhtml">trunk/LayoutTests/fast/images/animated-png-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastimagesanimatedpnghtml">trunk/LayoutTests/fast/images/animated-png.html</a></li>
<li><a href="#trunkLayoutTestsfastimagesresourcesapng00refpng">trunk/LayoutTests/fast/images/resources/apng00-ref.png</a></li>
<li><a href="#trunkLayoutTestsfastimagesresourcesapng00png">trunk/LayoutTests/fast/images/resources/apng00.png</a></li>
<li><a href="#trunkLayoutTestsfastimagesresourcesapng01refpng">trunk/LayoutTests/fast/images/resources/apng01-ref.png</a></li>
<li><a href="#trunkLayoutTestsfastimagesresourcesapng01png">trunk/LayoutTests/fast/images/resources/apng01.png</a></li>
<li><a href="#trunkLayoutTestsfastimagesresourcesapng02refpng">trunk/LayoutTests/fast/images/resources/apng02-ref.png</a></li>
<li><a href="#trunkLayoutTestsfastimagesresourcesapng02png">trunk/LayoutTests/fast/images/resources/apng02.png</a></li>
<li><a href="#trunkLayoutTestsfastimagesresourcesapng04refpng">trunk/LayoutTests/fast/images/resources/apng04-ref.png</a></li>
<li><a href="#trunkLayoutTestsfastimagesresourcesapng04png">trunk/LayoutTests/fast/images/resources/apng04.png</a></li>
<li><a href="#trunkLayoutTestsfastimagesresourcesapng08refpng">trunk/LayoutTests/fast/images/resources/apng08-ref.png</a></li>
<li><a href="#trunkLayoutTestsfastimagesresourcesapng08png">trunk/LayoutTests/fast/images/resources/apng08.png</a></li>
<li><a href="#trunkLayoutTestsfastimagesresourcesapng10refpng">trunk/LayoutTests/fast/images/resources/apng10-ref.png</a></li>
<li><a href="#trunkLayoutTestsfastimagesresourcesapng10png">trunk/LayoutTests/fast/images/resources/apng10.png</a></li>
<li><a href="#trunkLayoutTestsfastimagesresourcesapng11refpng">trunk/LayoutTests/fast/images/resources/apng11-ref.png</a></li>
<li><a href="#trunkLayoutTestsfastimagesresourcesapng11png">trunk/LayoutTests/fast/images/resources/apng11.png</a></li>
<li><a href="#trunkLayoutTestsfastimagesresourcesapng12refpng">trunk/LayoutTests/fast/images/resources/apng12-ref.png</a></li>
<li><a href="#trunkLayoutTestsfastimagesresourcesapng12png">trunk/LayoutTests/fast/images/resources/apng12.png</a></li>
<li><a href="#trunkLayoutTestsfastimagesresourcesapng14refpng">trunk/LayoutTests/fast/images/resources/apng14-ref.png</a></li>
<li><a href="#trunkLayoutTestsfastimagesresourcesapng14png">trunk/LayoutTests/fast/images/resources/apng14.png</a></li>
<li><a href="#trunkLayoutTestsfastimagesresourcesapng18refpng">trunk/LayoutTests/fast/images/resources/apng18-ref.png</a></li>
<li><a href="#trunkLayoutTestsfastimagesresourcesapng18png">trunk/LayoutTests/fast/images/resources/apng18.png</a></li>
<li><a href="#trunkLayoutTestsfastimagesresourcesapng24refpng">trunk/LayoutTests/fast/images/resources/apng24-ref.png</a></li>
<li><a href="#trunkLayoutTestsfastimagesresourcesapng24png">trunk/LayoutTests/fast/images/resources/apng24.png</a></li>
<li><a href="#trunkLayoutTestsfastimagesresourcesapng26refpng">trunk/LayoutTests/fast/images/resources/apng26-ref.png</a></li>
<li><a href="#trunkLayoutTestsfastimagesresourcesapng26png">trunk/LayoutTests/fast/images/resources/apng26.png</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (181552 => 181553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-03-16 12:30:43 UTC (rev 181552)
+++ trunk/LayoutTests/ChangeLog        2015-03-16 14:24:46 UTC (rev 181553)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2015-03-16  Max Stepin  &lt;maxstepin@gmail.com&gt;
+
+        Add APNG support
+        https://bugs.webkit.org/show_bug.cgi?id=17022
+
+        Reviewed by Carlos Garcia Campos.
+
+        * fast/images/animated-png-expected.html: Added.
+        * fast/images/animated-png.html: Added.
+        * fast/images/resources/apng00-ref.png: Added.
+        * fast/images/resources/apng00.png: Added.
+        * fast/images/resources/apng01-ref.png: Added.
+        * fast/images/resources/apng01.png: Added.
+        * fast/images/resources/apng02-ref.png: Added.
+        * fast/images/resources/apng02.png: Added.
+        * fast/images/resources/apng04-ref.png: Added.
+        * fast/images/resources/apng04.png: Added.
+        * fast/images/resources/apng08-ref.png: Added.
+        * fast/images/resources/apng08.png: Added.
+        * fast/images/resources/apng10-ref.png: Added.
+        * fast/images/resources/apng10.png: Added.
+        * fast/images/resources/apng11-ref.png: Added.
+        * fast/images/resources/apng11.png: Added.
+        * fast/images/resources/apng12-ref.png: Added.
+        * fast/images/resources/apng12.png: Added.
+        * fast/images/resources/apng14-ref.png: Added.
+        * fast/images/resources/apng14.png: Added.
+        * fast/images/resources/apng18-ref.png: Added.
+        * fast/images/resources/apng18.png: Added.
+        * fast/images/resources/apng24-ref.png: Added.
+        * fast/images/resources/apng24.png: Added.
+        * fast/images/resources/apng26-ref.png: Added.
+        * fast/images/resources/apng26.png: Added.
+        * platform/mac/TestExpectations:
+
</ins><span class="cx"> 2015-03-16  Gyuyoung Kim  &lt;gyuyoung.kim@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [EFL] Unreviewed EFL gardening on 16th Mar.
</span></span></pre></div>
<a id="trunkLayoutTestsfastimagesanimatedpngexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/images/animated-png-expected.html (0 => 181553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/images/animated-png-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/images/animated-png-expected.html        2015-03-16 14:24:46 UTC (rev 181553)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;APNG reftest: when animation ends, compare its last frame against the reference static PNG.&lt;/title&gt;
+&lt;style&gt;
+img { margin: 1px; }
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body style=&quot;margin: 1px&quot;&gt;
+&lt;img src=resources/apng00-ref.png&gt;&lt;img src=resources/apng01-ref.png&gt;&lt;img src=resources/apng02-ref.png&gt;&lt;img src=resources/apng04-ref.png&gt;&lt;img src=resources/apng08-ref.png&gt;&lt;br&gt;
+&lt;img src=resources/apng10-ref.png&gt;&lt;img src=resources/apng11-ref.png&gt;&lt;img src=resources/apng12-ref.png&gt;&lt;img src=resources/apng14-ref.png&gt;&lt;img src=resources/apng18-ref.png&gt;&lt;br&gt;
+&lt;img src=resources/apng24-ref.png&gt;&lt;img src=resources/apng26-ref.png&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastimagesanimatedpnghtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/images/animated-png.html (0 => 181553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/images/animated-png.html                                (rev 0)
+++ trunk/LayoutTests/fast/images/animated-png.html        2015-03-16 14:24:46 UTC (rev 181553)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;APNG reftest: when animation ends, compare its last frame against the reference static PNG.&lt;/title&gt;
+&lt;script&gt;
+    if (window.testRunner)
+        testRunner.dumpAsText(true);
+
+    window.onload = function() {
+        if (window.testRunner)
+            testRunner.waitUntilDone();
+
+        window.setTimeout(function() {
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }, 300);
+    }
+&lt;/script&gt;
+&lt;style&gt;
+img { margin: 1px; }
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body style=&quot;margin: 1px&quot;&gt;
+&lt;img src=resources/apng00.png&gt;&lt;img src=resources/apng01.png&gt;&lt;img src=resources/apng02.png&gt;&lt;img src=resources/apng04.png&gt;&lt;img src=resources/apng08.png&gt;&lt;br&gt;
+&lt;img src=resources/apng10.png&gt;&lt;img src=resources/apng11.png&gt;&lt;img src=resources/apng12.png&gt;&lt;img src=resources/apng14.png&gt;&lt;img src=resources/apng18.png&gt;&lt;br&gt;
+&lt;img src=resources/apng24.png&gt;&lt;img src=resources/apng26.png&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastimagesresourcesapng00refpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/fast/images/resources/apng00-ref.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/fast/images/resources/apng00-ref.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsfastimagesresourcesapng00png"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/fast/images/resources/apng00.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/fast/images/resources/apng00.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsfastimagesresourcesapng01refpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/fast/images/resources/apng01-ref.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/fast/images/resources/apng01-ref.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsfastimagesresourcesapng01png"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/fast/images/resources/apng01.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/fast/images/resources/apng01.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsfastimagesresourcesapng02refpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/fast/images/resources/apng02-ref.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/fast/images/resources/apng02-ref.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsfastimagesresourcesapng02png"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/fast/images/resources/apng02.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/fast/images/resources/apng02.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsfastimagesresourcesapng04refpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/fast/images/resources/apng04-ref.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/fast/images/resources/apng04-ref.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsfastimagesresourcesapng04png"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/fast/images/resources/apng04.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/fast/images/resources/apng04.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsfastimagesresourcesapng08refpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/fast/images/resources/apng08-ref.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/fast/images/resources/apng08-ref.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsfastimagesresourcesapng08png"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/fast/images/resources/apng08.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/fast/images/resources/apng08.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsfastimagesresourcesapng10refpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/fast/images/resources/apng10-ref.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/fast/images/resources/apng10-ref.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsfastimagesresourcesapng10png"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/fast/images/resources/apng10.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/fast/images/resources/apng10.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsfastimagesresourcesapng11refpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/fast/images/resources/apng11-ref.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/fast/images/resources/apng11-ref.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsfastimagesresourcesapng11png"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/fast/images/resources/apng11.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/fast/images/resources/apng11.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsfastimagesresourcesapng12refpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/fast/images/resources/apng12-ref.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/fast/images/resources/apng12-ref.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsfastimagesresourcesapng12png"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/fast/images/resources/apng12.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/fast/images/resources/apng12.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsfastimagesresourcesapng14refpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/fast/images/resources/apng14-ref.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/fast/images/resources/apng14-ref.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsfastimagesresourcesapng14png"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/fast/images/resources/apng14.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/fast/images/resources/apng14.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsfastimagesresourcesapng18refpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/fast/images/resources/apng18-ref.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/fast/images/resources/apng18-ref.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsfastimagesresourcesapng18png"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/fast/images/resources/apng18.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/fast/images/resources/apng18.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsfastimagesresourcesapng24refpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/fast/images/resources/apng24-ref.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/fast/images/resources/apng24-ref.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsfastimagesresourcesapng24png"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/fast/images/resources/apng24.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/fast/images/resources/apng24.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsfastimagesresourcesapng26refpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/fast/images/resources/apng26-ref.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/fast/images/resources/apng26-ref.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsfastimagesresourcesapng26png"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/fast/images/resources/apng26.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/LayoutTests/fast/images/resources/apng26.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsplatformmacTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/TestExpectations (181552 => 181553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/TestExpectations        2015-03-16 12:30:43 UTC (rev 181552)
+++ trunk/LayoutTests/platform/mac/TestExpectations        2015-03-16 14:24:46 UTC (rev 181553)
</span><span class="lines">@@ -1273,3 +1273,6 @@
</span><span class="cx"> 
</span><span class="cx"> # Test uses Yosemite blurs
</span><span class="cx"> [ Mavericks ] compositing/media-controls-bar-appearance.html [ Skip ]
</span><ins>+
+# Mavericks and prior do not support APNG.
+webkit.org/b/17022 [ MountainLion Mavericks ] fast/images/animated-png.html [ Skip ]
</ins></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (181552 => 181553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2015-03-16 12:30:43 UTC (rev 181552)
+++ trunk/Source/WTF/ChangeLog        2015-03-16 14:24:46 UTC (rev 181553)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2015-03-16  Max Stepin  &lt;maxstepin@gmail.com&gt;
+
+        Add APNG support
+        https://bugs.webkit.org/show_bug.cgi?id=17022
+
+        Reviewed by Carlos Garcia Campos.
+
+        * wtf/FeatureDefines.h:
+
</ins><span class="cx"> 2015-03-15  Benjamin Poulain  &lt;benjamin@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         CSS: fix the case-insensitive matching of the attribute selectors Begin, End and Hyphen
</span></span></pre></div>
<a id="trunkSourceWTFwtfFeatureDefinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/FeatureDefines.h (181552 => 181553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/FeatureDefines.h        2015-03-16 12:30:43 UTC (rev 181552)
+++ trunk/Source/WTF/wtf/FeatureDefines.h        2015-03-16 14:24:46 UTC (rev 181553)
</span><span class="lines">@@ -307,6 +307,10 @@
</span><span class="cx"> #define ENABLE_ACCELERATED_OVERFLOW_SCROLLING 0
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if !defined(ENABLE_APNG)
+#define ENABLE_APNG 1
+#endif
+
</ins><span class="cx"> #if !defined(ENABLE_BATTERY_STATUS)
</span><span class="cx"> #define ENABLE_BATTERY_STATUS 0
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (181552 => 181553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-03-16 12:30:43 UTC (rev 181552)
+++ trunk/Source/WebCore/ChangeLog        2015-03-16 14:24:46 UTC (rev 181553)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2015-03-16  Max Stepin  &lt;maxstepin@gmail.com&gt;
+
+        Add APNG support
+        https://bugs.webkit.org/show_bug.cgi?id=17022
+
+        Reviewed by Carlos Garcia Campos.
+
+        Test: fast/images/animated-png.html
+
+        * platform/image-decoders/ImageDecoder.h:
+        (WebCore::ImageFrame::divide255):
+        (WebCore::ImageFrame::overRGBA):
+        * platform/image-decoders/png/PNGImageDecoder.cpp:
+        (WebCore::frameHeader):
+        (WebCore::readChunks):
+        (WebCore::PNGImageReader::PNGImageReader):
+        (WebCore::PNGImageDecoder::PNGImageDecoder):
+        (WebCore::PNGImageDecoder::frameBufferAtIndex):
+        (WebCore::PNGImageDecoder::headerAvailable):
+        (WebCore::PNGImageDecoder::rowAvailable):
+        (WebCore::PNGImageDecoder::pngComplete):
+        (WebCore::PNGImageDecoder::readChunks):
+        (WebCore::PNGImageDecoder::frameHeader):
+        (WebCore::PNGImageDecoder::init):
+        (WebCore::PNGImageDecoder::clearFrameBufferCache):
+        (WebCore::PNGImageDecoder::initFrameBuffer):
+        (WebCore::PNGImageDecoder::frameComplete):
+        (WebCore::PNGImageDecoder::processingStart):
+        (WebCore::PNGImageDecoder::processingFinish):
+        (WebCore::PNGImageDecoder::fallbackNotAnimated):
+        * platform/image-decoders/png/PNGImageDecoder.h:
+        (WebCore::PNGImageDecoder::frameCount):
+        (WebCore::PNGImageDecoder::repetitionCount):
+        (WebCore::PNGImageDecoder::isComplete):
+
</ins><span class="cx"> 2015-03-15  Benjamin Poulain  &lt;benjamin@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         CSS: fix the case-insensitive matching of the attribute selectors Begin, End and Hyphen
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformimagedecodersImageDecoderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h (181552 => 181553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h        2015-03-16 12:30:43 UTC (rev 181552)
+++ trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h        2015-03-16 14:24:46 UTC (rev 181553)
</span><span class="lines">@@ -165,6 +165,48 @@
</span><span class="cx">             *dest = (a &lt;&lt; 24 | r &lt;&lt; 16 | g &lt;&lt; 8 | b);
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+#if ENABLE(APNG)
+        static inline unsigned divide255(unsigned a)
+        {
+            return (a + (a &gt;&gt; 8) + 1) &gt;&gt; 8;
+        }
+
+        inline void overRGBA(PixelData* dest, unsigned r, unsigned g, unsigned b, unsigned a)
+        {
+            if (!a)
+                return;
+
+            if (a &lt; 255) {
+                unsigned aDest = ((*dest) &gt;&gt; 24) &amp; 255;
+                if (aDest) {
+                    unsigned rDest = ((*dest) &gt;&gt; 16) &amp; 255;
+                    unsigned gDest = ((*dest) &gt;&gt; 8) &amp; 255;
+                    unsigned bDest = (*dest) &amp; 255;
+                    unsigned aAux = 255 - a;
+                    if (!m_premultiplyAlpha) {
+                        rDest = divide255(rDest * aDest);
+                        gDest = divide255(gDest * aDest);
+                        bDest = divide255(bDest * aDest);
+                    }
+                    r = divide255(r * a + rDest * aAux);
+                    g = divide255(g * a + gDest * aAux);
+                    b = divide255(b * a + bDest * aAux);
+                    a += divide255(aDest * aAux);
+                    if (!m_premultiplyAlpha) {
+                        r = (r * 255 + a - 1) / a;
+                        g = (g * 255 + a - 1) / a;
+                        b = (b * 255 + a - 1) / a;
+                    }
+                } else if (m_premultiplyAlpha) {
+                    r = divide255(r * a);
+                    g = divide255(g * a);
+                    b = divide255(b * a);
+                }
+            }
+            *dest = (a &lt;&lt; 24 | r &lt;&lt; 16 | g &lt;&lt; 8 | b);
+        }
+#endif
+
</ins><span class="cx">     private:
</span><span class="cx">         int width() const
</span><span class="cx">         {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformimagedecoderspngPNGImageDecodercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp (181552 => 181553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp        2015-03-16 12:30:43 UTC (rev 181552)
+++ trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp        2015-03-16 14:24:46 UTC (rev 181553)
</span><span class="lines">@@ -7,6 +7,7 @@
</span><span class="cx">  *
</span><span class="cx">  * Other contributors:
</span><span class="cx">  *   Stuart Parmenter &lt;stuart@mozilla.com&gt;
</span><ins>+ *   Max Stepin &lt;maxstepin@gmail.com&gt;
</ins><span class="cx">  *
</span><span class="cx">  * This library is free software; you can redistribute it and/or
</span><span class="cx">  * modify it under the terms of the GNU Lesser General Public
</span><span class="lines">@@ -100,6 +101,21 @@
</span><span class="cx">     static_cast&lt;PNGImageDecoder*&gt;(png_get_progressive_ptr(png))-&gt;pngComplete();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(APNG)
+// Called when we have the frame header.
+static void PNGAPI frameHeader(png_structp png, png_infop)
+{
+    static_cast&lt;PNGImageDecoder*&gt;(png_get_progressive_ptr(png))-&gt;frameHeader();
+}
+
+// Called when we found user chunks.
+static int PNGAPI readChunks(png_structp png, png_unknown_chunkp chunk)
+{
+    static_cast&lt;PNGImageDecoder*&gt;(png_get_user_chunk_ptr(png))-&gt;readChunks(chunk);
+    return 1;
+}
+#endif
+
</ins><span class="cx"> class PNGImageReader {
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><span class="lines">@@ -117,6 +133,12 @@
</span><span class="cx">         m_png = png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, decodingFailed, decodingWarning);
</span><span class="cx">         m_info = png_create_info_struct(m_png);
</span><span class="cx">         png_set_progressive_read_fn(m_png, decoder, headerAvailable, rowAvailable, pngComplete);
</span><ins>+#if ENABLE(APNG)
+        png_byte apngChunks[]= {&quot;acTL\0fcTL\0fdAT\0&quot;};
+        png_set_keep_unknown_chunks(m_png, 1, apngChunks, 3);
+        png_set_read_user_chunk_fn(m_png, static_cast&lt;png_voidp&gt;(decoder), readChunks);
+        decoder-&gt;init();
+#endif
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     ~PNGImageReader()
</span><span class="lines">@@ -215,10 +237,33 @@
</span><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-PNGImageDecoder::PNGImageDecoder(ImageSource::AlphaOption alphaOption,
-                                 ImageSource::GammaAndColorProfileOption gammaAndColorProfileOption)
</del><ins>+PNGImageDecoder::PNGImageDecoder(ImageSource::AlphaOption alphaOption, ImageSource::GammaAndColorProfileOption gammaAndColorProfileOption)
</ins><span class="cx">     : ImageDecoder(alphaOption, gammaAndColorProfileOption)
</span><span class="cx">     , m_doNothingOnFailure(false)
</span><ins>+    , m_currentFrame(0)
+#if ENABLE(APNG)
+    , m_png(nullptr)
+    , m_info(nullptr)
+    , m_isAnimated(false)
+    , m_frameInfo(false)
+    , m_frameIsHidden(false)
+    , m_hasInfo(false)
+    , m_gamma(45455)
+    , m_frameCount(1)
+    , m_playCount(0)
+    , m_totalFrames(0)
+    , m_sizePLTE(0)
+    , m_sizetRNS(0)
+    , m_sequenceNumber(0)
+    , m_width(0)
+    , m_height(0)
+    , m_xOffset(0)
+    , m_yOffset(0)
+    , m_delayNumerator(1)
+    , m_delayDenominator(1)
+    , m_dispose(0)
+    , m_blend(0)
+#endif
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -245,15 +290,23 @@
</span><span class="cx"> 
</span><span class="cx"> ImageFrame* PNGImageDecoder::frameBufferAtIndex(size_t index)
</span><span class="cx"> {
</span><ins>+#if ENABLE(APNG)
+    if (!isSizeAvailable())
+        return nullptr;
+
+    if (index &gt;= frameCount())
+        index = frameCount() - 1;
+#else
</ins><span class="cx">     if (index)
</span><del>-        return 0;
</del><ins>+        return nullptr;
+#endif
</ins><span class="cx"> 
</span><span class="cx">     if (m_frameBufferCache.isEmpty()) {
</span><span class="cx">         m_frameBufferCache.resize(1);
</span><span class="cx">         m_frameBufferCache[0].setPremultiplyAlpha(m_premultiplyAlpha);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ImageFrame&amp; frame = m_frameBufferCache[0];
</del><ins>+    ImageFrame&amp; frame = m_frameBufferCache[index];
</ins><span class="cx">     if (frame.status() != ImageFrame::FrameComplete)
</span><span class="cx">         decode(false);
</span><span class="cx">     return &amp;frame;
</span><span class="lines">@@ -329,14 +382,64 @@
</span><span class="cx"> 
</span><span class="cx">     // The options we set here match what Mozilla does.
</span><span class="cx"> 
</span><ins>+#if ENABLE(APNG)
+    m_hasInfo = true;
+    if (m_isAnimated) {
+        png_save_uint_32(m_dataIHDR, 13);
+        memcpy(m_dataIHDR + 4, &quot;IHDR&quot;, 4);
+        png_save_uint_32(m_dataIHDR + 8, width);
+        png_save_uint_32(m_dataIHDR + 12, height);
+        m_dataIHDR[16] = bitDepth;
+        m_dataIHDR[17] = colorType;
+        m_dataIHDR[18] = compressionType;
+        m_dataIHDR[19] = filterType;
+        m_dataIHDR[20] = interlaceType;
+    }
+#endif
+
</ins><span class="cx">     // Expand to ensure we use 24-bit for RGB and 32-bit for RGBA.
</span><del>-    if (colorType == PNG_COLOR_TYPE_PALETTE || (colorType == PNG_COLOR_TYPE_GRAY &amp;&amp; bitDepth &lt; 8))
</del><ins>+    if (colorType == PNG_COLOR_TYPE_PALETTE) {
+#if ENABLE(APNG)
+        if (m_isAnimated) {
+            png_colorp palette;
+            int paletteSize = 0;
+            png_get_PLTE(png, info, &amp;palette, &amp;paletteSize);
+            paletteSize *= 3;
+            png_save_uint_32(m_dataPLTE, paletteSize);
+            memcpy(m_dataPLTE + 4, &quot;PLTE&quot;, 4);
+            memcpy(m_dataPLTE + 8, palette, paletteSize);
+            m_sizePLTE = paletteSize + 12;
+        }
+#endif
</ins><span class="cx">         png_set_expand(png);
</span><ins>+    }
</ins><span class="cx"> 
</span><ins>+    if (colorType == PNG_COLOR_TYPE_GRAY &amp;&amp; bitDepth &lt; 8)
+        png_set_expand(png);
+
</ins><span class="cx">     png_bytep trns = 0;
</span><span class="cx">     int trnsCount = 0;
</span><ins>+    png_color_16p transValues;
</ins><span class="cx">     if (png_get_valid(png, info, PNG_INFO_tRNS)) {
</span><del>-        png_get_tRNS(png, info, &amp;trns, &amp;trnsCount, 0);
</del><ins>+        png_get_tRNS(png, info, &amp;trns, &amp;trnsCount, &amp;transValues);
+#if ENABLE(APNG)
+        if (m_isAnimated) {
+            if (colorType == PNG_COLOR_TYPE_RGB) {
+                png_save_uint_16(m_datatRNS + 8, transValues-&gt;red);
+                png_save_uint_16(m_datatRNS + 10, transValues-&gt;green);
+                png_save_uint_16(m_datatRNS + 12, transValues-&gt;blue);
+                trnsCount = 6;
+            } else if (colorType == PNG_COLOR_TYPE_GRAY) {
+                png_save_uint_16(m_datatRNS + 8, transValues-&gt;gray);
+                trnsCount = 2;
+            } else if (colorType == PNG_COLOR_TYPE_PALETTE)
+                memcpy(m_datatRNS + 8, trns, trnsCount);
+
+            png_save_uint_32(m_datatRNS, trnsCount);
+            memcpy(m_datatRNS + 4, &quot;tRNS&quot;, 4);
+            m_sizetRNS = trnsCount + 12;
+        }
+#endif
</ins><span class="cx">         png_set_expand(png);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -369,6 +472,9 @@
</span><span class="cx">             png_set_gAMA(png, info, gamma);
</span><span class="cx">         }
</span><span class="cx">         png_set_gamma(png, cDefaultGamma, gamma);
</span><ins>+#if ENABLE(APNG)
+        m_gamma = static_cast&lt;int&gt;(gamma * 100000);
+#endif
</ins><span class="cx">     } else
</span><span class="cx">         png_set_gamma(png, cDefaultGamma, cInverseGamma);
</span><span class="cx"> 
</span><span class="lines">@@ -424,7 +530,11 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     // Initialize the framebuffer if needed.
</span><del>-    ImageFrame&amp; buffer = m_frameBufferCache[0];
</del><ins>+#if ENABLE(APNG)
+    if (m_currentFrame &gt;= frameCount())
+        return;
+#endif
+    ImageFrame&amp; buffer = m_frameBufferCache[m_currentFrame];
</ins><span class="cx">     if (buffer.status() == ImageFrame::FrameEmpty) {
</span><span class="cx">         png_structp png = m_reader-&gt;pngPtr();
</span><span class="cx">         if (!buffer.setSize(scaledSize().width(), scaledSize().height())) {
</span><span class="lines">@@ -433,8 +543,10 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         unsigned colorChannels = m_reader-&gt;hasAlpha() ? 4 : 3;
</span><del>-        if (PNG_INTERLACE_ADAM7 == png_get_interlace_type(png, m_reader-&gt;infoPtr())) {
-            m_reader-&gt;createInterlaceBuffer(colorChannels * size().width() * size().height());
</del><ins>+        if (PNG_INTERLACE_ADAM7 == png_get_interlace_type(png, m_reader-&gt;infoPtr())
+            || m_currentFrame) {
+            if (!m_reader-&gt;interlaceBuffer())
+                m_reader-&gt;createInterlaceBuffer(colorChannels * size().width() * size().height());
</ins><span class="cx">             if (!m_reader-&gt;interlaceBuffer()) {
</span><span class="cx">                 longjmp(JMPBUF(png), 1);
</span><span class="cx">                 return;
</span><span class="lines">@@ -442,7 +554,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx"> #if USE(QCMSLIB)
</span><del>-        if (m_reader-&gt;colorTransform()) {
</del><ins>+        if (m_reader-&gt;colorTransform() &amp;&amp; !m_currentFrame) {
</ins><span class="cx">             m_reader-&gt;createRowBuffer(colorChannels * size().width());
</span><span class="cx">             if (!m_reader-&gt;rowBuffer()) {
</span><span class="cx">                 longjmp(JMPBUF(png), 1);
</span><span class="lines">@@ -454,6 +566,11 @@
</span><span class="cx">         buffer.setHasAlpha(false);
</span><span class="cx">         buffer.setColorProfile(m_colorProfile);
</span><span class="cx"> 
</span><ins>+#if ENABLE(APNG)
+        if (m_currentFrame)
+            initFrameBuffer(m_currentFrame);
+        else
+#endif
</ins><span class="cx">         // For PNGs, the frame always fills the entire image.
</span><span class="cx">         buffer.setOriginalFrameRect(IntRect(IntPoint(), size()));
</span><span class="cx">     }
</span><span class="lines">@@ -504,6 +621,12 @@
</span><span class="cx"> 
</span><span class="cx">     if (png_bytep interlaceBuffer = m_reader-&gt;interlaceBuffer()) {
</span><span class="cx">         row = interlaceBuffer + (rowIndex * colorChannels * size().width());
</span><ins>+#if ENABLE(APNG)
+        if (m_currentFrame) {
+            png_progressive_combine_row(m_png, row, rowBuffer);
+            return; // Only do incremental image display for the first frame.
+        }
+#endif
</ins><span class="cx">         png_progressive_combine_row(m_reader-&gt;pngPtr(), row, rowBuffer);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -552,6 +675,14 @@
</span><span class="cx"> 
</span><span class="cx"> void PNGImageDecoder::pngComplete()
</span><span class="cx"> {
</span><ins>+#if ENABLE(APNG)
+    if (m_isAnimated) {
+        if (!processingFinish() &amp;&amp; m_frameCount == m_currentFrame)
+            return;
+
+        fallbackNotAnimated();
+    }
+#endif
</ins><span class="cx">     if (!m_frameBufferCache.isEmpty())
</span><span class="cx">         m_frameBufferCache.first().setStatus(ImageFrame::FrameComplete);
</span><span class="cx"> }
</span><span class="lines">@@ -574,4 +705,371 @@
</span><span class="cx">         m_reader = nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(APNG)
+void PNGImageDecoder::readChunks(png_unknown_chunkp chunk)
+{
+    if (!memcmp(chunk-&gt;name, &quot;acTL&quot;, 4) &amp;&amp; chunk-&gt;size == 8) {
+        if (m_hasInfo || m_isAnimated)
+            return;
+
+        m_frameCount = png_get_uint_32(chunk-&gt;data);
+        m_playCount = png_get_uint_32(chunk-&gt;data + 4);
+
+        if (!m_frameCount || m_frameCount &gt; PNG_UINT_31_MAX || m_playCount &gt; PNG_UINT_31_MAX) {
+            fallbackNotAnimated();
+            return;
+        }
+
+        m_isAnimated = true;
+        if (!m_frameInfo)
+            m_frameIsHidden = true;
+
+        if (m_frameBufferCache.size() == m_frameCount)
+            return;
+
+        m_frameBufferCache.resize(m_frameCount);
+        for (auto&amp; imageFrame : m_frameBufferCache)
+            imageFrame.setPremultiplyAlpha(m_premultiplyAlpha);
+    } else if (!memcmp(chunk-&gt;name, &quot;fcTL&quot;, 4) &amp;&amp; chunk-&gt;size == 26) {
+        if (m_hasInfo &amp;&amp; !m_isAnimated)
+            return;
+
+        m_frameInfo = false;
+
+        if (processingFinish()) {
+            fallbackNotAnimated();
+            return;
+        }
+
+        // At this point the old frame is done. Let's start a new one.
+        unsigned sequenceNumber = png_get_uint_32(chunk-&gt;data);
+        if (sequenceNumber != m_sequenceNumber++) {
+            fallbackNotAnimated();
+            return;
+        }
+
+        m_width = png_get_uint_32(chunk-&gt;data + 4);
+        m_height = png_get_uint_32(chunk-&gt;data + 8);
+        m_xOffset = png_get_uint_32(chunk-&gt;data + 12);
+        m_yOffset = png_get_uint_32(chunk-&gt;data + 16);
+        m_delayNumerator = png_get_uint_16(chunk-&gt;data + 20);
+        m_delayDenominator = png_get_uint_16(chunk-&gt;data + 22);
+        m_dispose = chunk-&gt;data[24];
+        m_blend = chunk-&gt;data[25];
+
+        png_structp png = m_reader-&gt;pngPtr();
+        png_infop info = m_reader-&gt;infoPtr();
+        png_uint_32 width = png_get_image_width(png, info);
+        png_uint_32 height = png_get_image_height(png, info);
+
+        if (m_width &gt; cMaxPNGSize || m_height &gt; cMaxPNGSize
+            || m_xOffset &gt; cMaxPNGSize || m_yOffset &gt; cMaxPNGSize
+            || m_xOffset + m_width &gt; width
+            || m_yOffset + m_height &gt; height
+            || m_dispose &gt; 2 || m_blend &gt; 1) {
+            fallbackNotAnimated();
+            return;
+        }
+
+        m_frameInfo = true;
+        m_frameIsHidden = false;
+
+        if (processingStart(chunk)) {
+            fallbackNotAnimated();
+            return;
+        }
+    } else if (!memcmp(chunk-&gt;name, &quot;fdAT&quot;, 4) &amp;&amp; chunk-&gt;size &gt;= 4) {
+        if (!m_frameInfo || !m_isAnimated)
+            return;
+
+        unsigned sequenceNumber = png_get_uint_32(chunk-&gt;data);
+        if (sequenceNumber != m_sequenceNumber++) {
+            fallbackNotAnimated();
+            return;
+        }
+
+        if (setjmp(JMPBUF(m_png))) {
+            fallbackNotAnimated();
+            return;
+        }
+
+        png_save_uint_32(chunk-&gt;data, chunk-&gt;size - 4);
+        png_process_data(m_png, m_info, chunk-&gt;data, 4);
+        memcpy(chunk-&gt;data, &quot;IDAT&quot;, 4);
+        png_process_data(m_png, m_info, chunk-&gt;data, chunk-&gt;size);
+        png_process_data(m_png, m_info, chunk-&gt;data, 4);
+    }
+}
+
+void PNGImageDecoder::frameHeader()
+{
+    int colorType = png_get_color_type(m_png, m_info);
+
+    if (colorType == PNG_COLOR_TYPE_PALETTE)
+        png_set_expand(m_png);
+
+    int bitDepth = png_get_bit_depth(m_png, m_info);
+    if (colorType == PNG_COLOR_TYPE_GRAY &amp;&amp; bitDepth &lt; 8)
+        png_set_expand(m_png);
+
+    if (png_get_valid(m_png, m_info, PNG_INFO_tRNS))
+        png_set_expand(m_png);
+
+    if (bitDepth == 16)
+        png_set_strip_16(m_png);
+
+    if (colorType == PNG_COLOR_TYPE_GRAY || colorType == PNG_COLOR_TYPE_GRAY_ALPHA)
+        png_set_gray_to_rgb(m_png);
+
+    double gamma;
+    if (png_get_gAMA(m_png, m_info, &amp;gamma))
+        png_set_gamma(m_png, cDefaultGamma, gamma);
+
+    png_set_interlace_handling(m_png);
+
+    png_read_update_info(m_png, m_info);
+}
+
+void PNGImageDecoder::init()
+{
+    m_isAnimated = false;
+    m_frameInfo = false;
+    m_frameIsHidden = false;
+    m_hasInfo = false;
+    m_currentFrame = 0;
+    m_totalFrames = 0;
+    m_sequenceNumber = 0;
+}
+
+void PNGImageDecoder::clearFrameBufferCache(size_t clearBeforeFrame)
+{
+    if (m_frameBufferCache.isEmpty())
+        return;
+
+    // See GIFImageDecoder for full explanation.
+    clearBeforeFrame = std::min(clearBeforeFrame, m_frameBufferCache.size() - 1);
+    const Vector&lt;ImageFrame&gt;::iterator end(m_frameBufferCache.begin() + clearBeforeFrame);
+
+    Vector&lt;ImageFrame&gt;::iterator i(end);
+    for (; (i != m_frameBufferCache.begin()) &amp;&amp; ((i-&gt;status() == ImageFrame::FrameEmpty) || (i-&gt;disposalMethod() == ImageFrame::DisposeOverwritePrevious)); --i) {
+        if ((i-&gt;status() == ImageFrame::FrameComplete) &amp;&amp; (i != end))
+            i-&gt;clearPixelData();
+    }
+
+    // Now |i| holds the last frame we need to preserve; clear prior frames.
+    for (Vector&lt;ImageFrame&gt;::iterator j(m_frameBufferCache.begin()); j != i; ++j) {
+        ASSERT(j-&gt;status() != ImageFrame::FramePartial);
+        if (j-&gt;status() != ImageFrame::FrameEmpty)
+            j-&gt;clearPixelData();
+    }
+}
+
+void PNGImageDecoder::initFrameBuffer(size_t frameIndex)
+{
+    if (frameIndex &gt;= frameCount())
+        return;
+
+    IntRect frameRect(m_xOffset, m_yOffset, m_width, m_height);
+
+    // Make sure the frameRect doesn't extend outside the buffer.
+    if (frameRect.maxX() &gt; size().width())
+        frameRect.setWidth(size().width() - m_xOffset);
+    if (frameRect.maxY() &gt; size().height())
+        frameRect.setHeight(size().height() - m_yOffset);
+
+    ImageFrame&amp; buffer = m_frameBufferCache[frameIndex];
+    int left = upperBoundScaledX(frameRect.x());
+    int right = lowerBoundScaledX(frameRect.maxX(), left);
+    int top = upperBoundScaledY(frameRect.y());
+    int bottom = lowerBoundScaledY(frameRect.maxY(), top);
+    buffer.setOriginalFrameRect(IntRect(left, top, right - left, bottom - top));
+
+    // The starting state for this frame depends on the previous frame's
+    // disposal method.
+    //
+    // Frames that use the DisposeOverwritePrevious method are effectively
+    // no-ops in terms of changing the starting state of a frame compared to
+    // the starting state of the previous frame, so skip over them.  (If the
+    // first frame specifies this method, it will get treated like
+    // DisposeOverwriteBgcolor below and reset to a completely empty image.)
+    const ImageFrame* prevBuffer = &amp;m_frameBufferCache[--frameIndex];
+    ImageFrame::FrameDisposalMethod prevMethod = prevBuffer-&gt;disposalMethod();
+    while (frameIndex &amp;&amp; (prevMethod == ImageFrame::DisposeOverwritePrevious)) {
+        prevBuffer = &amp;m_frameBufferCache[--frameIndex];
+        prevMethod = prevBuffer-&gt;disposalMethod();
+    }
+    ASSERT(prevBuffer-&gt;status() == ImageFrame::FrameComplete);
+
+    if (prevMethod == ImageFrame::DisposeKeep) {
+        // Preserve the last frame as the starting state for this frame.
+        buffer.copyBitmapData(*prevBuffer);
+    } else {
+        // We want to clear the previous frame to transparent, without
+        // affecting pixels in the image outside of the frame.
+        const IntRect&amp; prevRect = prevBuffer-&gt;originalFrameRect();
+        if (!frameIndex || prevRect.contains(IntRect(IntPoint(), scaledSize()))) {
+            // Clearing the first frame, or a frame the size of the whole
+            // image, results in a completely empty image.
+            buffer.zeroFillPixelData();
+        } else {
+            // Copy the whole previous buffer, then clear just its frame.
+            buffer.copyBitmapData(*prevBuffer);
+            buffer.zeroFillFrameRect(prevRect);
+        }
+    }
+}
+
+void PNGImageDecoder::frameComplete()
+{
+    if (m_frameIsHidden || m_currentFrame &gt;= frameCount())
+        return;
+
+    ImageFrame&amp; buffer = m_frameBufferCache[m_currentFrame];
+    buffer.setStatus(ImageFrame::FrameComplete);
+
+    if (!m_delayDenominator)
+        buffer.setDuration(m_delayNumerator * 10);
+    else
+        buffer.setDuration(m_delayNumerator * 1000 / m_delayDenominator);
+
+    if (m_dispose == 2)
+        buffer.setDisposalMethod(ImageFrame::DisposeOverwritePrevious);
+    else if (m_dispose == 1)
+        buffer.setDisposalMethod(ImageFrame::DisposeOverwriteBgcolor);
+    else
+        buffer.setDisposalMethod(ImageFrame::DisposeKeep);
+
+    png_bytep interlaceBuffer = m_reader-&gt;interlaceBuffer();
+
+    if (m_currentFrame &amp;&amp; interlaceBuffer) {
+        const IntRect&amp; rect = buffer.originalFrameRect();
+        bool hasAlpha = m_reader-&gt;hasAlpha();
+        unsigned colorChannels = hasAlpha ? 4 : 3;
+        bool nonTrivialAlpha = false;
+        if (m_blend &amp;&amp; !hasAlpha)
+            m_blend = 0;
+
+#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
+        for (int y = 0; y &lt; rect.maxY() - rect.y(); ++y) {
+            png_bytep row = interlaceBuffer + (m_scaled ? m_scaledRows[y] : y) * colorChannels * size().width();
+#if USE(QCMSLIB)
+            if (qcms_transform* transform = m_reader-&gt;colorTransform()) {
+                qcms_transform_data(transform, row, m_reader-&gt;rowBuffer(), size().width());
+                row = m_reader-&gt;rowBuffer();
+            }
+#endif
+            ImageFrame::PixelData* address = buffer.getAddr(rect.x(), y + rect.y());
+            for (int x = 0; x &lt; rect.maxX() - rect.x(); ++x) {
+                png_bytep pixel = row + (m_scaled ? m_scaledColumns[x] : x) * colorChannels;
+                unsigned alpha = hasAlpha ? pixel[3] : 255;
+                nonTrivialAlpha |= alpha &lt; 255;
+                if (!m_blend)
+                    buffer.setRGBA(address++, pixel[0], pixel[1], pixel[2], alpha);
+                else
+                    buffer.overRGBA(address++, pixel[0], pixel[1], pixel[2], alpha);
+            }
+        }
+#else
+        ASSERT(!m_scaled);
+        png_bytep row = interlaceBuffer;
+        for (int y = rect.y(); y &lt; rect.maxY(); ++y, row += colorChannels * size().width()) {
+            png_bytep pixel = row;
+#if USE(QCMSLIB)
+            if (qcms_transform* transform = m_reader-&gt;colorTransform()) {
+                qcms_transform_data(transform, row, m_reader-&gt;rowBuffer(), size().width());
+                pixel = m_reader-&gt;rowBuffer();
+            }
+#endif
+            ImageFrame::PixelData* address = buffer.getAddr(rect.x(), y);
+            for (int x = rect.x(); x &lt; rect.maxX(); ++x, pixel += colorChannels) {
+                unsigned alpha = hasAlpha ? pixel[3] : 255;
+                nonTrivialAlpha |= alpha &lt; 255;
+                if (!m_blend)
+                    buffer.setRGBA(address++, pixel[0], pixel[1], pixel[2], alpha);
+                else
+                    buffer.overRGBA(address++, pixel[0], pixel[1], pixel[2], alpha);
+            }
+        }
+#endif
+
+        if (!nonTrivialAlpha) {
+            if (buffer.originalFrameRect().contains(IntRect(IntPoint(), scaledSize())))
+                buffer.setHasAlpha(false);
+            else {
+                size_t frameIndex = m_currentFrame;
+                const ImageFrame* prevBuffer = &amp;m_frameBufferCache[--frameIndex];
+                while (frameIndex &amp;&amp; (prevBuffer-&gt;disposalMethod() == ImageFrame::DisposeOverwritePrevious))
+                    prevBuffer = &amp;m_frameBufferCache[--frameIndex];
+                if ((prevBuffer-&gt;disposalMethod() == ImageFrame::DisposeOverwriteBgcolor)
+                    &amp;&amp; !prevBuffer-&gt;hasAlpha() &amp;&amp; buffer.originalFrameRect().contains(prevBuffer-&gt;originalFrameRect()))
+                    buffer.setHasAlpha(false);
+            }
+        } else if (!m_blend &amp;&amp; !buffer.hasAlpha())
+            buffer.setHasAlpha(nonTrivialAlpha);
+    }
+    m_currentFrame++;
+}
+
+int PNGImageDecoder::processingStart(png_unknown_chunkp chunk)
+{
+    static png_byte dataPNG[8] = {137, 80, 78, 71, 13, 10, 26, 10};
+    static png_byte datagAMA[16] = {0, 0, 0, 4, 103, 65, 77, 65};
+
+    if (!m_hasInfo)
+        return 0;
+
+    m_totalFrames++;
+
+    m_png = png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, decodingFailed, 0);
+    m_info = png_create_info_struct(m_png);
+    if (setjmp(JMPBUF(m_png)))
+        return 1;
+
+    png_set_crc_action(m_png, PNG_CRC_QUIET_USE, PNG_CRC_QUIET_USE);
+    png_set_progressive_read_fn(m_png, static_cast&lt;png_voidp&gt;(this),
+        WebCore::frameHeader, WebCore::rowAvailable, 0);
+
+    memcpy(m_dataIHDR + 8, chunk-&gt;data + 4, 8);
+    png_save_uint_32(datagAMA + 8, m_gamma);
+
+    png_process_data(m_png, m_info, dataPNG, 8);
+    png_process_data(m_png, m_info, m_dataIHDR, 25);
+    png_process_data(m_png, m_info, datagAMA, 16);
+    if (m_sizePLTE &gt; 0)
+        png_process_data(m_png, m_info, m_dataPLTE, m_sizePLTE);
+    if (m_sizetRNS &gt; 0)
+        png_process_data(m_png, m_info, m_datatRNS, m_sizetRNS);
+
+    return 0;
+}
+
+int PNGImageDecoder::processingFinish()
+{
+    static png_byte dataIEND[12] = {0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130};
+
+    if (!m_hasInfo)
+        return 0;
+
+    if (m_totalFrames) {
+        if (setjmp(JMPBUF(m_png)))
+            return 1;
+
+        png_process_data(m_png, m_info, dataIEND, 12);
+        png_destroy_read_struct(&amp;m_png, &amp;m_info, 0);
+    }
+
+    frameComplete();
+    return 0;
+}
+
+void PNGImageDecoder::fallbackNotAnimated()
+{
+    m_isAnimated = false;
+    m_frameCount = 1;
+    m_playCount = 0;
+    m_currentFrame = 0;
+    m_frameBufferCache.resize(1);
+}
+#endif
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformimagedecoderspngPNGImageDecoderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.h (181552 => 181553)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.h        2015-03-16 12:30:43 UTC (rev 181552)
+++ trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.h        2015-03-16 14:24:46 UTC (rev 181553)
</span><span class="lines">@@ -27,6 +27,9 @@
</span><span class="cx"> #define PNGImageDecoder_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;ImageDecoder.h&quot;
</span><ins>+#if ENABLE(APNG)
+#include &lt;png.h&gt;
+#endif
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -40,6 +43,10 @@
</span><span class="cx"> 
</span><span class="cx">         // ImageDecoder
</span><span class="cx">         virtual String filenameExtension() const { return &quot;png&quot;; }
</span><ins>+#if ENABLE(APNG)
+        virtual size_t frameCount() override { return m_frameCount; }
+        virtual int repetitionCount() const override { return m_playCount-1; }
+#endif
</ins><span class="cx">         virtual bool isSizeAvailable();
</span><span class="cx">         virtual bool setSize(unsigned width, unsigned height);
</span><span class="cx">         virtual ImageFrame* frameBufferAtIndex(size_t index);
</span><span class="lines">@@ -52,10 +59,25 @@
</span><span class="cx">         void headerAvailable();
</span><span class="cx">         void rowAvailable(unsigned char* rowBuffer, unsigned rowIndex, int interlacePass);
</span><span class="cx">         void pngComplete();
</span><ins>+#if ENABLE(APNG)
+        void readChunks(png_unknown_chunkp);
+        void frameHeader();
</ins><span class="cx"> 
</span><ins>+        void init();
+        virtual void clearFrameBufferCache(size_t clearBeforeFrame);
+#endif
+
</ins><span class="cx">         bool isComplete() const
</span><span class="cx">         {
</span><del>-            return !m_frameBufferCache.isEmpty() &amp;&amp; (m_frameBufferCache.first().status() == ImageFrame::FrameComplete);
</del><ins>+            if (m_frameBufferCache.isEmpty())
+                return false;
+
+            for (auto&amp; imageFrame : m_frameBufferCache) {
+                if (imageFrame.status() != ImageFrame::FrameComplete)
+                    return false;
+            }
+
+            return true;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">     private:
</span><span class="lines">@@ -63,9 +85,43 @@
</span><span class="cx">         // calculating the image size.  If decoding fails but there is no more
</span><span class="cx">         // data coming, sets the &quot;decode failure&quot; flag.
</span><span class="cx">         void decode(bool onlySize);
</span><ins>+#if ENABLE(APNG)
+        void initFrameBuffer(size_t frameIndex);
+        void frameComplete();
+        int processingStart(png_unknown_chunkp);
+        int processingFinish();
+        void fallbackNotAnimated();
+#endif
</ins><span class="cx"> 
</span><span class="cx">         std::unique_ptr&lt;PNGImageReader&gt; m_reader;
</span><span class="cx">         bool m_doNothingOnFailure;
</span><ins>+        unsigned m_currentFrame;
+#if ENABLE(APNG)
+        png_structp m_png;
+        png_infop m_info;
+        bool m_isAnimated;
+        bool m_frameInfo;
+        bool m_frameIsHidden;
+        bool m_hasInfo;
+        int m_gamma;
+        size_t m_frameCount;
+        unsigned m_playCount;
+        unsigned m_totalFrames;
+        unsigned m_sizePLTE;
+        unsigned m_sizetRNS;
+        unsigned m_sequenceNumber;
+        unsigned m_width;
+        unsigned m_height;
+        unsigned m_xOffset;
+        unsigned m_yOffset;
+        unsigned m_delayNumerator;
+        unsigned m_delayDenominator;
+        unsigned m_dispose;
+        unsigned m_blend;
+        png_byte m_dataIHDR[12 + 13];
+        png_byte m_dataPLTE[12 + 256 * 3];
+        png_byte m_datatRNS[12 + 256];
+#endif
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre>
</div>
</div>

</body>
</html>