Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / animation / DocumentAnimations.cpp
index 34ea5ca..57770ca 100644 (file)
@@ -46,9 +46,8 @@ namespace WebCore {
 
 namespace {
 
-void updateAnimationTiming(Document& document, double monotonicAnimationStartTime)
+void updateAnimationTiming(Document& document)
 {
-    document.animationClock().updateTime(monotonicAnimationStartTime);
     bool didTriggerStyleRecalc = document.timeline()->serviceAnimations();
     didTriggerStyleRecalc |= document.transitionTimeline()->serviceAnimations();
     if (!didTriggerStyleRecalc)
@@ -71,33 +70,28 @@ void dispatchAnimationEventsAsync(Document& document)
 
 void DocumentAnimations::serviceOnAnimationFrame(Document& document, double monotonicAnimationStartTime)
 {
-    if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled())
-        return;
-
-    updateAnimationTiming(document, monotonicAnimationStartTime);
+    document.animationClock().updateTime(monotonicAnimationStartTime);
+    updateAnimationTiming(document);
     dispatchAnimationEvents(document);
 }
 
 void DocumentAnimations::serviceBeforeGetComputedStyle(Node& node, CSSPropertyID property)
 {
-    if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled())
+    if (!node.isElementNode())
+        return;
+    const Element& element = toElement(node);
+    if (element.document().timeline()->hasPlayerNeedingUpdate()) {
+        updateAnimationTiming(element.document());
         return;
-
-    if (node.isElementNode()) {
-        const Element& element = toElement(node);
-        if (const ActiveAnimations* activeAnimations = element.activeAnimations()) {
-            if (activeAnimations->hasActiveAnimationsOnCompositor(property))
-                updateAnimationTiming(element.document(), monotonicallyIncreasingTime());
-        }
     }
-
+    if (const ActiveAnimations* activeAnimations = element.activeAnimations()) {
+        if (activeAnimations->hasActiveAnimationsOnCompositor(property))
+            updateAnimationTiming(element.document());
+    }
 }
 
 void DocumentAnimations::serviceAfterStyleRecalc(Document& document)
 {
-    if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled())
-        return;
-
     if (document.cssPendingAnimations().startPendingAnimations() && document.view())
         document.view()->scheduleAnimation();