Title: [118364] trunk/Source
Revision
118364
Author
[email protected]
Date
2012-05-24 07:13:48 -0700 (Thu, 24 May 2012)

Log Message

[chromium] Forcibly sync running animations in the waiting state when synchronized start times are needed.
https://bugs.webkit.org/show_bug.cgi?id=87153

Patch by Ian Vollick <[email protected]> on 2012-05-24
Reviewed by James Robinson.

Source/WebCore:

Unit test: CCLayerAnimationControllerTest.ForceSyncWhenSynchronizedStartTimeNeeded

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

Source/WebKit/chromium:

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (118363 => 118364)


--- trunk/Source/WebCore/ChangeLog	2012-05-24 14:03:46 UTC (rev 118363)
+++ trunk/Source/WebCore/ChangeLog	2012-05-24 14:13:48 UTC (rev 118364)
@@ -1,3 +1,15 @@
+2012-05-24  Ian Vollick  <[email protected]>
+
+        [chromium] Forcibly sync running animations in the waiting state when synchronized start times are needed.
+        https://bugs.webkit.org/show_bug.cgi?id=87153
+
+        Reviewed by James Robinson.
+
+        Unit test: CCLayerAnimationControllerTest.ForceSyncWhenSynchronizedStartTimeNeeded
+
+        * platform/graphics/chromium/cc/CCLayerAnimationController.cpp:
+        (WebCore::CCLayerAnimationController::replaceImplThreadAnimations):
+
 2012-05-24  Ilya Tikhonovsky  <[email protected]>
 
         Web Inspector: convert HeapSnapshotGridNode._provider into getter.

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


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.cpp	2012-05-24 14:03:46 UTC (rev 118363)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.cpp	2012-05-24 14:13:48 UTC (rev 118364)
@@ -451,8 +451,16 @@
 void CCLayerAnimationController::replaceImplThreadAnimations(CCLayerAnimationController* controllerImpl) const
 {
     controllerImpl->m_activeAnimations.clear();
-    for (size_t i = 0; i < m_activeAnimations.size(); ++i)
-        controllerImpl->add(m_activeAnimations[i]->cloneForImplThread());
+    for (size_t i = 0; i < m_activeAnimations.size(); ++i) {
+        OwnPtr<CCActiveAnimation> toAdd(m_activeAnimations[i]->cloneForImplThread());
+        if (m_activeAnimations[i]->needsSynchronizedStartTime()) {
+            // We haven't received an animation started notification yet, so it
+            // is important that we add it in a 'waiting' and not 'running' state.
+            toAdd->setRunState(CCActiveAnimation::WaitingForTargetAvailability, 0);
+            toAdd->setStartTime(0);
+        }
+        controllerImpl->add(toAdd.release());
+    }
 }
 
 void CCLayerAnimationController::tickAnimations(double monotonicTime)

Modified: trunk/Source/WebKit/chromium/ChangeLog (118363 => 118364)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-05-24 14:03:46 UTC (rev 118363)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-05-24 14:13:48 UTC (rev 118364)
@@ -1,3 +1,14 @@
+2012-05-24  Ian Vollick  <[email protected]>
+
+        [chromium] Forcibly sync running animations in the waiting state when synchronized start times are needed.
+        https://bugs.webkit.org/show_bug.cgi?id=87153
+
+        Reviewed by James Robinson.
+
+        * tests/CCLayerAnimationControllerTest.cpp:
+        (WebKitTests::TEST):
+        (WebKitTests):
+
 2012-05-23  Yury Semikhatsky  <[email protected]>
 
         Web Inspector: add a command to InspectorMemoryAgent for getting process memory break down

Modified: trunk/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp (118363 => 118364)


--- trunk/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp	2012-05-24 14:03:46 UTC (rev 118363)
+++ trunk/Source/WebKit/chromium/tests/CCLayerAnimationControllerTest.cpp	2012-05-24 14:13:48 UTC (rev 118364)
@@ -747,4 +747,32 @@
     EXPECT_EQ(0.75, dummy.opacity());
 }
 
+TEST(CCLayerAnimationControllerTest, ForceSyncWhenSynchronizedStartTimeNeeded)
+{
+    FakeLayerAnimationControllerClient dummyImpl;
+    OwnPtr<CCLayerAnimationController> controllerImpl(CCLayerAnimationController::create(&dummyImpl));
+    OwnPtr<CCAnimationEventsVector> events(adoptPtr(new CCAnimationEventsVector));
+    FakeLayerAnimationControllerClient dummy;
+    OwnPtr<CCLayerAnimationController> controller(
+        CCLayerAnimationController::create(&dummy));
+
+    OwnPtr<CCActiveAnimation> toAdd(createActiveAnimation(adoptPtr(new FakeFloatTransition(2, 0, 1)), 0, CCActiveAnimation::Opacity));
+    toAdd->setNeedsSynchronizedStartTime(true);
+    controller->add(toAdd.release());
+
+    controller->animate(0, 0);
+    EXPECT_TRUE(controller->hasActiveAnimation());
+    CCActiveAnimation* activeAnimation = controller->getActiveAnimation(0, CCActiveAnimation::Opacity);
+    EXPECT_TRUE(activeAnimation);
+    EXPECT_TRUE(activeAnimation->needsSynchronizedStartTime());
+
+    controller->setForceSync();
+
+    controller->pushAnimationUpdatesTo(controllerImpl.get());
+
+    activeAnimation = controllerImpl->getActiveAnimation(0, CCActiveAnimation::Opacity);
+    EXPECT_TRUE(activeAnimation);
+    EXPECT_EQ(CCActiveAnimation::WaitingForTargetAvailability, activeAnimation->runState());
+}
+
 } // namespace
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to