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

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

Issue 2270363004: Simplify SMIL animation CSS property updates (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Silly stuff happen to good people (too) 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 | « no previous file | 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/SVGAnimateElement.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGAnimateElement.cpp b/third_party/WebKit/Source/core/svg/SVGAnimateElement.cpp
index 76d626078b885dae5764ff35add2ae70180ed848..31195dc870d7e0b5e4c603bfdd11f95bd3a30823 100644
--- a/third_party/WebKit/Source/core/svg/SVGAnimateElement.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGAnimateElement.cpp
@@ -208,21 +208,6 @@ void SVGAnimateElement::resetAnimatedType()
m_animatedProperty = m_animator.constructFromString(baseValue);
}
-static inline void applyCSSPropertyToTarget(SVGElement* targetElement, CSSPropertyID id, const String& value)
-{
- MutableStylePropertySet* propertySet = targetElement->ensureAnimatedSMILStyleProperties();
- if (!propertySet->setProperty(id, value, false, 0))
- return;
-
- targetElement->setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::Animation));
-}
-
-static inline void removeCSSPropertyFromTarget(SVGElement* targetElement, CSSPropertyID id)
-{
- targetElement->ensureAnimatedSMILStyleProperties()->removeProperty(id);
- targetElement->setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::Animation));
-}
-
static inline void applyCSSPropertyToTargetAndInstances(SVGElement* targetElement, const QualifiedName& attributeName, const String& valueAsString)
{
ASSERT(targetElement);
@@ -230,16 +215,11 @@ static inline void applyCSSPropertyToTargetAndInstances(SVGElement* targetElemen
return;
CSSPropertyID id = cssPropertyID(attributeName.localName());
+ MutableStylePropertySet* propertySet = targetElement->ensureAnimatedSMILStyleProperties();
+ if (!propertySet->setProperty(id, valueAsString, false, 0))
+ return;
- SVGElement::InstanceUpdateBlocker blocker(targetElement);
- applyCSSPropertyToTarget(targetElement, id, valueAsString);
-
- // If the target element has instances, update them as well, w/o requiring the <use> tree to be rebuilt.
- const HeapHashSet<WeakMember<SVGElement>>& instances = targetElement->instancesForElement();
- for (SVGElement* shadowTreeElement : instances) {
- if (shadowTreeElement)
- applyCSSPropertyToTarget(shadowTreeElement, id, valueAsString);
- }
+ targetElement->setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::Animation));
}
static inline void removeCSSPropertyFromTargetAndInstances(SVGElement* targetElement, const QualifiedName& attributeName)
@@ -249,16 +229,8 @@ static inline void removeCSSPropertyFromTargetAndInstances(SVGElement* targetEle
return;
CSSPropertyID id = cssPropertyID(attributeName.localName());
-
- SVGElement::InstanceUpdateBlocker blocker(targetElement);
- removeCSSPropertyFromTarget(targetElement, id);
-
- // If the target element has instances, update them as well, w/o requiring the <use> tree to be rebuilt.
- const HeapHashSet<WeakMember<SVGElement>>& instances = targetElement->instancesForElement();
- for (SVGElement* shadowTreeElement : instances) {
- if (shadowTreeElement)
- removeCSSPropertyFromTarget(shadowTreeElement, id);
- }
+ targetElement->ensureAnimatedSMILStyleProperties()->removeProperty(id);
+ targetElement->setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::Animation));
}
static inline void notifyTargetAboutAnimValChange(SVGElement* targetElement, const QualifiedName& attributeName)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698