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

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

Issue 22706003: [SVG] Handle beginEvent 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/begin-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 c79205efa8d1ddae12bcac2561ba8e6803b2673a..85bd2a64f8a2a0bbfbb1479b61182ebc3c143bdc 100644
--- a/Source/core/svg/animation/SVGSMILElement.cpp
+++ b/Source/core/svg/animation/SVGSMILElement.cpp
@@ -51,6 +51,12 @@ static SMILEventSender& smilEndEventSender()
return sender;
}
+static SMILEventSender& smilBeginEventSender()
+{
+ DEFINE_STATIC_LOCAL(SMILEventSender, sender, ("beginEvent"));
+ return sender;
+}
+
// This is used for duration type time values that can't be negative.
static const double invalidCachedTime = -1.;
@@ -141,6 +147,7 @@ SVGSMILElement::~SVGSMILElement()
{
clearResourceReferences();
smilEndEventSender().cancelEvent(this);
+ smilBeginEventSender().cancelEvent(this);
disconnectConditions();
if (m_timeContainer && m_targetElement && hasValidAttributeName())
m_timeContainer->unschedule(this, m_targetElement, m_attributeName);
@@ -1106,8 +1113,10 @@ bool SVGSMILElement::progress(SMILTime elapsed, SVGSMILElement* resultElement, b
resetAnimatedType();
if (animationIsContributing) {
- if (oldActiveState == Inactive)
+ if (oldActiveState == Inactive) {
+ smilBeginEventSender().dispatchEventSoon(this);
startedActiveInterval();
+ }
updateAnimation(percent, repeat, resultElement);
m_lastPercent = percent;
@@ -1123,6 +1132,8 @@ bool SVGSMILElement::progress(SMILTime elapsed, SVGSMILElement* resultElement, b
// Triggering all the pending events if the animation timeline is changed.
if (seekToTime) {
+ if (m_activeState == Inactive)
+ smilBeginEventSender().dispatchEventSoon(this);
if (m_activeState == Inactive || m_activeState == Frozen)
smilEndEventSender().dispatchEventSoon(this);
}
@@ -1205,7 +1216,7 @@ void SVGSMILElement::endedActiveInterval()
void SVGSMILElement::dispatchPendingEvent(SMILEventSender* eventSender)
{
- ASSERT(eventSender == &smilEndEventSender());
+ ASSERT(eventSender == &smilEndEventSender() || eventSender == &smilBeginEventSender());
const AtomicString& eventType = eventSender->eventType();
dispatchEvent(Event::create(eventType));
}
« no previous file with comments | « LayoutTests/svg/animations/begin-event-expected.svg ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698