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

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

Issue 23621018: [SVG] Handle repeatEvent for svg animations (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 4 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 | « LayoutTests/svg/animations/repeat-event-expected.svg ('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 0a2596505d2ee7205a6ae00cd0068455fa2488dd..8d5347cff2b4dfccc706fa5d7db72cd276fbb6d6 100644
--- a/Source/core/svg/animation/SVGSMILElement.cpp
+++ b/Source/core/svg/animation/SVGSMILElement.cpp
@@ -57,6 +57,12 @@ static SMILEventSender& smilBeginEventSender()
return sender;
}
+static SMILEventSender& smilRepeatEventSender()
+{
+ DEFINE_STATIC_LOCAL(SMILEventSender, sender, ("repeatEvent"));
+ return sender;
+}
+
// This is used for duration type time values that can't be negative.
static const double invalidCachedTime = -1.;
@@ -148,6 +154,7 @@ SVGSMILElement::~SVGSMILElement()
clearResourceReferences();
smilEndEventSender().cancelEvent(this);
smilBeginEventSender().cancelEvent(this);
+ smilRepeatEventSender().cancelEvent(this);
disconnectConditions();
if (m_timeContainer && m_targetElement && hasValidAttributeName())
m_timeContainer->unschedule(this, m_targetElement, m_attributeName);
@@ -1117,6 +1124,9 @@ bool SVGSMILElement::progress(SMILTime elapsed, SVGSMILElement* resultElement, b
startedActiveInterval();
}
+ if (repeat && repeat != m_lastRepeat)
+ smilRepeatEventSender().dispatchEventSoon(this);
+
updateAnimation(percent, repeat, resultElement);
m_lastPercent = percent;
m_lastRepeat = repeat;
@@ -1133,6 +1143,15 @@ bool SVGSMILElement::progress(SMILTime elapsed, SVGSMILElement* resultElement, b
if (seekToTime) {
if (m_activeState == Inactive)
smilBeginEventSender().dispatchEventSoon(this);
+
+ if (repeat) {
+ for (unsigned repeatEventCount = 1; repeatEventCount < repeat; repeatEventCount++) {
+ smilRepeatEventSender().dispatchEventSoon(this);
+ }
+ if (m_activeState == Inactive)
+ smilRepeatEventSender().dispatchEventSoon(this);
+ }
+
if (m_activeState == Inactive || m_activeState == Frozen)
smilEndEventSender().dispatchEventSoon(this);
}
@@ -1215,7 +1234,7 @@ void SVGSMILElement::endedActiveInterval()
void SVGSMILElement::dispatchPendingEvent(SMILEventSender* eventSender)
{
- ASSERT(eventSender == &smilEndEventSender() || eventSender == &smilBeginEventSender());
+ ASSERT(eventSender == &smilEndEventSender() || eventSender == &smilBeginEventSender() || eventSender == &smilRepeatEventSender());
const AtomicString& eventType = eventSender->eventType();
dispatchEvent(Event::create(eventType));
}
« no previous file with comments | « LayoutTests/svg/animations/repeat-event-expected.svg ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698