<!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>[165977] 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/165977">165977</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2014-03-20 11:32:13 -0700 (Thu, 20 Mar 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>A completed fill-forwards animation should not disable overlap testing
https://bugs.webkit.org/show_bug.cgi?id=130522
&lt;rdar://problem/15862395&gt;

Source/WebCore:

Reviewed by Dean Jackson.

Previously, if -webkit-transform was being keyframe-animated, and the
animation had fill-forwards, then we would continue to think that the
animation is running and turn off compositing overlap testing. This
caused some sites to keep too much backing store around.

Fix by having isRunning{Accelerated}AnimationOnRenderer take some flags
so that more specific questions about the running state can be asked.
For layer creation, keep using the same criteria as before (for now)
which includes paused and fill-forwards animations. For overlap testing,
don't include the fill-forwards test.

Tests: compositing/animation/filling-animation-overlap-at-end.html
       compositing/animation/filling-animation-overlap.html
       compositing/animation/layer-for-filling-animation.html

* page/animation/AnimationBase.h:
(WebCore::AnimationBase::fillingForwards):
(WebCore::AnimationBase::inPausedState):
(WebCore::AnimationBase::isAnimatingProperty):
* page/animation/AnimationController.cpp:
(WebCore::AnimationControllerPrivate::isRunningAnimationOnRenderer):
(WebCore::AnimationControllerPrivate::isRunningAcceleratedAnimationOnRenderer):
(WebCore::AnimationController::isRunningAnimationOnRenderer):
(WebCore::AnimationController::isRunningAcceleratedAnimationOnRenderer):
* page/animation/AnimationController.h:
* page/animation/AnimationControllerPrivate.h:
* page/animation/CompositeAnimation.cpp:
(WebCore::CompositeAnimation::isAnimatingProperty):
* page/animation/CompositeAnimation.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::requiresCompositingForAnimation):
(WebCore::RenderLayerCompositor::isRunningAcceleratedTransformAnimation):

LayoutTests:

Reviewed by Dean Jackson.

Tests that dump layer trees when a fill-forwards animation has finished,
both when the final keyframe causes overlap, and when it does not.

