[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

simon.fraser at apple.com simon.fraser at apple.com
Thu Apr 8 00:33:13 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 8e927db86aae56290feb7e0d8ed70c54caf75679
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Dec 11 21:02:50 2009 +0000

    2009-12-11  Simon Fraser  <simon.fraser at apple.com>
    
            Reviewed by Darin Adler.
    
            Negative values for animation-delay are ignored (treated as zero)
            https://bugs.webkit.org/show_bug.cgi?id=26150
    
            When we get the m_startTime for an animation or transition, subtract any negative
            delay so the animation/transition behaves like it started in the past, per spec.
    
            Tests: animations/negative-delay.html
                   transitions/negative-delay.html
    
            * page/animation/AnimationBase.cpp:
            (WebCore::AnimationBase::updateStateMachine):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52018 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 4cc27b4..d1c5cab 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2009-12-11  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Darin Adler.
+
+        Negative values for animation-delay are ignored (treated as zero)
+        https://bugs.webkit.org/show_bug.cgi?id=26150
+        
+        Tests for software and accelerated animations and transitions with negative delay.
+
+        * animations/negative-delay-expected.txt: Added.
+        * animations/negative-delay.html: Added.
+        * transitions/negative-delay-expected.txt: Added.
+        * transitions/negative-delay.html: Added.
+
 2009-12-11  Drew Wilson  <atwilson at chromium.org>
 
         Reviewed by Darin Adler.
diff --git a/LayoutTests/animations/negative-delay-expected.txt b/LayoutTests/animations/negative-delay-expected.txt
new file mode 100644
index 0000000..d3965bb
--- /dev/null
+++ b/LayoutTests/animations/negative-delay-expected.txt
@@ -0,0 +1,9 @@
+PASS - "left" property for "square1" element at 0s saw something close to: 300
+PASS - "left" property for "square2" element at 0s saw something close to: 0
+PASS - "left" property for "square1" element at 0.5s saw something close to: 450
+PASS - "left" property for "square2" element at 0.5s saw something close to: 150
+PASS - "webkitTransform.4" property for "square3" element at 0s saw something close to: 300
+PASS - "webkitTransform.4" property for "square4" element at 0s saw something close to: 0
+PASS - "webkitTransform.4" property for "square3" element at 0.5s saw something close to: 450
+PASS - "webkitTransform.4" property for "square4" element at 0.5s saw something close to: 150
+
diff --git a/LayoutTests/animations/negative-delay.html b/LayoutTests/animations/negative-delay.html
new file mode 100644
index 0000000..6853402
--- /dev/null
+++ b/LayoutTests/animations/negative-delay.html
@@ -0,0 +1,89 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+        "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <title>For Bug 26150 - Negative values for animation-delay are ignored</title>
+  <style type="text/css">
+    .square {
+      background: blue;
+      width: 20px;
+      height: 20px;
+      position: absolute;
+      -webkit-animation-duration: 2s;
+      -webkit-animation-iteration-count: 1;
+      -webkit-animation-timing-function: linear;
+    }
+
+    .move {
+      -webkit-animation-name: square-move;
+    }
+
+    .translate {
+      -webkit-animation-name: square-translate;
+    }
+
+    @-webkit-keyframes square-move {
+      0%    { left: 0px; }
+      100%  { left: 600px; }
+    }
+
+    @-webkit-keyframes square-translate {
+      0%    { -webkit-transform: translateX(0); }
+      100%  { -webkit-transform: translateX(600px); }
+    }
+
+    #square1 {
+      top: 20px;
+      left: 20px;
+      -webkit-animation-delay: -1s;
+    }
+
+    #square2 {
+      top: 60px;
+      left: 20px;
+    }
+
+    #square3 {
+      top: 100px;
+      left: 20px;
+      -webkit-animation-delay: -1s;
+    }
+
+    #square4 {
+      top: 140px;
+      left: 20px;
+    }
+  </style>
+
+  <script src="animation-test-helpers.js" type="text/javascript" charset="utf-8"></script>
+
+  <script>
+    // The delay of square1 is negative so square1 should be in ahead of square2.
+    const expectedValues = [
+      // [animation-name, time, element-id, property, expected-value, tolerance]
+      ["square-move", 0, "square1", "left", 300, 15],
+      ["square-move", 0, "square2", "left", 0, 15],
+      ["square-move", 0.5, "square1", "left", 450, 15],
+      ["square-move", 0.5, "square2", "left", 150, 15],
+      ["square-translate", 0, "square3", "webkitTransform.4", 300, 20],
+      ["square-translate", 0, "square4", "webkitTransform.4", 0, 20],
+      ["square-translate", 0.5, "square3", "webkitTransform.4", 450, 20],
+      ["square-translate", 0.5, "square4", "webkitTransform.4", 150, 20],
+    ];
+
+    runAnimationTest(expectedValues);
+  </script>
+</head>
+
+<body>
+
+<div class="square move" id="square1"></div>
+<div class="square move" id="square2"></div>
+<div class="square translate" id="square3"></div>
+<div class="square translate" id="square4"></div>
+
+<div id="result">
+</div>
+
+</body>
+</html>
diff --git a/LayoutTests/transitions/negative-delay-expected.txt b/LayoutTests/transitions/negative-delay-expected.txt
new file mode 100644
index 0000000..0b2698b
--- /dev/null
+++ b/LayoutTests/transitions/negative-delay-expected.txt
@@ -0,0 +1,9 @@
+PASS - "left" property for "square1" element at 0s saw something close to: 300
+PASS - "left" property for "square2" element at 0s saw something close to: 0
+PASS - "left" property for "square1" element at 0.5s saw something close to: 450
+PASS - "left" property for "square2" element at 0.5s saw something close to: 150
+PASS - "-webkit-transform.4" property for "square3" element at 0s saw something close to: 300
+PASS - "-webkit-transform.4" property for "square4" element at 0s saw something close to: 0
+PASS - "-webkit-transform.4" property for "square3" element at 0.5s saw something close to: 450
+PASS - "-webkit-transform.4" property for "square4" element at 0.5s saw something close to: 150
+
diff --git a/LayoutTests/transitions/negative-delay.html b/LayoutTests/transitions/negative-delay.html
new file mode 100644
index 0000000..f9970b0
--- /dev/null
+++ b/LayoutTests/transitions/negative-delay.html
@@ -0,0 +1,97 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+        "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <title>For Bug 26150 - Negative values for animation-delay are ignored</title>
+  <style type="text/css">
+    .square {
+      position: absolute;
+      background: blue;
+      width: 20px;
+      height: 20px;
+      -webkit-transition-timing-function: linear;
+    }
+
+    .translated {
+      -webkit-transform: translateX(600px);
+    }
+
+    #square1 {
+      top: 20px;
+      left: 0px;
+      -webkit-transition-property: left;
+      -webkit-transition-duration: 2s;
+      -webkit-transition-delay: -1s;
+    }
+
+    #square1.moved {
+      left: 600px;
+    }
+
+    #square2 {
+      top: 60px;
+      left: 0px;
+      -webkit-transition-property: left;
+      -webkit-transition-duration: 2s;
+    }
+
+    #square2.moved {
+      left: 600px;
+    }
+
+    #square3 {
+      top: 100px;
+      left: 0px;
+      -webkit-transition-property: -webkit-transform;
+      -webkit-transition-duration: 2s;
+      -webkit-transition-delay: -1s;
+    }
+
+    #square4 {
+      top: 140px;
+      left: 0px;
+      -webkit-transition-property: -webkit-transform;
+      -webkit-transition-duration: 2s;
+    }
+  </style>
+
+  <script src="transition-test-helpers.js" type="text/javascript" charset="utf-8"></script>
+
+  <script>
+    // The delay of square1 is negative so square1 should be in ahead of square2.
+    const expectedValues = [
+      // [time, element-id, property, expected-value, tolerance]
+      [0, "square1", "left", 300, 15],
+      [0, "square2", "left", 0, 15],
+      [0.5, "square1", "left", 450, 15],
+      [0.5, "square2", "left", 150, 15],
+      [0, "square3", "-webkit-transform.4", 300, 20],
+      [0, "square4", "-webkit-transform.4", 0, 20],
+      [0.5, "square3", "-webkit-transform.4", 450, 20],
+      [0.5, "square4", "-webkit-transform.4", 150, 20],
+    ];
+
+    function setupTest()
+    {
+      document.getElementById('square1').className = 'moved square';
+      document.getElementById('square2').className = 'moved square';
+      document.getElementById('square3').className = 'translated square';
+      document.getElementById('square4').className = 'translated square';
+    }
+  
+    runTransitionTest(expectedValues, setupTest, true);
+  </script>
+</head>
+
+<body>
+
+<div class="square" id="square1"></div>
+<div class="square" id="square2"></div>
+<div class="square" id="square3"></div>
+<div class="square" id="square4"></div>
+
+<div id="result">
+</div>
+
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 84e0a63..595b18f 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,5 +1,21 @@
 2009-12-11  Simon Fraser  <simon.fraser at apple.com>
 
