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

Unified Diff: third_party/WebKit/Source/core/svg/SVGElement.cpp

Issue 2272033002: Refactor SMIL animation value updates (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@smil-css-prop-update
Patch Set: Created 4 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 | « third_party/WebKit/Source/core/svg/SVGElement.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/SVGElement.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGElement.cpp b/third_party/WebKit/Source/core/svg/SVGElement.cpp
index 919c6f352068503cd175c26ecce75b7c31f85797..064c28daa9c79506d8e9949b4059f934c2194f3f 100644
--- a/third_party/WebKit/Source/core/svg/SVGElement.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGElement.cpp
@@ -238,6 +238,16 @@ void SVGElement::applyActiveWebAnimations()
}
template<typename T>
+static void updateInstancesAnimatedAttributeNoInvalidate(SVGElement* element, const QualifiedName& attribute, T callback)
+{
+ SVGElement::InstanceUpdateBlocker blocker(element);
+ for (SVGElement* instance : SVGAnimateElement::findElementInstances(element)) {
+ if (SVGAnimatedPropertyBase* animatedProperty = instance->propertyFromAttribute(attribute))
+ callback(*animatedProperty);
+ }
+}
+
+template<typename T>
static void updateInstancesAnimatedAttribute(SVGElement* element, const QualifiedName& attribute, T callback)
{
SVGElement::InstanceUpdateBlocker blocker(element);
@@ -270,6 +280,20 @@ void SVGElement::clearWebAnimatedAttributes()
svgRareData()->webAnimatedAttributes().clear();
}
+void SVGElement::setAnimatedAttribute(const QualifiedName& attribute, SVGPropertyBase* value)
+{
+ updateInstancesAnimatedAttributeNoInvalidate(this, attribute, [&value](SVGAnimatedPropertyBase& animatedProperty) {
+ animatedProperty.setAnimatedValue(value);
+ });
+}
+
+void SVGElement::clearAnimatedAttribute(const QualifiedName& attribute)
+{
+ updateInstancesAnimatedAttributeNoInvalidate(this, attribute, [](SVGAnimatedPropertyBase& animatedProperty) {
+ animatedProperty.animationEnded();
+ });
+}
+
AffineTransform SVGElement::localCoordinateSpaceTransform(CTMScope) const
{
// To be overriden by SVGGraphicsElement (or as special case SVGTextElement and SVGPatternElement)
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698