* compositing/animation/filling-animation-overlap-at-end-expected.txt: Added.
* compositing/animation/filling-animation-overlap-at-end.html: Added.
* compositing/animation/filling-animation-overlap-expected.txt: Added.
* compositing/animation/filling-animation-overlap.html: Added.
* compositing/animation/layer-for-filling-animation-expected.txt: Added.
* compositing/animation/layer-for-filling-animation.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageanimationAnimationBaseh">trunk/Source/WebCore/page/animation/AnimationBase.h</a></li>
<li><a href="#trunkSourceWebCorepageanimationAnimationControllercpp">trunk/Source/WebCore/page/animation/AnimationController.cpp</a></li>
<li><a href="#trunkSourceWebCorepageanimationAnimationControllerh">trunk/Source/WebCore/page/animation/AnimationController.h</a></li>
<li><a href="#trunkSourceWebCorepageanimationAnimationControllerPrivateh">trunk/Source/WebCore/page/animation/AnimationControllerPrivate.h</a></li>
<li><a href="#trunkSourceWebCorepageanimationCompositeAnimationcpp">trunk/Source/WebCore/page/animation/CompositeAnimation.cpp</a></li>
<li><a href="#trunkSourceWebCorepageanimationCompositeAnimationh">trunk/Source/WebCore/page/animation/CompositeAnimation.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerBackingcpp">trunk/Source/WebCore/rendering/RenderLayerBacking.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerCompositorcpp">trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestscompositinganimationfillinganimationoverlapatendexpectedtxt">trunk/LayoutTests/compositing/animation/filling-animation-overlap-at-end-expected.txt</a></li>
<li><a href="#trunkLayoutTestscompositinganimationfillinganimationoverlapatendhtml">trunk/LayoutTests/compositing/animation/filling-animation-overlap-at-end.html</a></li>
<li><a href="#trunkLayoutTestscompositinganimationfillinganimationoverlapexpectedtxt">trunk/LayoutTests/compositing/animation/filling-animation-overlap-expected.txt</a></li>
<li><a href="#trunkLayoutTestscompositinganimationfillinganimationoverlaphtml">trunk/LayoutTests/compositing/animation/filling-animation-overlap.html</a></li>
<li><a href="#trunkLayoutTestscompositinganimationlayerforfillinganimationexpectedtxt">trunk/LayoutTests/compositing/animation/layer-for-filling-animation-expected.txt</a></li>
<li><a href="#trunkLayoutTestscompositinganimationlayerforfillinganimationhtml">trunk/LayoutTests/compositing/animation/layer-for-filling-animation.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (165976 => 165977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-03-20 18:24:34 UTC (rev 165976)
+++ trunk/LayoutTests/ChangeLog        2014-03-20 18:32:13 UTC (rev 165977)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2014-03-20  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        A completed fill-forwards animation should not disable overlap testing
+        https://bugs.webkit.org/show_bug.cgi?id=130522
+        &lt;rdar://problem/15862395&gt;
+
+        Reviewed by Dean Jackson.
+        
+        Tests that dump layer trees when a fill-forwards animation has finished,
+        both when the final keyframe causes overlap, and when it does not.
+
+        * compositing/animation/filling-animation-overlap-at-end-expected.txt: Added.
+        * compositing/animation/filling-animation-overlap-at-end.html: Added.
+        * compositing/animation/filling-animation-overlap-expected.txt: Added.
+        * compositing/animation/filling-animation-overlap.html: Added.
+        * compositing/animation/layer-for-filling-animation-expected.txt: Added.
+        * compositing/animation/layer-for-filling-animation.html: Added.
+
</ins><span class="cx"> 2014-03-20  Dirk Schulze  &lt;krit@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Canvas methods clip/fill/stroke should not except 0 argument
</span></span></pre></div>
<a id="trunkLayoutTestscompositinganimationfillinganimationoverlapatendexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/animation/filling-animation-overlap-at-end-expected.txt (0 => 165977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/animation/filling-animation-overlap-at-end-expected.txt                                (rev 0)
+++ trunk/LayoutTests/compositing/animation/filling-animation-overlap-at-end-expected.txt        2014-03-20 18:32:13 UTC (rev 165977)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+(GraphicsLayer
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (children 2
+        (GraphicsLayer
+          (position 34.00 26.00)
+          (bounds 128.00 128.00)
+          (drawsContent 1)
+        )
+        (GraphicsLayer
+          (position 34.00 166.00)
+          (bounds 128.00 128.00)
+          (drawsContent 1)
+        )
+      )
+    )
+  )
+)
+
</ins><span class="cx">Property changes on: trunk/LayoutTests/compositing/animation/filling-animation-overlap-at-end-expected.txt
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkLayoutTestscompositinganimationfillinganimationoverlapatendhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/animation/filling-animation-overlap-at-end.html (0 => 165977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/animation/filling-animation-overlap-at-end.html                                (rev 0)
+++ trunk/LayoutTests/compositing/animation/filling-animation-overlap-at-end.html        2014-03-20 18:32:13 UTC (rev 165977)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;html&gt;
+&lt;head&gt;
+    &lt;style&gt;
+        .box {
+            position: relative;
+            height: 100px;
+            width: 100px;
+            margin: 40px;
+            background-color: orange;
+            box-shadow: 0 0 10px black;
+        }
+        
+        .animating {
+            -webkit-animation: spin 1 0.1s forwards;
+            background-color: blue;
+        }
+
+        @-webkit-keyframes spin {
+            from { -webkit-transform: rotate(0); }
+            to   { -webkit-transform: rotate(45deg); }
+        }
+    &lt;/style&gt;
+    &lt;script&gt;
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+            
+        function doTest()
+        {
+            document.getElementById('box').addEventListener('webkitAnimationEnd', function() {
+                if (window.testRunner) {
+                    document.getElementById('results').innerText = window.internals.layerTreeAsText(document);
+                    testRunner.notifyDone();
+                }
+            })
+        }
+        window.addEventListener('load', doTest, false);
+    &lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div id=&quot;box&quot; class=&quot;animating box&quot;&gt;&lt;/div&gt;
+&lt;div class=&quot;box&quot;&gt;&lt;/div&gt;
+
+&lt;pre id=&quot;results&quot;&gt;Layer tree dump goes here&lt;/pre&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">Property changes on: trunk/LayoutTests/compositing/animation/filling-animation-overlap-at-end.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkLayoutTestscompositinganimationfillinganimationoverlapexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/animation/filling-animation-overlap-expected.txt (0 => 165977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/animation/filling-animation-overlap-expected.txt                                (rev 0)
+++ trunk/LayoutTests/compositing/animation/filling-animation-overlap-expected.txt        2014-03-20 18:32:13 UTC (rev 165977)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+(GraphicsLayer
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (children 1
+        (GraphicsLayer
+          (position 34.00 26.00)
+          (bounds 128.00 128.00)
+          (drawsContent 1)
+        )
+      )
+    )
+  )
+)
+
</ins><span class="cx">Property changes on: trunk/LayoutTests/compositing/animation/filling-animation-overlap-expected.txt
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkLayoutTestscompositinganimationfillinganimationoverlaphtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/animation/filling-animation-overlap.html (0 => 165977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/animation/filling-animation-overlap.html                                (rev 0)
+++ trunk/LayoutTests/compositing/animation/filling-animation-overlap.html        2014-03-20 18:32:13 UTC (rev 165977)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;html&gt;
+&lt;head&gt;
+    &lt;style&gt;
+        .box {
+            position: relative;
+            height: 100px;
+            width: 100px;
+            margin: 40px;
+            box-shadow: 0 0 10px black;
+            background-color: orange;
+        }
+        
+        .animating {
+            -webkit-animation: spin 1 0.1s forwards;
+            background-color: blue;
+        }
+
+        @-webkit-keyframes spin {
+            from { -webkit-transform: rotate(0); }
+            to   { -webkit-transform: rotate(10deg); }
+        }
+    &lt;/style&gt;
+    &lt;script&gt;
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+            
+        function doTest()
+        {
+            document.getElementById('box').addEventListener('webkitAnimationEnd', function() {
+                if (window.testRunner) {
+                    document.getElementById('results').innerText = window.internals.layerTreeAsText(document);
+                    testRunner.notifyDone();
+                }
+            })
+        }
+        window.addEventListener('load', doTest, false);
+    &lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div id=&quot;box&quot; class=&quot;animating box&quot;&gt;&lt;/div&gt;
+&lt;div class=&quot;box&quot;&gt;&lt;/div&gt;
+
+&lt;pre id=&quot;results&quot;&gt;Layer tree dump goes here&lt;/pre&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">Property changes on: trunk/LayoutTests/compositing/animation/filling-animation-overlap.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkLayoutTestscompositinganimationlayerforfillinganimationexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/animation/layer-for-filling-animation-expected.txt (0 => 165977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/animation/layer-for-filling-animation-expected.txt                                (rev 0)
+++ trunk/LayoutTests/compositing/animation/layer-for-filling-animation-expected.txt        2014-03-20 18:32:13 UTC (rev 165977)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+(GraphicsLayer
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (children 1
+        (GraphicsLayer
+          (position 44.00 36.00)
+          (bounds 128.00 128.00)
+          (drawsContent 1)
+        )
+      )
+    )
+  )
+)
+
</ins><span class="cx">Property changes on: trunk/LayoutTests/compositing/animation/layer-for-filling-animation-expected.txt
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkLayoutTestscompositinganimationlayerforfillinganimationhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/animation/layer-for-filling-animation.html (0 => 165977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/animation/layer-for-filling-animation.html                                (rev 0)
+++ trunk/LayoutTests/compositing/animation/layer-for-filling-animation.html        2014-03-20 18:32:13 UTC (rev 165977)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;html&gt;
+&lt;head&gt;
+    &lt;style&gt;
+        .box {
+            position: relative;
+            height: 100px;
+            width: 100px;
+            margin: 50px;
+            background-color: blue;
+            box-shadow: 0 0 10px black;
+        }
+        
+        .animating {
+            -webkit-animation: spin 1 0.1s forwards;
+        }
+
+        @-webkit-keyframes spin {
+            from { -webkit-transform: rotate(0); }
+            to   { -webkit-transform: rotate(3deg); }
+        }
+    &lt;/style&gt;
+    &lt;script&gt;
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+            
+        function doTest()
+        {
+            document.getElementById('box').addEventListener('webkitAnimationEnd', function() {
+                if (window.testRunner) {
+                    document.getElementById('results').innerText = window.internals.layerTreeAsText(document);
+                    testRunner.notifyDone();
+                }
+            })
+        }
+        window.addEventListener('load', doTest, false);
+    &lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div id=&quot;box&quot; class=&quot;animating box&quot;&gt;&lt;/div&gt;
+
+&lt;pre id=&quot;results&quot;&gt;Layer tree dump goes here&lt;/pre&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">Property changes on: trunk/LayoutTests/compositing/animation/layer-for-filling-animation.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (165976 => 165977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-03-20 18:24:34 UTC (rev 165976)
+++ trunk/Source/WebCore/ChangeLog        2014-03-20 18:32:13 UTC (rev 165977)
</span><span class="lines">@@ -1,3 +1,46 @@
</span><ins>+2014-03-20  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        A completed fill-forwards animation should not disable overlap testing
+        https://bugs.webkit.org/show_bug.cgi?id=130522
+        &lt;rdar://problem/15862395&gt;
+
+        Reviewed by Dean Jackson.
+        
+        Previously, if -webkit-transform was being keyframe-animated, and the
+        animation had fill-forwards, then we would continue to think that the
+        animation is running and turn off compositing overlap testing. This
+        caused some sites to keep too much backing store around.
+        
+        Fix by having isRunning{Accelerated}AnimationOnRenderer take some flags
+        so that more specific questions about the running state can be asked.
+        For layer creation, keep using the same criteria as before (for now)
+        which includes paused and fill-forwards animations. For overlap testing,
+        don't include the fill-forwards test.
+
+        Tests: compositing/animation/filling-animation-overlap-at-end.html
+               compositing/animation/filling-animation-overlap.html
+               compositing/animation/layer-for-filling-animation.html
+
+        * page/animation/AnimationBase.h:
+        (WebCore::AnimationBase::fillingForwards):
+        (WebCore::AnimationBase::inPausedState):
+        (WebCore::AnimationBase::isAnimatingProperty):
+        * page/animation/AnimationController.cpp:
+        (WebCore::AnimationControllerPrivate::isRunningAnimationOnRenderer):
+        (WebCore::AnimationControllerPrivate::isRunningAcceleratedAnimationOnRenderer):
+        (WebCore::AnimationController::isRunningAnimationOnRenderer):
+        (WebCore::AnimationController::isRunningAcceleratedAnimationOnRenderer):
+        * page/animation/AnimationController.h:
+        * page/animation/AnimationControllerPrivate.h:
+        * page/animation/CompositeAnimation.cpp:
+        (WebCore::CompositeAnimation::isAnimatingProperty):
+        * page/animation/CompositeAnimation.h:
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::requiresCompositingForAnimation):
+        (WebCore::RenderLayerCompositor::isRunningAcceleratedTransformAnimation):
+
</ins><span class="cx"> 2014-03-20  Dirk Schulze  &lt;krit@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Canvas methods clip/fill/stroke should not except 0 argument
</span></span></pre></div>
<a id="trunkSourceWebCorepageanimationAnimationBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/animation/AnimationBase.h (165976 => 165977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/animation/AnimationBase.h        2014-03-20 18:24:34 UTC (rev 165976)
+++ trunk/Source/WebCore/page/animation/AnimationBase.h        2014-03-20 18:32:13 UTC (rev 165977)
</span><span class="lines">@@ -122,9 +122,11 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     bool postActive() const { return m_animState == AnimationStateDone; }
</span><ins>+    bool fillingForwards() const { return m_animState == AnimationStateFillingForwards; }
</ins><span class="cx">     bool active() const { return !postActive() &amp;&amp; !preActive(); }
</span><span class="cx">     bool running() const { return !isNew() &amp;&amp; !postActive(); }
</span><span class="cx">     bool paused() const { return m_pauseTime &gt;= 0 || m_animState == AnimationStatePausedNew; }
</span><ins>+    bool inPausedState() const { return m_animState &gt;= AnimationStatePausedNew &amp;&amp; m_animState &lt;= AnimationStatePausedRun; }
</ins><span class="cx">     bool isNew() const { return m_animState == AnimationStateNew || m_animState == AnimationStatePausedNew; }
</span><span class="cx">     bool waitingForStartTime() const { return m_animState == AnimationStateStartWaitResponse; }
</span><span class="cx">     bool waitingForStyleAvailable() const { return m_animState == AnimationStateStartWaitStyleAvailable; }
</span><span class="lines">@@ -153,15 +155,34 @@
</span><span class="cx">     // Does this animation/transition involve the given property?
</span><span class="cx">     virtual bool affectsProperty(CSSPropertyID /*property*/) const { return false; }
</span><span class="cx"> 
</span><del>-    bool isAnimatingProperty(CSSPropertyID property, bool acceleratedOnly, bool isRunningNow) const
</del><ins>+    enum RunningStates {
+        Delaying = 1 &lt;&lt; 0,
+        Paused = 1 &lt;&lt; 1,
+        Running = 1 &lt;&lt; 2,
+        FillingFowards = 1 &lt;&lt; 3
+    };
+    typedef unsigned RunningState;
+    bool isAnimatingProperty(CSSPropertyID property, bool acceleratedOnly, RunningState runningState) const
</ins><span class="cx">     {
</span><span class="cx">         if (acceleratedOnly &amp;&amp; !m_isAccelerated)
</span><span class="cx">             return false;
</span><del>-            
-        if (isRunningNow)
-            return (!waitingToStart() &amp;&amp; !postActive()) &amp;&amp; affectsProperty(property);
</del><span class="cx"> 
</span><del>-        return !postActive() &amp;&amp; affectsProperty(property);
</del><ins>+        if (!affectsProperty(property))
+            return false;
+
+        if ((runningState &amp; Delaying) &amp;&amp; preActive())
+            return true;
+
+        if ((runningState &amp; Paused) &amp;&amp; inPausedState())
+            return true;
+
+        if ((runningState &amp; Running) &amp;&amp; !inPausedState() &amp;&amp; (m_animState &gt;= AnimationStateStartWaitStyleAvailable &amp;&amp; m_animState &lt;= AnimationStateDone))
+            return true;
+
+        if ((runningState &amp; FillingFowards) &amp;&amp; m_animState == AnimationStateFillingForwards)
+            return true;
+
+        return false;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // FIXME: rename this using the &quot;lists match&quot; terminology.
</span></span></pre></div>
<a id="trunkSourceWebCorepageanimationAnimationControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/animation/AnimationController.cpp (165976 => 165977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/animation/AnimationController.cpp        2014-03-20 18:24:34 UTC (rev 165976)
+++ trunk/Source/WebCore/page/animation/AnimationController.cpp        2014-03-20 18:32:13 UTC (rev 165977)
</span><span class="lines">@@ -236,16 +236,16 @@
</span><span class="cx">     fireEventsAndUpdateStyle();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool AnimationControllerPrivate::isRunningAnimationOnRenderer(RenderElement* renderer, CSSPropertyID property, bool isRunningNow) const
</del><ins>+bool AnimationControllerPrivate::isRunningAnimationOnRenderer(RenderElement* renderer, CSSPropertyID property, AnimationBase::RunningState runningState) const
</ins><span class="cx"> {
</span><span class="cx">     const CompositeAnimation* animation = m_compositeAnimations.get(renderer);
</span><del>-    return animation &amp;&amp; animation-&gt;isAnimatingProperty(property, false, isRunningNow);
</del><ins>+    return animation &amp;&amp; animation-&gt;isAnimatingProperty(property, false, runningState);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool AnimationControllerPrivate::isRunningAcceleratedAnimationOnRenderer(RenderElement* renderer, CSSPropertyID property, bool isRunningNow) const
</del><ins>+bool AnimationControllerPrivate::isRunningAcceleratedAnimationOnRenderer(RenderElement* renderer, CSSPropertyID property, AnimationBase::RunningState runningState) const
</ins><span class="cx"> {
</span><span class="cx">     const CompositeAnimation* animation = m_compositeAnimations.get(renderer);
</span><del>-    return animation &amp;&amp; animation-&gt;isAnimatingProperty(property, true, isRunningNow);
</del><ins>+    return animation &amp;&amp; animation-&gt;isAnimatingProperty(property, true, runningState);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void AnimationControllerPrivate::suspendAnimations()
</span><span class="lines">@@ -555,14 +555,14 @@
</span><span class="cx">     return m_data-&gt;pauseTransitionAtTime(renderer, property, t);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool AnimationController::isRunningAnimationOnRenderer(RenderElement* renderer, CSSPropertyID property, bool isRunningNow) const
</del><ins>+bool AnimationController::isRunningAnimationOnRenderer(RenderElement* renderer, CSSPropertyID property, AnimationBase::RunningState runningState) const
</ins><span class="cx"> {
</span><del>-    return m_data-&gt;isRunningAnimationOnRenderer(renderer, property, isRunningNow);
</del><ins>+    return m_data-&gt;isRunningAnimationOnRenderer(renderer, property, runningState);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool AnimationController::isRunningAcceleratedAnimationOnRenderer(RenderElement* renderer, CSSPropertyID property, bool isRunningNow) const
</del><ins>+bool AnimationController::isRunningAcceleratedAnimationOnRenderer(RenderElement* renderer, CSSPropertyID property, AnimationBase::RunningState runningState) const
</ins><span class="cx"> {
</span><del>-    return m_data-&gt;isRunningAcceleratedAnimationOnRenderer(renderer, property, isRunningNow);
</del><ins>+    return m_data-&gt;isRunningAcceleratedAnimationOnRenderer(renderer, property, runningState);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool AnimationController::isSuspended() const
</span></span></pre></div>
<a id="trunkSourceWebCorepageanimationAnimationControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/animation/AnimationController.h (165976 => 165977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/animation/AnimationController.h        2014-03-20 18:24:34 UTC (rev 165976)
+++ trunk/Source/WebCore/page/animation/AnimationController.h        2014-03-20 18:32:13 UTC (rev 165977)
</span><span class="lines">@@ -29,13 +29,13 @@
</span><span class="cx"> #ifndef AnimationController_h
</span><span class="cx"> #define AnimationController_h
</span><span class="cx"> 
</span><ins>+#include &quot;AnimationBase.h&quot;
</ins><span class="cx"> #include &quot;CSSPropertyNames.h&quot;
</span><span class="cx"> #include &lt;wtf/Forward.h&gt;
</span><span class="cx"> #include &lt;wtf/OwnPtr.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-class AnimationBase;
</del><span class="cx"> class AnimationControllerPrivate;
</span><span class="cx"> class Document;
</span><span class="cx"> class Element;
</span><span class="lines">@@ -59,8 +59,8 @@
</span><span class="cx">     bool pauseTransitionAtTime(RenderElement*, const String&amp; property, double t); // To be used only for testing
</span><span class="cx">     unsigned numberOfActiveAnimations(Document*) const; // To be used only for testing
</span><span class="cx">     
</span><del>-    bool isRunningAnimationOnRenderer(RenderElement*, CSSPropertyID, bool isRunningNow = true) const;
-    bool isRunningAcceleratedAnimationOnRenderer(RenderElement*, CSSPropertyID, bool isRunningNow = true) const;
</del><ins>+    bool isRunningAnimationOnRenderer(RenderElement*, CSSPropertyID, AnimationBase::RunningState) const;
+    bool isRunningAcceleratedAnimationOnRenderer(RenderElement*, CSSPropertyID, AnimationBase::RunningState) const;
</ins><span class="cx"> 
</span><span class="cx">     bool isSuspended() const;
</span><span class="cx">     void suspendAnimations();
</span></span></pre></div>
<a id="trunkSourceWebCorepageanimationAnimationControllerPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/animation/AnimationControllerPrivate.h (165976 => 165977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/animation/AnimationControllerPrivate.h        2014-03-20 18:24:34 UTC (rev 165976)
+++ trunk/Source/WebCore/page/animation/AnimationControllerPrivate.h        2014-03-20 18:32:13 UTC (rev 165977)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #ifndef AnimationControllerPrivate_h
</span><span class="cx"> #define AnimationControllerPrivate_h
</span><span class="cx"> 
</span><ins>+#include &quot;AnimationBase.h&quot;
</ins><span class="cx"> #include &quot;CSSPropertyNames.h&quot;
</span><span class="cx"> #include &quot;Timer.h&quot;
</span><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><span class="lines">@@ -85,8 +86,8 @@
</span><span class="cx">     void resumeAnimationsForDocument(Document*);
</span><span class="cx">     void startAnimationsIfNotSuspended(Document*);
</span><span class="cx"> 
</span><del>-    bool isRunningAnimationOnRenderer(RenderElement*, CSSPropertyID, bool isRunningNow) const;
-    bool isRunningAcceleratedAnimationOnRenderer(RenderElement*, CSSPropertyID, bool isRunningNow) const;
</del><ins>+    bool isRunningAnimationOnRenderer(RenderElement*, CSSPropertyID, AnimationBase::RunningState) const;
+    bool isRunningAcceleratedAnimationOnRenderer(RenderElement*, CSSPropertyID, AnimationBase::RunningState) const;
</ins><span class="cx"> 
</span><span class="cx">     bool pauseAnimationAtTime(RenderElement*, const AtomicString&amp; name, double t);
</span><span class="cx">     bool pauseTransitionAtTime(RenderElement*, const String&amp; property, double t);
</span></span></pre></div>
<a id="trunkSourceWebCorepageanimationCompositeAnimationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/animation/CompositeAnimation.cpp (165976 => 165977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/animation/CompositeAnimation.cpp        2014-03-20 18:24:34 UTC (rev 165976)
+++ trunk/Source/WebCore/page/animation/CompositeAnimation.cpp        2014-03-20 18:32:13 UTC (rev 165977)
</span><span class="lines">@@ -473,14 +473,14 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool CompositeAnimation::isAnimatingProperty(CSSPropertyID property, bool acceleratedOnly, bool isRunningNow) const
</del><ins>+bool CompositeAnimation::isAnimatingProperty(CSSPropertyID property, bool acceleratedOnly, AnimationBase::RunningState runningState) const
</ins><span class="cx"> {
</span><span class="cx">     if (!m_keyframeAnimations.isEmpty()) {
</span><span class="cx">         m_keyframeAnimations.checkConsistency();
</span><span class="cx">         AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end();
</span><span class="cx">         for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) {
</span><span class="cx">             KeyframeAnimation* anim = it-&gt;value.get();
</span><del>-            if (anim &amp;&amp; anim-&gt;isAnimatingProperty(property, acceleratedOnly, isRunningNow))
</del><ins>+            if (anim &amp;&amp; anim-&gt;isAnimatingProperty(property, acceleratedOnly, runningState))
</ins><span class="cx">                 return true;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -489,7 +489,7 @@
</span><span class="cx">         CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end();
</span><span class="cx">         for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) {
</span><span class="cx">             ImplicitAnimation* anim = it-&gt;value.get();
</span><del>-            if (anim &amp;&amp; anim-&gt;isAnimatingProperty(property, acceleratedOnly, isRunningNow))
</del><ins>+            if (anim &amp;&amp; anim-&gt;isAnimatingProperty(property, acceleratedOnly, runningState))
</ins><span class="cx">                 return true;
</span><span class="cx">         }
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCorepageanimationCompositeAnimationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/animation/CompositeAnimation.h (165976 => 165977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/animation/CompositeAnimation.h        2014-03-20 18:24:34 UTC (rev 165976)
+++ trunk/Source/WebCore/page/animation/CompositeAnimation.h        2014-03-20 18:32:13 UTC (rev 165977)
</span><span class="lines">@@ -68,7 +68,7 @@
</span><span class="cx">     
</span><span class="cx">     bool hasAnimations() const  { return !m_transitions.isEmpty() || !m_keyframeAnimations.isEmpty(); }
</span><span class="cx"> 
</span><del>-    bool isAnimatingProperty(CSSPropertyID, bool acceleratedOnly, bool isRunningNow) const;
</del><ins>+    bool isAnimatingProperty(CSSPropertyID, bool acceleratedOnly, AnimationBase::RunningState) const;
</ins><span class="cx"> 
</span><span class="cx">     PassRefPtr&lt;KeyframeAnimation&gt; getAnimationForProperty(CSSPropertyID) const;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerBackingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (165976 => 165977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp        2014-03-20 18:24:34 UTC (rev 165976)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp        2014-03-20 18:32:13 UTC (rev 165977)
</span><span class="lines">@@ -670,11 +670,11 @@
</span><span class="cx"> 
</span><span class="cx">     // Set transform property, if it is not animating. We have to do this here because the transform
</span><span class="cx">     // is affected by the layer dimensions.
</span><del>-    if (!renderer().animation().isRunningAcceleratedAnimationOnRenderer(&amp;renderer(), CSSPropertyWebkitTransform))
</del><ins>+    if (!renderer().animation().isRunningAcceleratedAnimationOnRenderer(&amp;renderer(), CSSPropertyWebkitTransform, AnimationBase::Running | AnimationBase::Paused | AnimationBase::FillingFowards))
</ins><span class="cx">         updateTransform(&amp;renderer().style());
</span><span class="cx"> 
</span><span class="cx">     // Set opacity, if it is not animating.
</span><del>-    if (!renderer().animation().isRunningAcceleratedAnimationOnRenderer(&amp;renderer(), CSSPropertyOpacity))
</del><ins>+    if (!renderer().animation().isRunningAcceleratedAnimationOnRenderer(&amp;renderer(), CSSPropertyOpacity, AnimationBase::Running | AnimationBase::Paused | AnimationBase::FillingFowards))
</ins><span class="cx">         updateOpacity(&amp;renderer().style());
</span><span class="cx">         
</span><span class="cx"> #if ENABLE(CSS_FILTERS)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerCompositorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (165976 => 165977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp        2014-03-20 18:24:34 UTC (rev 165976)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp        2014-03-20 18:32:13 UTC (rev 165977)
</span><span class="lines">@@ -2368,13 +2368,14 @@
</span><span class="cx">     if (!(m_compositingTriggers &amp; ChromeClient::AnimationTrigger))
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><ins>+    const AnimationBase::RunningState activeAnimationState = AnimationBase::Running | AnimationBase::Paused | AnimationBase::FillingFowards;
</ins><span class="cx">     AnimationController&amp; animController = renderer.animation();
</span><del>-    return (animController.isRunningAnimationOnRenderer(&amp;renderer, CSSPropertyOpacity)
</del><ins>+    return (animController.isRunningAnimationOnRenderer(&amp;renderer, CSSPropertyOpacity, activeAnimationState)
</ins><span class="cx">             &amp;&amp; (inCompositingMode() || (m_compositingTriggers &amp; ChromeClient::AnimatedOpacityTrigger)))
</span><span class="cx"> #if ENABLE(CSS_FILTERS)
</span><del>-            || animController.isRunningAnimationOnRenderer(&amp;renderer, CSSPropertyWebkitFilter)
</del><ins>+            || animController.isRunningAnimationOnRenderer(&amp;renderer, CSSPropertyWebkitFilter, activeAnimationState)
</ins><span class="cx"> #endif // CSS_FILTERS
</span><del>-            || animController.isRunningAnimationOnRenderer(&amp;renderer, CSSPropertyWebkitTransform);
</del><ins>+            || animController.isRunningAnimationOnRenderer(&amp;renderer, CSSPropertyWebkitTransform, activeAnimationState);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool RenderLayerCompositor::requiresCompositingForIndirectReason(RenderLayerModelObject&amp; renderer, bool hasCompositedDescendants, bool hasBlendedDescendants, bool has3DTransformedDescendants, RenderLayer::IndirectCompositingReason&amp; reason) const
</span><span class="lines">@@ -2554,7 +2555,7 @@
</span><span class="cx">     if (!(m_compositingTriggers &amp; ChromeClient::AnimationTrigger))
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    return renderer.animation().isRunningAnimationOnRenderer(&amp;renderer, CSSPropertyWebkitTransform);
</del><ins>+    return renderer.animation().isRunningAcceleratedAnimationOnRenderer(&amp;renderer, CSSPropertyWebkitTransform, AnimationBase::Running | AnimationBase::Paused);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // If an element has negative z-index children, those children render in front of the 
</span></span></pre>
</div>
</div>

</body>
</html>