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

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: Remove borked ASSERT. Created 6 years, 10 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..20ac8cd39ffdb471d997eb0b5a7583e4c6bd64b5 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)
+SVGSMILElement::RestartedInterval SVGSMILElement::maybeRestartInterval(SMILTime elapsed)
{
ASSERT(!m_isWaitingForFirstInterval);
ASSERT(elapsed >= m_intervalBegin);
Restart restart = this->restart();
if (restart == RestartNever)
- return;
+ return DidNotRestartInterval;
if (elapsed < m_intervalEnd) {
if (restart != RestartAlways)
- return;
+ return DidNotRestartInterval;
SMILTime nextBegin = findInstanceTime(Begin, m_intervalBegin, false);
if (nextBegin < m_intervalEnd) {
m_intervalEnd = nextBegin;
@@ -1019,8 +1019,11 @@ void SVGSMILElement::checkRestart(SMILTime elapsed)
}
}
- if (elapsed >= m_intervalEnd)
- resolveNextInterval();
+ if (elapsed >= m_intervalEnd) {
+ if (resolveNextInterval())
+ return DidRestartInterval;
+ }
+ return DidNotRestartInterval;
}
void SVGSMILElement::seekToIntervalCorrespondingToTime(SMILTime elapsed)
@@ -1167,7 +1170,7 @@ bool SVGSMILElement::progress(SMILTime elapsed, SVGSMILElement* resultElement, b
unsigned repeat = 0;
float percent = calculateAnimationPercentAndRepeat(elapsed, repeat);
- checkRestart(elapsed);
+ RestartedInterval restartedInterval = maybeRestartInterval(elapsed);
ActiveState oldActiveState = m_activeState;
m_activeState = determineActiveState(elapsed);
@@ -1178,7 +1181,7 @@ bool SVGSMILElement::progress(SMILTime elapsed, SVGSMILElement* resultElement, b
resetAnimatedType();
if (animationIsContributing) {
- if (oldActiveState == Inactive) {
+ if (oldActiveState == Inactive || restartedInterval == DidRestartInterval) {
smilBeginEventSender().dispatchEventSoon(this);
startedActiveInterval();
}
@@ -1191,10 +1194,10 @@ bool SVGSMILElement::progress(SMILTime elapsed, SVGSMILElement* resultElement, b
m_lastRepeat = repeat;
}
- if (oldActiveState == Active && m_activeState != Active) {
+ if ((oldActiveState == Active && m_activeState != Active) || restartedInterval == DidRestartInterval) {
smilEndEventSender().dispatchEventSoon(this);
endedActiveInterval();
- if (m_activeState != Frozen && this == resultElement)
+ if (restartedInterval == DidNotRestartInterval && 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