Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Unified Diff: Source/core/animation/Animation.cpp

Issue 19266007: Web Animations: Introduce ActiveAnimations and AnimationStack (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/animation/Animation.cpp
diff --git a/Source/core/animation/Animation.cpp b/Source/core/animation/Animation.cpp
index e2b5673580889cb6ebb40ec2e57b2aa1bf41e618..53dc71e16610a49d244ae56bd7e03a1fae29a43d 100644
--- a/Source/core/animation/Animation.cpp
+++ b/Source/core/animation/Animation.cpp
@@ -31,6 +31,8 @@
#include "config.h"
#include "core/animation/Animation.h"
+#include "core/animation/DocumentTimeline.h"
+#include "core/animation/Player.h"
#include "core/dom/Element.h"
namespace WebCore {
@@ -44,21 +46,23 @@ Animation::Animation(PassRefPtr<Element> target, PassRefPtr<AnimationEffect> eff
: TimedItem(timing)
, m_target(target)
, m_effect(effect)
- , m_isInTargetActiveAnimationsList(false)
+ , m_activeInAnimationStack(false)
{
}
-Animation::~Animation()
+void Animation::willDetach()
{
- if (m_isInTargetActiveAnimationsList)
- m_target->removeActiveAnimation(this);
+ ASSERT(player());
+ if (m_activeInAnimationStack)
+ player()->timeline()->animationStack().remove(m_target.get(), this);
}
void Animation::applyEffects(bool previouslyActiveOrInEffect)
{
+ ASSERT(player());
if (!previouslyActiveOrInEffect) {
- m_target->addActiveAnimation(this);
- m_isInTargetActiveAnimationsList = true;
+ player()->timeline()->animationStack().add(m_target.get(), this);
+ m_activeInAnimationStack = true;
}
m_compositableValues = m_effect->sample(currentIteration(), timeFraction());
m_target->setNeedsStyleRecalc(LocalStyleChange, StyleChangeFromRenderer);
@@ -66,15 +70,16 @@ void Animation::applyEffects(bool previouslyActiveOrInEffect)
void Animation::clearEffects()
{
- m_target->removeActiveAnimation(this);
- m_isInTargetActiveAnimationsList = false;
+ ASSERT(player());
+ player()->timeline()->animationStack().remove(m_target.get(), this);
+ m_activeInAnimationStack = false;
shans 2013/07/17 06:25:28 reuse willDetach() here? Or add a detach() functio
dstockwell 2013/07/17 13:10:19 Done.
m_compositableValues.clear();
}
void Animation::updateChildrenAndEffects(bool wasActiveOrInEffect) const
{
const bool isActiveOrInEffect = isActive() || isInEffect();
- ASSERT(m_isInTargetActiveAnimationsList == wasActiveOrInEffect);
+ ASSERT(m_activeInAnimationStack == wasActiveOrInEffect);
if (wasActiveOrInEffect && !isActiveOrInEffect)
const_cast<Animation*>(this)->clearEffects();
else if (isActiveOrInEffect)

Powered by Google App Engine
This is Rietveld 408576698