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

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

Issue 21156005: Web Animations: Add an event delegate to allow different forms of event dispatch (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address review feedback. 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
« no previous file with comments | « Source/core/animation/TimedItem.h ('k') | Source/core/animation/TimedItemTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/TimedItem.cpp
diff --git a/Source/core/animation/TimedItem.cpp b/Source/core/animation/TimedItem.cpp
index 98121b81e402da60819205a68747b8f112a1c729..852123f50452e1ee78ce507e431a36986c302e90 100644
--- a/Source/core/animation/TimedItem.cpp
+++ b/Source/core/animation/TimedItem.cpp
@@ -34,12 +34,13 @@
namespace WebCore {
-TimedItem::TimedItem(const Timing& timing)
+TimedItem::TimedItem(const Timing& timing, PassOwnPtr<TimedItemEventDelegate> eventDelegate)
: m_parent(0)
, m_player(0)
, m_startTime(0)
, m_specified(timing)
, m_calculated()
+ , m_eventDelegate(eventDelegate)
{
timing.assertValid();
}
@@ -86,15 +87,20 @@ void TimedItem::updateInheritedTime(double inheritedTime) const
timeFraction = calculateTransformedTime(currentIteration, iterationDuration, iterationTime, m_specified);
}
+ const double lastIteration = m_calculated.currentIteration;
m_calculated.currentIteration = currentIteration;
m_calculated.activeDuration = activeDuration;
m_calculated.timeFraction = timeFraction;
- const bool wasInEffect = isInEffect();
+ const bool wasInEffect = m_calculated.isInEffect;
+ const bool wasInPlay = m_calculated.isInPlay;
m_calculated.isInEffect = !isNull(activeTime);
m_calculated.isInPlay = phase == PhaseActive && (!m_parent || m_parent->isInPlay());
m_calculated.isCurrent = phase == PhaseBefore || isInPlay() || (m_parent && m_parent->isCurrent());
+ if (m_eventDelegate && (isInPlay() != wasInPlay || (isInPlay() && lastIteration != currentIteration)))
+ m_eventDelegate->onEventCondition(wasInPlay, isInPlay(), lastIteration, currentIteration);
+
// FIXME: This probably shouldn't be recursive.
updateChildrenAndEffects(wasInEffect);
}
« no previous file with comments | « Source/core/animation/TimedItem.h ('k') | Source/core/animation/TimedItemTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698