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

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

Issue 28263002: Plumb timeToNextEffect through players and animation (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Moved location of timeToEffectChange calculation Created 7 years, 2 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 d48b39a4f93c5485996b26583786688c2f833723..802c4543282e4aaadcc1de29331de78537e78546 100644
--- a/Source/core/animation/Animation.cpp
+++ b/Source/core/animation/Animation.cpp
@@ -64,10 +64,14 @@ static AnimationStack* ensureAnimationStack(Element* element)
void Animation::applyEffects(bool previouslyInEffect)
{
ASSERT(player());
+ if (!m_target || !m_effect)
+ return;
+
if (!previouslyInEffect) {
ensureAnimationStack(m_target.get())->add(this);
m_activeInAnimationStack = true;
}
+
m_compositableValues = m_effect->sample(currentIteration(), timeFraction());
m_target->setNeedsStyleRecalc(LocalStyleChange, StyleChangeFromRenderer);
}
@@ -84,6 +88,9 @@ void Animation::clearEffects()
void Animation::updateChildrenAndEffects(bool wasInEffect) const
{
+ if (!m_effect)
+ return;
+
ASSERT(m_activeInAnimationStack == wasInEffect);
if (isInEffect())
const_cast<Animation*>(this)->applyEffects(wasInEffect);
@@ -91,4 +98,23 @@ void Animation::updateChildrenAndEffects(bool wasInEffect) const
const_cast<Animation*>(this)->clearEffects();
}
+double Animation::calculateTimeToEffectChange(double inheritedTime, double activeTime, Phase phase) const
+{
+ switch (phase) {
+ case PhaseBefore:
+ return activeTime - inheritedTime;
+ case PhaseActive:
+ return 0;
+ case PhaseAfter:
+ // If this Animation is still in effect then it will need to update
+ // when its parent goes out of effect. We have no way of knowing when
+ // that will be, however, so the parent will need to supply it.
+ return std::numeric_limits<double>::infinity();
+ case PhaseNone:
+ default:
+ ASSERT_NOT_REACHED();
+ return 0;
+ }
+}
+
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698