Title: [115202] trunk/Source
Revision
115202
Author
commit-qu...@webkit.org
Date
2012-04-25 07:16:29 -0700 (Wed, 25 Apr 2012)

Log Message

[chromium] Animations waiting for a synchronized start time should never be marked finished.
https://bugs.webkit.org/show_bug.cgi?id=84519

Patch by Ian Vollick <voll...@chromium.org> on 2012-04-25
Reviewed by James Robinson.

Source/WebCore:

Tested in CCLayerAnimationControllerTest.AnimationsWaitingForStartTimeDoNotFinishIfTheyWaitLongerToStartThanTheirDuration

* platform/graphics/chromium/cc/CCLayerAnimationController.cpp:
(WebCore::CCLayerAnimationController::tickAnimations):

Source/WebKit/chromium:

* tests/CCLayerAnimationControllerTest.cpp:
(WebKitTests::TEST):
(WebKitTests):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (115201 => 115202)


--- trunk/Source/WebCore/ChangeLog	2012-04-25 14:04:52 UTC (rev 115201)
+++ trunk/Source/WebCore/ChangeLog	2012-04-25 14:16:29 UTC (rev 115202)
@@ -1,3 +1,15 @@
+2012-04-25  Ian Vollick  <voll...@chromium.org>
+
+        [chromium] Animations waiting for a synchronized start time should never be marked finished.
+        https://bugs.webkit.org/show_bug.cgi?id=84519
+
+        Reviewed by James Robinson.
+
+        Tested in CCLayerAnimationControllerTest.AnimationsWaitingForStartTimeDoNotFinishIfTheyWaitLongerToStartThanTheirDuration
+
+        * platform/graphics/chromium/cc/CCLayerAnimationController.cpp:
+        (WebCore::CCLayerAnimationController::tickAnimations):
+
 2012-04-25  Pierre Rossi  <pierre.ro...@gmail.com>
 
         [SVG] Nothing should be stroked when the stroke-width is 0

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.cpp (115201 => 115202)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.cpp	2012-04-25 14:04:52 UTC (rev 115201)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.cpp	2012-04-25 14:16:29 UTC (rev 115202)
@@ -410,7 +410,7 @@
             case CCActiveAnimation::Transform: {
                 const CCTransformAnimationCurve* transformAnimationCurve = m_activeAnimations[i]->curve()->toTransformAnimationCurve();
                 const TransformationMatrix matrix = transformAnimationCurve->getValue(trimmed, m_client->bounds());
-                if (m_activeAnimations[i]->isFinishedAt(monotonicTime))
+                if (m_activeAnimations[i]->isFinishedAt(monotonicTime) && !m_activeAnimations[i]->needsSynchronizedStartTime())
                     m_activeAnimations[i]->setRunState(CCActiveAnimation::Finished, monotonicTime);
 
                 m_client->setTransformFromAnimation(matrix);
@@ -420,7 +420,7 @@
             case CCActiveAnimation::Opacity: {
                 const CCFloatAnimationCurve* floatAnimationCurve = m_activeAnimations[i]->curve()->toFloatAnimationCurve();
                 const float opacity = floatAnimationCurve->getValue(trimmed);
-                if (m_activeAnimations[i]->isFinishedAt(monotonicTime))
+                if (m_activeAnimations[i]->isFinishedAt(monotonicTime) && !m_activeAnimations[i]->needsSynchronizedStartTime())
                     m_activeAnimations[i]->setRunState(CCActiveAnimation::Finished, monotonicTime);
 
                 m_client->setOpacityFromAnimation(opacity);

Modified: trunk/Source/WebKit/chromium/ChangeLog (115201 => 115202)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-04-25 14:04:52 UTC (rev 115201)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-04-25 14:16:29 UTC (rev 115202)
@@ -1,3 +1,14 @@
+2012-04-25  Ian Vollick  <voll...@chromium.org>
+
+        [chromium] Animations waiting for a synchronized start time should never be marked finished.
+        https://bugs.webkit.org/show_bug.cgi?id=84519
+
+        Reviewed by James Robinson.
+
+        * tests/CCLayerAnimationControllerTest.cpp:
+        (WebKitTests::TEST):
+        (WebKitTests):
+
 2012-04-25  Gavin Peters  <gav...@chromium.org>
 
         Move WebReferrerPolicy.h from WebKit to Platform

Modified: trunk/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp (115201 => 115202)


--- trunk/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp	2012-04-25 14:04:52 UTC (rev 115201)
+++ trunk/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp	2012-04-25 14:16:29 UTC (rev 115202)
@@ -217,6 +217,36 @@
     EXPECT_FALSE(controller->hasActiveAnimation());
 }
 
+// Tests animations that are waiting for a synchronized start time do not finish.
+TEST(CCLayerAnimationControllerTest, AnimationsWaitingForStartTimeDoNotFinishIfTheyWaitLongerToStartThanTheirDuration)
+{
+    OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector));
+    FakeLayerAnimationControllerClient dummy;
+    OwnPtr<CCLayerAnimationController> controller(
+        CCLayerAnimationController::create(&dummy));
+
+    OwnPtr<CCActiveAnimation> toAdd(createActiveAnimation(adoptPtr(new FakeFloatTransition(1, 0, 1)), 1, CCActiveAnimation::Opacity));
+    toAdd->setNeedsSynchronizedStartTime(true);
+
+    // We should pause at the first keyframe indefinitely waiting for that animation to start.
+    controller->add(toAdd.release());
+    controller->animate(0, events.get());
+    EXPECT_TRUE(controller->hasActiveAnimation());
+    EXPECT_EQ(0, dummy.opacity());
+    controller->animate(1, events.get());
+    EXPECT_TRUE(controller->hasActiveAnimation());
+    EXPECT_EQ(0, dummy.opacity());
+    controller->animate(2, events.get());
+    EXPECT_TRUE(controller->hasActiveAnimation());
+    EXPECT_EQ(0, dummy.opacity());
+
+    // Send the synchronized start time.
+    controller->notifyAnimationStarted(CCAnimationStartedEvent(0, 1, CCActiveAnimation::Opacity, 2));
+    controller->animate(5, events.get());
+    EXPECT_EQ(1, dummy.opacity());
+    EXPECT_FALSE(controller->hasActiveAnimation());
+}
+
 // Tests that two queued animations affecting the same property run in sequence.
 TEST(CCLayerAnimationControllerTest, TrivialQueuing)
 {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to