2008-12-10 Pierre-Olivier Latour <pol@apple.com>
authorpol@apple.com <pol@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Dec 2008 18:00:55 +0000 (18:00 +0000)
committerpol@apple.com <pol@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Dec 2008 18:00:55 +0000 (18:00 +0000)
        Reviewed by Darin Adler.

        KeyframeAnimation::animate() needs to compute the elapsed animation time
        properly taking into account its paused state.

        https://bugs.webkit.org/show_bug.cgi?id=22773

        Test: animations/animation-drt-api-multiple-keyframes.html

        * page/animation/KeyframeAnimation.cpp:
        (WebCore::KeyframeAnimation::animate):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@39176 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/animations/animation-drt-api-multiple-keyframes.html [new file with mode: 0644]
LayoutTests/platform/mac/animations/animation-drt-api-multiple-keyframes-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/animations/animation-drt-api-multiple-keyframes-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/animations/animation-drt-api-multiple-keyframes-expected.txt [new file with mode: 0644]
LayoutTests/platform/win/Skipped
WebCore/ChangeLog
WebCore/page/animation/KeyframeAnimation.cpp

index 8e43d6c..f10ba8a 100644 (file)
@@ -1,3 +1,18 @@
+2008-12-10  Pierre-Olivier Latour  <pol@apple.com>
+
+        Reviewed by Darin Adler.
+
+        Added a test to verify that the DRT API pauseAnimationAtTimeOnElementWithId() does work
+        with animations using multiple keyframes.
+
+        https://bugs.webkit.org/show_bug.cgi?id=22773
+
+        * animations/animation-drt-api-multiple-keyframes.html: Added.
+        * platform/mac/animations/animation-drt-api-multiple-keyframes-expected.checksum: Added.
+        * platform/mac/animations/animation-drt-api-multiple-keyframes-expected.png: Added.
+        * platform/mac/animations/animation-drt-api-multiple-keyframes-expected.txt: Added.
+        * platform/win/Skipped:
+
 2008-12-10  Hironori Bono  <hbono@chromium.org>
 
         Reviewed by Alexey Proskuryakov.
diff --git a/LayoutTests/animations/animation-drt-api-multiple-keyframes.html b/LayoutTests/animations/animation-drt-api-multiple-keyframes.html
new file mode 100644 (file)
index 0000000..cc170b6
--- /dev/null
@@ -0,0 +1,47 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+   "http://www.w3.org/TR/html4/loose.dtd">
+
+<html lang="en">
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+  <style>
+    body {
+      margin: 0;
+    }
+    
+    div {
+      position: relative;
+      left: 100px;
+      height: 200px;
+      width: 200px;
+      background-color: red;
+      -webkit-animation-name: anim;
+      -webkit-animation-duration: 5s;
+      -webkit-animation-timing-function: linear;
+    }
+
+    @-webkit-keyframes anim {
+      from { left: 10px; }
+      40% { left: 30px; }
+      60% { left: 15px; }
+      to { left: 20px; }
+    }
+         
+     </style>
+   <script type="text/javascript" charset="utf-8">
+    function startTest() {
+      if (window.layoutTestController) {
+        if (!layoutTestController.pauseAnimationAtTimeOnElementWithId("anim", 3, "box"))
+          throw("Animation is not running");
+      }
+    }
+   </script>
+</head>
+<body onload="startTest()">
+  <h1>Test for DRT pauseAnimationAtTimeOnElementWithId() API on animations with multiple keyframes</h1>
+
+  <div id="box">
+  </div>
+
+</body>
+</html>
diff --git a/LayoutTests/platform/mac/animations/animation-drt-api-multiple-keyframes-expected.checksum b/LayoutTests/platform/mac/animations/animation-drt-api-multiple-keyframes-expected.checksum
new file mode 100644 (file)
index 0000000..3b69f27
--- /dev/null
@@ -0,0 +1 @@
+e04c89890048c38895b300318c022f32
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/animations/animation-drt-api-multiple-keyframes-expected.png b/LayoutTests/platform/mac/animations/animation-drt-api-multiple-keyframes-expected.png
new file mode 100644 (file)
index 0000000..e0831fe
Binary files /dev/null and b/LayoutTests/platform/mac/animations/animation-drt-api-multiple-keyframes-expected.png differ
diff --git a/LayoutTests/platform/mac/animations/animation-drt-api-multiple-keyframes-expected.txt b/LayoutTests/platform/mac/animations/animation-drt-api-multiple-keyframes-expected.txt
new file mode 100644 (file)
index 0000000..f919ed7
--- /dev/null
@@ -0,0 +1,11 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x316
+  RenderBlock {HTML} at (0,0) size 800x316
+    RenderBody {BODY} at (0,21) size 800x295
+      RenderBlock {H1} at (0,0) size 800x74
+        RenderText {#text} at (0,0) size 799x74
+          text run at (0,0) width 799: "Test for DRT pauseAnimationAtTimeOnElementWithId()"
+          text run at (0,37) width 599: "API on animations with multiple keyframes"
+layer at (15,116) size 200x200
+  RenderBlock (relative positioned) {DIV} at (0,95) size 200x200 [bgcolor=#FF0000]
index 8ec1630..d89e097 100644 (file)
@@ -422,6 +422,7 @@ http/tests/xmlhttprequest/upload-onprogress-event.html
 
 # No transition / animation pause LayoutController API on Windows DRT (https://bugs.webkit.org/show_bug.cgi?id=22239)
 animations/animation-drt-api.html
+animations/animation-drt-api-multiple-keyframes.html
 transitions/transition-drt-api.html
 transitions/transition-drt-api-delay.html
 transitions/transition-shorthand-delay.html
index 7baf7cc..97c31d1 100644 (file)
@@ -1,3 +1,17 @@
+2008-12-10  Pierre-Olivier Latour  <pol@apple.com>
+
+        Reviewed by Darin Adler.
+
+        KeyframeAnimation::animate() needs to compute the elapsed animation time
+        properly taking into account its paused state.
+
+        https://bugs.webkit.org/show_bug.cgi?id=22773
+
+        Test: animations/animation-drt-api-multiple-keyframes.html
+
+        * page/animation/KeyframeAnimation.cpp:
+        (WebCore::KeyframeAnimation::animate):
+
 2008-12-10  Simon Fraser  <simon.fraser@apple.com>
 
         Reviewed by Dan Bernstein
index c44731b..9e015d8 100644 (file)
@@ -84,7 +84,7 @@ void KeyframeAnimation::animate(CompositeAnimation* animation, RenderObject* ren
     // We should cache the last pair or something.
 
     // Find the first key
-    double elapsedTime = (m_startTime > 0) ? ((!paused() ? currentTime() : m_pauseTime) - m_startTime) : 0;
+    double elapsedTime = (m_startTime > 0 || m_pauseTime > 0) ? ((!paused() ? currentTime() : m_pauseTime) - m_startTime) : 0;
     if (elapsedTime < 0)
         elapsedTime = 0;