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

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

Issue 2746013007: Rework SMIL animation target invalidation (Closed)
Patch Set: Created 3 years, 9 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 | « third_party/WebKit/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: third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp
diff --git a/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp b/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp
index b9109126a94edb914b79f43b6c148f8897eda7e3..02e3d662659dfa8c27b9f901cfd8be8e860dd3fa 100644
--- a/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp
+++ b/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp
@@ -558,8 +558,6 @@ void SVGSMILElement::svgAttributeChanged(const QualifiedName& attrName) {
// is changed.
SVGElement::InvalidationGuard invalidationGuard(this);
buildPendingResource();
- if (m_targetElement)
- clearAnimatedType();
} else {
SVGElement::svgAttributeChanged(attrName);
return;
@@ -604,13 +602,11 @@ void SVGSMILElement::disconnectEventBaseConditions() {
}
void SVGSMILElement::setTargetElement(SVGElement* target) {
- unscheduleIfScheduled();
+ willChangeAnimationTarget();
- if (m_targetElement) {
- // Clear values that may depend on the previous target.
- clearAnimatedType();
+ // Clear values that may depend on the previous target.
+ if (m_targetElement)
disconnectSyncBaseConditions();
- }
// If the animation state is not Inactive, always reset to a clear state
// before leaving the old target element.
@@ -618,7 +614,7 @@ void SVGSMILElement::setTargetElement(SVGElement* target) {
endedActiveInterval();
m_targetElement = target;
- schedule();
+ didChangeAnimationTarget();
}
SMILTime SVGSMILElement::elapsed() const {
@@ -1250,26 +1246,23 @@ bool SVGSMILElement::hasValidTarget() {
return targetElement() && targetElement()->inActiveDocument();
}
-void SVGSMILElement::schedule() {
- DCHECK(!m_isScheduled);
-
- if (!m_timeContainer || !hasValidTarget())
- return;
-
- m_timeContainer->schedule(this, m_targetElement, m_attributeName);
- m_isScheduled = true;
-}
-
-void SVGSMILElement::unscheduleIfScheduled() {
+void SVGSMILElement::willChangeAnimationTarget() {
if (!m_isScheduled)
return;
-
DCHECK(m_timeContainer);
DCHECK(m_targetElement);
m_timeContainer->unschedule(this, m_targetElement, m_attributeName);
m_isScheduled = false;
}
+void SVGSMILElement::didChangeAnimationTarget() {
+ DCHECK(!m_isScheduled);
+ if (!m_timeContainer || !hasValidTarget())
+ return;
+ m_timeContainer->schedule(this, m_targetElement, m_attributeName);
+ m_isScheduled = true;
+}
+
DEFINE_TRACE(SVGSMILElement) {
visitor->trace(m_targetElement);
visitor->trace(m_targetIdObserver);
« no previous file with comments | « third_party/WebKit/Source/core/svg/animation/SVGSMILElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698