| OLD | NEW |
| 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 ActiveInterpolationsMap activeInterpolationsMap = AnimationStack::activeInte
rpolations( | 230 ActiveInterpolationsMap activeInterpolationsMap = AnimationStack::activeInte
rpolations( |
| 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> | |
| 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 static inline void notifyAnimValChanged(SVGElement* targetElement, const Qualifi
edName& attributeName) | 240 static inline void notifyAnimValChanged(SVGElement* targetElement, const Qualifi
edName& attributeName) |
| 251 { | 241 { |
| 252 targetElement->invalidateSVGAttributes(); | 242 targetElement->invalidateSVGAttributes(); |
| 253 targetElement->svgAttributeChanged(attributeName); | 243 targetElement->svgAttributeChanged(attributeName); |
| 254 } | 244 } |
| 255 | 245 |
| 256 template<typename T> | 246 template<typename T> |
| 257 static void updateInstancesAnimatedAttribute(SVGElement* element, const Qualifie
dName& attribute, T callback) | 247 static void forSelfAndInstances(SVGElement* element, T callback) |
| 258 { | 248 { |
| 259 SVGElement::InstanceUpdateBlocker blocker(element); | 249 SVGElement::InstanceUpdateBlocker blocker(element); |
| 260 for (SVGElement* instance : SVGAnimateElement::findElementInstances(element)
) { | 250 for (SVGElement* instance : SVGAnimateElement::findElementInstances(element)
) |
| 261 if (SVGAnimatedPropertyBase* animatedProperty = instance->propertyFromAt
tribute(attribute)) { | 251 callback(instance); |
| 262 callback(*animatedProperty); | |
| 263 notifyAnimValChanged(instance, attribute); | |
| 264 } | |
| 265 } | |
| 266 } | 252 } |
| 267 | 253 |
| 268 void SVGElement::setWebAnimatedAttribute(const QualifiedName& attribute, SVGProp
ertyBase* value) | 254 void SVGElement::setWebAnimatedAttribute(const QualifiedName& attribute, SVGProp
ertyBase* value) |
| 269 { | 255 { |
| 270 updateInstancesAnimatedAttribute(this, attribute, [&value](SVGAnimatedProper
tyBase& animatedProperty) { | 256 forSelfAndInstances(this, [&attribute, &value](SVGElement* element) { |
| 271 animatedProperty.setAnimatedValue(value); | 257 if (SVGAnimatedPropertyBase* animatedProperty = element->propertyFromAtt
ribute(attribute)) { |
| 258 animatedProperty->setAnimatedValue(value); |
| 259 notifyAnimValChanged(element, attribute); |
| 260 } |
| 272 }); | 261 }); |
| 273 ensureSVGRareData()->webAnimatedAttributes().add(&attribute); | 262 ensureSVGRareData()->webAnimatedAttributes().add(&attribute); |
| 274 } | 263 } |
| 275 | 264 |
| 276 void SVGElement::clearWebAnimatedAttributes() | 265 void SVGElement::clearWebAnimatedAttributes() |
| 277 { | 266 { |
| 278 if (!hasSVGRareData()) | 267 if (!hasSVGRareData()) |
| 279 return; | 268 return; |
| 280 for (const QualifiedName* attribute : svgRareData()->webAnimatedAttributes()
) { | 269 for (const QualifiedName* attribute : svgRareData()->webAnimatedAttributes()
) { |
| 281 updateInstancesAnimatedAttribute(this, *attribute, [](SVGAnimatedPropert
yBase& animatedProperty) { | 270 forSelfAndInstances(this, [&attribute](SVGElement* element) { |
| 282 animatedProperty.animationEnded(); | 271 if (SVGAnimatedPropertyBase* animatedProperty = element->propertyFro
mAttribute(*attribute)) { |
| 272 animatedProperty->animationEnded(); |
| 273 notifyAnimValChanged(element, *attribute); |
| 274 } |
| 283 }); | 275 }); |
| 284 } | 276 } |
| 285 svgRareData()->webAnimatedAttributes().clear(); | 277 svgRareData()->webAnimatedAttributes().clear(); |
| 286 } | 278 } |
| 287 | 279 |
| 288 void SVGElement::setAnimatedAttribute(const QualifiedName& attribute, SVGPropert
yBase* value) | 280 void SVGElement::setAnimatedAttribute(const QualifiedName& attribute, SVGPropert
yBase* value) |
| 289 { | 281 { |
| 290 updateInstancesAnimatedAttributeNoInvalidate(this, attribute, [&value](SVGAn
imatedPropertyBase& animatedProperty) { | 282 forSelfAndInstances(this, [&attribute, &value](SVGElement* element) { |
| 291 animatedProperty.setAnimatedValue(value); | 283 if (SVGAnimatedPropertyBase* animatedProperty = element->propertyFromAtt
ribute(attribute)) |
| 284 animatedProperty->setAnimatedValue(value); |
| 292 }); | 285 }); |
| 293 } | 286 } |
| 294 | 287 |
| 295 void SVGElement::invalidateAnimatedAttribute(const QualifiedName& attribute) | 288 void SVGElement::invalidateAnimatedAttribute(const QualifiedName& attribute) |
| 296 { | 289 { |
| 297 InstanceUpdateBlocker blocker(this); | 290 forSelfAndInstances(this, [&attribute](SVGElement* element) { |
| 298 notifyAnimValChanged(this, attribute); | |
| 299 | |
| 300 for (SVGElement* element : instancesForElement()) | |
| 301 notifyAnimValChanged(element, attribute); | 291 notifyAnimValChanged(element, attribute); |
| 292 }); |
| 302 } | 293 } |
| 303 | 294 |
| 304 void SVGElement::clearAnimatedAttribute(const QualifiedName& attribute) | 295 void SVGElement::clearAnimatedAttribute(const QualifiedName& attribute) |
| 305 { | 296 { |
| 306 updateInstancesAnimatedAttributeNoInvalidate(this, attribute, [](SVGAnimated
PropertyBase& animatedProperty) { | 297 forSelfAndInstances(this, [&attribute](SVGElement* element) { |
| 307 animatedProperty.animationEnded(); | 298 if (SVGAnimatedPropertyBase* animatedProperty = element->propertyFromAtt
ribute(attribute)) |
| 299 animatedProperty->animationEnded(); |
| 308 }); | 300 }); |
| 309 } | 301 } |
| 310 | 302 |
| 311 AffineTransform SVGElement::localCoordinateSpaceTransform(CTMScope) const | 303 AffineTransform SVGElement::localCoordinateSpaceTransform(CTMScope) const |
| 312 { | 304 { |
| 313 // To be overriden by SVGGraphicsElement (or as special case SVGTextElement
and SVGPatternElement) | 305 // To be overriden by SVGGraphicsElement (or as special case SVGTextElement
and SVGPatternElement) |
| 314 return AffineTransform(); | 306 return AffineTransform(); |
| 315 } | 307 } |
| 316 | 308 |
| 317 Node::InsertionNotificationRequest SVGElement::insertedInto(ContainerNode* rootP
arent) | 309 Node::InsertionNotificationRequest SVGElement::insertedInto(ContainerNode* rootP
arent) |
| (...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1217 Element::trace(visitor); | 1209 Element::trace(visitor); |
| 1218 } | 1210 } |
| 1219 | 1211 |
| 1220 const AtomicString& SVGElement::eventParameterName() | 1212 const AtomicString& SVGElement::eventParameterName() |
| 1221 { | 1213 { |
| 1222 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt")); | 1214 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt")); |
| 1223 return evtString; | 1215 return evtString; |
| 1224 } | 1216 } |
| 1225 | 1217 |
| 1226 } // namespace blink | 1218 } // namespace blink |
| OLD | NEW |