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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/core.gypi ('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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 { 236 {
237 if (hasSVGRareData()) 237 if (hasSVGRareData())
238 svgRareData()->setInstanceUpdatesBlocked(value); 238 svgRareData()->setInstanceUpdatesBlocked(value);
239 } 239 }
240 240
241 void SVGElement::setWebAnimationsPending() 241 void SVGElement::setWebAnimationsPending()
242 { 242 {
243 document().accessSVGExtensions().addWebAnimationsPendingSVGElement(*this); 243 document().accessSVGExtensions().addWebAnimationsPendingSVGElement(*this);
244 } 244 }
245 245
246 template<typename T>
247 static void updateInstancesAnimatedAttribute(SVGElement* element, const Qualifie dName& attribute, T callback)
248 {
249 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
250 for (SVGElement* instance : SVGAnimateElement::findElementInstances(element) ) {
251 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> animatedProperty = instance- >propertyFromAttribute(attribute);
252 if (animatedProperty) {
253 callback(*animatedProperty);
254 instance->invalidateSVGAttributes();
255 instance->svgAttributeChanged(attribute);
256 }
257 }
258 }
259
260 void SVGElement::setWebAnimatedAttribute(const QualifiedName& attribute, PassRef PtrWillBeRawPtr<SVGPropertyBase> value) 246 void SVGElement::setWebAnimatedAttribute(const QualifiedName& attribute, PassRef PtrWillBeRawPtr<SVGPropertyBase> value)
261 { 247 {
262 updateInstancesAnimatedAttribute(this, attribute, [&value](SVGAnimatedProper tyBase& animatedProperty) { 248 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> animatedProperty = propertyFromA ttribute(attribute);
263 animatedProperty.setAnimatedValue(value.get()); 249 if (!animatedProperty)
264 }); 250 return;
251
252 animatedProperty->setAnimatedValue(value.get());
253 invalidateSVGAttributes();
254 svgAttributeChanged(attribute);
265 ensureSVGRareData()->webAnimatedAttributes().add(&attribute); 255 ensureSVGRareData()->webAnimatedAttributes().add(&attribute);
266 } 256 }
267 257
268 void SVGElement::clearWebAnimatedAttributes() 258 void SVGElement::clearWebAnimatedAttributes()
269 { 259 {
270 if (!hasSVGRareData()) 260 if (!hasSVGRareData())
271 return; 261 return;
262
272 for (const QualifiedName* attribute : svgRareData()->webAnimatedAttributes() ) { 263 for (const QualifiedName* attribute : svgRareData()->webAnimatedAttributes() ) {
273 updateInstancesAnimatedAttribute(this, *attribute, [](SVGAnimatedPropert yBase& animatedProperty) { 264 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> animatedProperty = propertyF romAttribute(*attribute);
274 animatedProperty.animationEnded(); 265 if (!animatedProperty)
275 }); 266 continue;
267
268 animatedProperty->animationEnded();
269 invalidateSVGAttributes();
270 svgAttributeChanged(*attribute);
276 } 271 }
272
277 svgRareData()->webAnimatedAttributes().clear(); 273 svgRareData()->webAnimatedAttributes().clear();
278 } 274 }
279 275
280 AffineTransform SVGElement::localCoordinateSpaceTransform(CTMScope) const 276 AffineTransform SVGElement::localCoordinateSpaceTransform(CTMScope) const
281 { 277 {
282 // To be overriden by SVGGraphicsElement (or as special case SVGTextElement and SVGPatternElement) 278 // To be overriden by SVGGraphicsElement (or as special case SVGTextElement and SVGPatternElement)
283 return AffineTransform(); 279 return AffineTransform();
284 } 280 }
285 281
286 Node::InsertionNotificationRequest SVGElement::insertedInto(ContainerNode* rootP arent) 282 Node::InsertionNotificationRequest SVGElement::insertedInto(ContainerNode* rootP arent)
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 Element::trace(visitor); 1184 Element::trace(visitor);
1189 } 1185 }
1190 1186
1191 const AtomicString& SVGElement::eventParameterName() 1187 const AtomicString& SVGElement::eventParameterName()
1192 { 1188 {
1193 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt", AtomicString::Con structFromLiteral)); 1189 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt", AtomicString::Con structFromLiteral));
1194 return evtString; 1190 return evtString;
1195 } 1191 }
1196 1192
1197 } // namespace blink 1193 } // namespace blink
OLDNEW
« 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