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

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

Issue 1512483004: Simplify and test SVGInterpolation effect application (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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/core.gypi ('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 d545acb3ae5e94ea5a436c517a5672d75faff998..dfa808348e6ad22892745261b743dc3d51945bc8 100644
--- a/third_party/WebKit/Source/core/svg/SVGElement.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGElement.cpp
@@ -243,25 +243,15 @@ void SVGElement::setWebAnimationsPending()
document().accessSVGExtensions().addWebAnimationsPendingSVGElement(*this);
}
-template<typename T>
-static void updateInstancesAnimatedAttribute(SVGElement* element, const QualifiedName& attribute, T callback)
-{
- SVGElement::InstanceUpdateBlocker blocker(element);
fs 2015/12/09 12:19:08 So, the "benefit" of the scheme you're removing ca
alancutter (OOO until 2018) 2015/12/09 22:14:11 Ah so it's an optimisation, that makes sense why i
- for (SVGElement* instance : SVGAnimateElement::findElementInstances(element)) {
- RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> animatedProperty = instance->propertyFromAttribute(attribute);
- if (animatedProperty) {
- callback(*animatedProperty);
- instance->invalidateSVGAttributes();
- instance->svgAttributeChanged(attribute);
- }
- }
-}
-
void SVGElement::setWebAnimatedAttribute(const QualifiedName& attribute, PassRefPtrWillBeRawPtr<SVGPropertyBase> value)
{
- updateInstancesAnimatedAttribute(this, attribute, [&value](SVGAnimatedPropertyBase& animatedProperty) {
- animatedProperty.setAnimatedValue(value.get());
- });
+ RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> animatedProperty = propertyFromAttribute(attribute);
+ if (!animatedProperty)
+ return;
+
+ animatedProperty->setAnimatedValue(value.get());
+ invalidateSVGAttributes();
+ svgAttributeChanged(attribute);
ensureSVGRareData()->webAnimatedAttributes().add(&attribute);
}
@@ -269,11 +259,17 @@ void SVGElement::clearWebAnimatedAttributes()
{
if (!hasSVGRareData())
return;
+
for (const QualifiedName* attribute : svgRareData()->webAnimatedAttributes()) {
- updateInstancesAnimatedAttribute(this, *attribute, [](SVGAnimatedPropertyBase& animatedProperty) {
- animatedProperty.animationEnded();
- });
+ RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> animatedProperty = propertyFromAttribute(*attribute);
+ if (!animatedProperty)
+ continue;
+
+ animatedProperty->animationEnded();
+ invalidateSVGAttributes();
+ svgAttributeChanged(*attribute);
}
+
svgRareData()->webAnimatedAttributes().clear();
}
« no previous file with comments | « third_party/WebKit/Source/core/core.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698