+        Reviewed by Darin Adler.
+
+        Negative values for animation-delay are ignored (treated as zero)
+        https://bugs.webkit.org/show_bug.cgi?id=26150
+        
+        When we get the m_startTime for an animation or transition, subtract any negative
+        delay so the animation/transition behaves like it started in the past, per spec.
+
+        Tests: animations/negative-delay.html
+               transitions/negative-delay.html
+
+        * page/animation/AnimationBase.cpp:
+        (WebCore::AnimationBase::updateStateMachine):
+
+2009-12-11  Simon Fraser  <simon.fraser at apple.com>
+
         Reviewed by Dan Bernstein.
 
         Accelerated transitions broken when mixed with paused animations
diff --git a/WebCore/page/animation/AnimationBase.cpp b/WebCore/page/animation/AnimationBase.cpp
index 2c74de2..e3bf1d8 100644
--- a/WebCore/page/animation/AnimationBase.cpp
+++ b/WebCore/page/animation/AnimationBase.cpp
@@ -956,7 +956,12 @@ void AnimationBase::updateStateMachine(AnimStateInput input, double param)
                 updateStateMachine(AnimationStateInputStartTimeSet, beginAnimationUpdateTime());
             }
             else {
-                bool started = startAnimation(0);
+                double timeOffset = 0;
+                // If the value for 'animation-delay' is negative then the animation appears to have started in the past.
+                if (m_animation->delay() < 0)
+                    timeOffset = -m_animation->delay();
+                bool started = startAnimation(timeOffset);
+
                 m_compAnim->animationController()->addToStartTimeResponseWaitList(this, started);
                 m_fallbackAnimating = !started;
             }
@@ -967,8 +972,12 @@ void AnimationBase::updateStateMachine(AnimStateInput input, double param)
             if (input == AnimationStateInputStartTimeSet) {
                 ASSERT(param >= 0);
                 // We have a start time, set it, unless the startTime is already set
-                if (m_startTime <= 0)
+                if (m_startTime <= 0) {
                     m_startTime = param;
+                    // If the value for 'animation-delay' is negative then the animation appears to have started in the past.
+                    if (m_animation->delay() < 0)
+                        m_startTime += m_animation->delay();
+                }
 
                 // Decide whether to go into looping or ending state
                 goIntoEndingOrLoopingState();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list