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

Unified Diff: Source/core/svg/animation/SVGSMILElement.cpp

Issue 141013017: Make sure begin and end events are dispatched for back-to-back intervals (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 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/svg/animation/SVGSMILElement.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/animation/SVGSMILElement.cpp
diff --git a/Source/core/svg/animation/SVGSMILElement.cpp b/Source/core/svg/animation/SVGSMILElement.cpp
index 7b2da5bc0d44c065cba85ed74e4c8f81cbb98a44..566c2021ec07d97e704a15db911d54f7978bc302 100644
--- a/Source/core/svg/animation/SVGSMILElement.cpp
+++ b/Source/core/svg/animation/SVGSMILElement.cpp
@@ -1000,18 +1000,18 @@ void SVGSMILElement::endListChanged(SMILTime)
m_timeContainer->notifyIntervalsChanged();
}
-void SVGSMILElement::checkRestart(SMILTime elapsed)
+bool SVGSMILElement::checkRestart(SMILTime elapsed)
pdr. 2014/02/03 23:23:00 Can we clean this up a bit? I'll offer a suggesti
{
ASSERT(!m_isWaitingForFirstInterval);
ASSERT(elapsed >= m_intervalBegin);
Restart restart = this->restart();
if (restart == RestartNever)
- return;
+ return false;
if (elapsed < m_intervalEnd) {
if (restart != RestartAlways)
- return;
+ return false;
SMILTime nextBegin = findInstanceTime(Begin, m_intervalBegin, false);
if (nextBegin < m_intervalEnd) {
m_intervalEnd = nextBegin;
@@ -1020,7 +1020,9 @@ void SVGSMILElement::checkRestart(SMILTime elapsed)
}
if (elapsed >= m_intervalEnd)
- resolveNextInterval();
+ return resolveNextInterval();
+
+ return false;
}
void SVGSMILElement::seekToIntervalCorrespondingToTime(SMILTime elapsed)
@@ -1167,7 +1169,7 @@ bool SVGSMILElement::progress(SMILTime elapsed, SVGSMILElement* resultElement, b
unsigned repeat = 0;
float percent = calculateAnimationPercentAndRepeat(elapsed, repeat);
- checkRestart(elapsed);
+ bool didRestart = checkRestart(elapsed);
ActiveState oldActiveState = m_activeState;
m_activeState = determineActiveState(elapsed);
@@ -1177,8 +1179,10 @@ bool SVGSMILElement::progress(SMILTime elapsed, SVGSMILElement* resultElement, b
if (this == resultElement && animationIsContributing)
resetAnimatedType();
+ ASSERT(!didRestart || m_activeState == Active);
+
if (animationIsContributing) {
- if (oldActiveState == Inactive) {
+ if (oldActiveState == Inactive || didRestart) {
smilBeginEventSender().dispatchEventSoon(this);
startedActiveInterval();
}
@@ -1191,10 +1195,10 @@ bool SVGSMILElement::progress(SMILTime elapsed, SVGSMILElement* resultElement, b
m_lastRepeat = repeat;
}
- if (oldActiveState == Active && m_activeState != Active) {
+ if ((oldActiveState == Active && m_activeState != Active) || didRestart) {
smilEndEventSender().dispatchEventSoon(this);
endedActiveInterval();
- if (m_activeState != Frozen && this == resultElement)
+ if (!didRestart && m_activeState != Frozen && this == resultElement)
clearAnimatedType(m_targetElement);
}
« no previous file with comments | « Source/core/svg/animation/SVGSMILElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698