Upstream version 7.35.139.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / animation / css / CSSPendingAnimations.cpp
index 86fcff5..2156055 100644 (file)
@@ -34,6 +34,7 @@
 #include "core/animation/Animation.h"
 #include "core/animation/DocumentTimeline.h"
 #include "core/frame/FrameView.h"
+#include "core/page/Page.h"
 #include "core/rendering/RenderLayer.h"
 
 namespace WebCore {
@@ -41,6 +42,14 @@ namespace WebCore {
 void CSSPendingAnimations::add(AnimationPlayer* player)
 {
     ASSERT(player->source()->isAnimation());
+
+    Page* page = player->timeline()->document()->page();
+    bool visible = page && page->visibilityState() == PageVisibilityStateVisible;
+    if (!player->hasStartTime() && !visible) {
+        player->setStartTime(player->timeline()->currentTime());
+        return;
+    }
+
     m_pending.append(player);
 }