Chromium Code Reviews| 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); |
| } |