<!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>[37485] 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/37485">37485</a></dd>
<dt>Author</dt> <dd>cmarrin@apple.com</dd>
<dt>Date</dt> <dd>2008-10-10 11:43:47 -0700 (Fri, 10 Oct 2008)</dd>
</dl>

<h3>Log Message</h3>
<pre>2008-10-10  Chris Marrin  &lt;cmarrin@apple.com&gt;

        Reviewed by Dan Bernstein.

        Fix for https://bugs.webkit.org/show_bug.cgi?id=21025
        CSS transition with duration=0 and delay=0 doesn't override ongoing transition

        Test: transitions/interrupt-zero-duration.html

        * page/animation/CompositeAnimation.cpp:
        (WebCore::CompositeAnimation::updateTransitions):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCorepageanimationCompositeAnimationcpp">trunk/WebCore/page/animation/CompositeAnimation.cpp</a></li>
<li><a href="#trunkWebCorepageanimationKeyframeAnimationh">trunk/WebCore/page/animation/KeyframeAnimation.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTeststransitionsinterruptzerodurationexpectedtxt">trunk/LayoutTests/transitions/interrupt-zero-duration-expected.txt</a></li>
<li><a href="#trunkLayoutTeststransitionsinterruptzerodurationhtml">trunk/LayoutTests/transitions/interrupt-zero-duration.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (37484 => 37485)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2008-10-10 18:04:20 UTC (rev 37484)
+++ trunk/LayoutTests/ChangeLog        2008-10-10 18:43:47 UTC (rev 37485)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2008-10-10  Chris Marrin  &lt;cmarrin@apple.com&gt;
+
+        Reviewed by Dan Bernstein.
+
+        Testcase for https://bugs.webkit.org/show_bug.cgi?id=21025
+        CSS transition with duration=0 and delay=0 doesn't override ongoing transition
+
+        * transitions/interrupt-zero-duration-expected.txt: Added.
+        * transitions/interrupt-zero-duration.html: Added.
+
</ins><span class="cx"> 2008-10-10  David Hyatt  &lt;hyatt@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add test for scrollbar buttons and track supporting increment/decrement/start/end.
</span></span></pre></div>
<a id="trunkLayoutTeststransitionsinterruptzerodurationexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/transitions/interrupt-zero-duration-expected.txt (0 => 37485)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/transitions/interrupt-zero-duration-expected.txt                                (rev 0)
+++ trunk/LayoutTests/transitions/interrupt-zero-duration-expected.txt        2008-10-10 18:43:47 UTC (rev 37485)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+This tests changing a transitioning property while running and resetting its duration to 0. The box should start moving left and after 500ms snap back to 0
+
+PASS
</ins></span></pre></div>
<a id="trunkLayoutTeststransitionsinterruptzerodurationhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/transitions/interrupt-zero-duration.html (0 => 37485)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/transitions/interrupt-zero-duration.html                                (rev 0)
+++ trunk/LayoutTests/transitions/interrupt-zero-duration.html        2008-10-10 18:43:47 UTC (rev 37485)
</span><span class="lines">@@ -0,0 +1,81 @@
</span><ins>+&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;
+   &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;
+
+&lt;html lang=&quot;en&quot;&gt;
+&lt;head&gt;
+    &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot;&gt;
+    &lt;title&gt;Interrupt Transition and Change Its Duration to Zero&lt;/title&gt;
+    &lt;style type=&quot;text/css&quot; media=&quot;screen&quot;&gt;
+    #box {
+        position: relative;
+        height: 100px;
+        width: 100px;
+        background-color: blue;
+        -webkit-transition-property: left;
+        -webkit-transition-duration: 2s;
+        -webkit-transition-timing-function: linear;
+    }
+    &lt;/style&gt;
+    &lt;script type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&gt;
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+        layoutTestController.waitUntilDone();
+    }
+
+    result = &quot;PASS&quot;;
+    
+    function isEqual(actual, desired, tolerance)
+    {
+        var diff = Math.abs(actual - desired);
+        return diff &lt;= tolerance;
+    }
+    
+    function snapshot(expected, tolerance)
+    {
+        if (result != &quot;PASS&quot;)
+            return;
+            
+        var left = parseInt(window.getComputedStyle(document.getElementById('box')).left);
+        if (!isEqual(left, expected, tolerance))
+            result = &quot;FAIL(was:&quot;+left+&quot;, expected:&quot;+expected+&quot;)&quot;;
+    }
+    
+    function reset()
+    {
+        document.getElementById('box').style.webkitTransitionDuration = &quot;0s&quot;;
+        document.getElementById('box').style.left = &quot;0px&quot;;
+    }
+    
+    function startTransition()
+    {
+        document.getElementById('box').style.left = &quot;400px&quot;;
+    }
+
+    function start()
+    {
+        setTimeout(&quot;startTransition()&quot;, 0);
+        setTimeout(&quot;snapshot(100, 80)&quot;, 500);
+        setTimeout(&quot;reset()&quot;, 600);
+        setTimeout(&quot;snapshot(0, 0)&quot;, 700);
+        
+        window.setTimeout(function() {
+            document.getElementById('result').innerHTML = result;
+            if (window.layoutTestController)
+                layoutTestController.notifyDone();
+        }, 800);
+    }
+    
+    window.addEventListener('load', start, false)
+  &lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;
+This tests changing a transitioning property while running and resetting its duration to 0.
+The box should start moving left and after 500ms snap back to 0&lt;/p&gt;
+&lt;div id=&quot;box&quot;&gt;
+&lt;/div&gt;
+&lt;div id=&quot;result&quot;&gt;
+&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (37484 => 37485)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2008-10-10 18:04:20 UTC (rev 37484)
+++ trunk/WebCore/ChangeLog        2008-10-10 18:43:47 UTC (rev 37485)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2008-10-10  Chris Marrin  &lt;cmarrin@apple.com&gt;
+
+        Reviewed by Dan Bernstein.
+
+        Fix for https://bugs.webkit.org/show_bug.cgi?id=21025
+        CSS transition with duration=0 and delay=0 doesn't override ongoing transition
+
+        Test: transitions/interrupt-zero-duration.html
+
+        * page/animation/CompositeAnimation.cpp:
+        (WebCore::CompositeAnimation::updateTransitions):
+
</ins><span class="cx"> 2008-10-10  Kevin Ollivier  &lt;kevino@theolliviers.com&gt;
</span><span class="cx"> 
</span><span class="cx">         wx build fix. Add new scrollbar-related sources.
</span></span></pre></div>
<a id="trunkWebCorepageanimationCompositeAnimationcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/page/animation/CompositeAnimation.cpp (37484 => 37485)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/page/animation/CompositeAnimation.cpp        2008-10-10 18:04:20 UTC (rev 37484)
+++ trunk/WebCore/page/animation/CompositeAnimation.cpp        2008-10-10 18:43:47 UTC (rev 37485)
</span><span class="lines">@@ -109,13 +109,8 @@
</span><span class="cx">     // Check to see if we need to update the active transitions
</span><span class="cx">     for (size_t i = 0; i &lt; targetStyle-&gt;transitions()-&gt;size(); ++i) {
</span><span class="cx">         const Animation* anim = targetStyle-&gt;transitions()-&gt;animation(i);
</span><del>-        double duration = anim-&gt;duration();
-        double delay = anim-&gt;delay();
</del><ins>+        bool isActiveTransition = anim-&gt;duration() || anim-&gt;delay() &gt; 0;
</ins><span class="cx"> 
</span><del>-        // If this is an empty transition, skip it
-        if (duration == 0 &amp;&amp; delay &lt;= 0)
-            continue;
-
</del><span class="cx">         int prop = anim-&gt;property();
</span><span class="cx"> 
</span><span class="cx">         if (prop == cAnimateNone)
</span><span class="lines">@@ -150,13 +145,11 @@
</span><span class="cx">                // you have both an explicit transition-property and 'all' in the same
</span><span class="cx">                // list. In this case, the latter one overrides the earlier one, so we
</span><span class="cx">                // behave as though this is a running animation being replaced.
</span><del>-                if (!implAnim-&gt;isTargetPropertyEqual(prop, targetStyle)) {
</del><ins>+                if (!isActiveTransition || !implAnim-&gt;isTargetPropertyEqual(prop, targetStyle))
</ins><span class="cx">                     m_transitions.remove(prop);
</span><del>-                    equal = false;
-                }
</del><span class="cx">             } else {
</span><del>-                // See if we need to start a new transition
-                equal = AnimationBase::propertiesEqual(prop, fromStyle, targetStyle);
</del><ins>+                // We need to start a transition if it is active and the properties don't match
+                equal = !isActiveTransition || AnimationBase::propertiesEqual(prop, fromStyle, targetStyle);
</ins><span class="cx">             }
</span><span class="cx"> 
</span><span class="cx">             if (!equal) {
</span><span class="lines">@@ -210,8 +203,7 @@
</span><span class="cx">                 keyframeAnim-&gt;setIndex(i);
</span><span class="cx">             } else if ((anim-&gt;duration() || anim-&gt;delay()) &amp;&amp; anim-&gt;iterationCount()) {
</span><span class="cx">                 keyframeAnim = KeyframeAnimation::create(const_cast&lt;Animation*&gt;(anim), renderer, i, m_compositeAnimation, currentStyle ? currentStyle : targetStyle);
</span><del>-                if (keyframeAnim-&gt;hasKeyframes())
-                    m_keyframeAnimations.set(keyframeAnim-&gt;name().impl(), keyframeAnim);
</del><ins>+                m_keyframeAnimations.set(keyframeAnim-&gt;name().impl(), keyframeAnim);
</ins><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkWebCorepageanimationKeyframeAnimationh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/page/animation/KeyframeAnimation.h (37484 => 37485)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/page/animation/KeyframeAnimation.h        2008-10-10 18:04:20 UTC (rev 37484)
+++ trunk/WebCore/page/animation/KeyframeAnimation.h        2008-10-10 18:43:47 UTC (rev 37485)
</span><span class="lines">@@ -53,7 +53,6 @@
</span><span class="cx"> 
</span><span class="cx">     virtual bool shouldFireEvents() const { return true; }
</span><span class="cx">     
</span><del>-    bool hasKeyframes() const { return m_keyframes.size() &gt;= 2; }
</del><span class="cx">     bool hasAnimationForProperty(int property) const;
</span><span class="cx">     
</span><span class="cx">     const RenderStyle* unanimatedStyle() const { return m_unanimatedStyle; }
</span></span></pre>
</div>
</div>

</body>
</html>