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

Side by Side 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, 3 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGElement.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org> 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org>
3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
4 * Copyright (C) 2008 Apple Inc. All rights reserved. 4 * Copyright (C) 2008 Apple Inc. All rights reserved.
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> 6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 &elementAnimations()->animationStack(), nullptr, nullptr, KeyframeEffect ::DefaultPriority, isSVGAttributeHandle); 231 &elementAnimations()->animationStack(), nullptr, nullptr, KeyframeEffect ::DefaultPriority, isSVGAttributeHandle);
232 for (auto& entry : activeInterpolationsMap) { 232 for (auto& entry : activeInterpolationsMap) {
233 const QualifiedName& attribute = entry.key.svgAttribute(); 233 const QualifiedName& attribute = entry.key.svgAttribute();
234 InterpolationEnvironment environment(*this, propertyFromAttribute(attrib ute)->baseValueBase()); 234 InterpolationEnvironment environment(*this, propertyFromAttribute(attrib ute)->baseValueBase());
235 InvalidatableInterpolation::applyStack(entry.value, environment); 235 InvalidatableInterpolation::applyStack(entry.value, environment);
236 } 236 }
237 svgRareData()->setWebAnimatedAttributesDirty(false); 237 svgRareData()->setWebAnimatedAttributesDirty(false);
238 } 238 }
239 239
240 template<typename T> 240 template<typename T>
241 static void updateInstancesAnimatedAttributeNoInvalidate(SVGElement* element, co nst QualifiedName& attribute, T callback)
242 {
243 SVGElement::InstanceUpdateBlocker blocker(element);
244 for (SVGElement* instance : SVGAnimateElement::findElementInstances(element) ) {
245 if (SVGAnimatedPropertyBase* animatedProperty = instance->propertyFromAt tribute(attribute))
246 callback(*animatedProperty);
247 }
248 }
249
250 template<typename T>
241 static void updateInstancesAnimatedAttribute(SVGElement* element, const Qualifie dName& attribute, T callback) 251 static void updateInstancesAnimatedAttribute(SVGElement* element, const Qualifie dName& attribute, T callback)
242 { 252 {
243 SVGElement::InstanceUpdateBlocker blocker(element); 253 SVGElement::InstanceUpdateBlocker blocker(element);
244 for (SVGElement* instance : SVGAnimateElement::findElementInstances(element) ) { 254 for (SVGElement* instance : SVGAnimateElement::findElementInstances(element) ) {
245 if (SVGAnimatedPropertyBase* animatedProperty = instance->propertyFromAt tribute(attribute)) { 255 if (SVGAnimatedPropertyBase* animatedProperty = instance->propertyFromAt tribute(attribute)) {
246 callback(*animatedProperty); 256 callback(*animatedProperty);
247 instance->invalidateSVGAttributes(); 257 instance->invalidateSVGAttributes();
248 instance->svgAttributeChanged(attribute); 258 instance->svgAttributeChanged(attribute);
249 } 259 }
250 } 260 }
(...skipping 12 matching lines...) Expand all
263 if (!hasSVGRareData()) 273 if (!hasSVGRareData())
264 return; 274 return;
265 for (const QualifiedName* attribute : svgRareData()->webAnimatedAttributes() ) { 275 for (const QualifiedName* attribute : svgRareData()->webAnimatedAttributes() ) {
266 updateInstancesAnimatedAttribute(this, *attribute, [](SVGAnimatedPropert yBase& animatedProperty) { 276 updateInstancesAnimatedAttribute(this, *attribute, [](SVGAnimatedPropert yBase& animatedProperty) {
267 animatedProperty.animationEnded(); 277 animatedProperty.animationEnded();
268 }); 278 });
269 } 279 }
270 svgRareData()->webAnimatedAttributes().clear(); 280 svgRareData()->webAnimatedAttributes().clear();
271 } 281 }
272 282
283 void SVGElement::setAnimatedAttribute(const QualifiedName& attribute, SVGPropert yBase* value)
284 {
285 updateInstancesAnimatedAttributeNoInvalidate(this, attribute, [&value](SVGAn imatedPropertyBase& animatedProperty) {
286 animatedProperty.setAnimatedValue(value);
287 });
288 }
289
290 void SVGElement::clearAnimatedAttribute(const QualifiedName& attribute)
291 {
292 updateInstancesAnimatedAttributeNoInvalidate(this, attribute, [](SVGAnimated PropertyBase& animatedProperty) {
293 animatedProperty.animationEnded();
294 });
295 }
296
273 AffineTransform SVGElement::localCoordinateSpaceTransform(CTMScope) const 297 AffineTransform SVGElement::localCoordinateSpaceTransform(CTMScope) const
274 { 298 {
275 // To be overriden by SVGGraphicsElement (or as special case SVGTextElement and SVGPatternElement) 299 // To be overriden by SVGGraphicsElement (or as special case SVGTextElement and SVGPatternElement)
276 return AffineTransform(); 300 return AffineTransform();
277 } 301 }
278 302
279 Node::InsertionNotificationRequest SVGElement::insertedInto(ContainerNode* rootP arent) 303 Node::InsertionNotificationRequest SVGElement::insertedInto(ContainerNode* rootP arent)
280 { 304 {
281 Element::insertedInto(rootParent); 305 Element::insertedInto(rootParent);
282 updateRelativeLengthsInformation(); 306 updateRelativeLengthsInformation();
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 Element::trace(visitor); 1203 Element::trace(visitor);
1180 } 1204 }
1181 1205
1182 const AtomicString& SVGElement::eventParameterName() 1206 const AtomicString& SVGElement::eventParameterName()
1183 { 1207 {
1184 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt")); 1208 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt"));
1185 return evtString; 1209 return evtString;
1186 } 1210 }
1187 1211
1188 } // namespace blink 1212 } // namespace blink
OLDNEW
« 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