AnimationBase asserts if a test tries to pause during the delay phase
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Jul 2011 16:16:17 +0000 (16:16 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Jul 2011 16:16:17 +0000 (16:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=59475

Patch by Young Han Lee <joybro@company100.net> on 2011-07-18
Reviewed by Simon Fraser.

There is no more assertion failure after r90765, but the testcase still fails due to
the miscalculation of the pauseTime. This patch pauses the animation at its startTime
if a test tries to pause it during the delay phase.

Source/WebCore:

Test: transitions/transition-in-delay-phase.html

* page/animation/AnimationBase.cpp:
(WebCore::AnimationBase::freezeAtTime):

LayoutTests:

* transitions/transition-in-delay-phase-expected.txt: Added.
* transitions/transition-in-delay-phase.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/transitions/transition-in-delay-phase-expected.txt [new file with mode: 0644]
LayoutTests/transitions/transition-in-delay-phase.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/page/animation/AnimationBase.cpp

index 2a08291..4e292ae 100644 (file)
@@ -1,3 +1,17 @@
+2011-07-18  Young Han Lee  <joybro@company100.net>
+
+        AnimationBase asserts if a test tries to pause during the delay phase
+        https://bugs.webkit.org/show_bug.cgi?id=59475
+
+        Reviewed by Simon Fraser.
+
+        There is no more assertion failure after r90765, but the testcase still fails due to
+        the miscalculation of the pauseTime. This patch pauses the animation at its startTime
+        if a test tries to pause it during the delay phase.
+
+        * transitions/transition-in-delay-phase-expected.txt: Added.
+        * transitions/transition-in-delay-phase.html: Added.
+
 2011-07-18  Stephen White  <senorblanco@chromium.org>
 
         Unreviewed; updated chromium test expectations.
diff --git a/LayoutTests/transitions/transition-in-delay-phase-expected.txt b/LayoutTests/transitions/transition-in-delay-phase-expected.txt
new file mode 100644 (file)
index 0000000..233d1c5
--- /dev/null
@@ -0,0 +1,6 @@
+Test for transition in delay phase
+
+This test works only in DumpRenderTree. It uses an API exposed only there to jump to a particular time in a running transition. Tests bug 59475
+
+PASS - "left" property for "target" element at 0.5s saw something close to: 100
+
diff --git a/LayoutTests/transitions/transition-in-delay-phase.html b/LayoutTests/transitions/transition-in-delay-phase.html
new file mode 100644 (file)
index 0000000..da3d3b7
--- /dev/null
@@ -0,0 +1,44 @@
+<html>
+<head>
+  <style>
+    div {
+      position: relative;
+      left: 100px;
+      height: 50px;
+      width: 50px;
+      background-color: green;
+      -webkit-transition: left 4s linear 1s;
+    }
+    
+    .moved {
+      left: 200px;
+    }
+   </style>
+   <script src="resources/transition-test-helpers.js"></script>
+   <script>
+     const expectedValues = [
+       // [time, element-id, property, expected-value, tolerance]
+       [0.5, "target", "left", 100, 4],
+     ];
+
+     function setupTest()
+     {
+       document.getElementById("target").className = "moved";
+     }
+
+     runTransitionTest(expectedValues, setupTest, usePauseAPI);
+   </script>
+</head>
+<body>
+  <h1>Test for transition in delay phase</h1>
+
+  <p>This test works only in DumpRenderTree. It uses an API exposed
+    only there to jump to a particular time in a running transition.
+    Tests bug <a href="https://bugs.webkit.org/show_bug.cgi?id=59475">59475</a>
+  </p>
+
+  <div id="target"></div>
+  <div id="result"></div>
+
+</body>
+</html>
index b720547..79a98d9 100644 (file)
@@ -1,3 +1,19 @@
+2011-07-18  Young Han Lee  <joybro@company100.net>
+
+        AnimationBase asserts if a test tries to pause during the delay phase
+        https://bugs.webkit.org/show_bug.cgi?id=59475
+
+        Reviewed by Simon Fraser.
+
+        There is no more assertion failure after r90765, but the testcase still fails due to
+        the miscalculation of the pauseTime. This patch pauses the animation at its startTime
+        if a test tries to pause it during the delay phase.
+
+        Test: transitions/transition-in-delay-phase.html
+
+        * page/animation/AnimationBase.cpp:
+        (WebCore::AnimationBase::freezeAtTime):
+
 2011-07-18  Vsevolod Vlasov  <vsevik@chromium.org>
 
         Web Inspector: Web Inspector: provide unique identifiers for loaders
index 3b7302b..8c42120 100644 (file)
@@ -1449,7 +1449,10 @@ void AnimationBase::freezeAtTime(double t)
     }
 
     ASSERT(m_startTime);        // if m_startTime is zero, we haven't started yet, so we'll get a bad pause time.
-    m_pauseTime = m_startTime + t - m_animation->delay();
+    if (t <= m_animation->delay())
+        m_pauseTime = m_startTime;
+    else
+        m_pauseTime = m_startTime + t - m_animation->delay();
 
 #if USE(ACCELERATED_COMPOSITING)
     if (m_object && m_object->hasLayer()) {