| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006 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) Research In Motion Limited 2011. All rights reserved. | 5 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 String baseValue; | 201 String baseValue; |
| 202 | 202 |
| 203 if (shouldApply == ApplyCSSAnimation) { | 203 if (shouldApply == ApplyCSSAnimation) { |
| 204 ASSERT(SVGAnimationElement::isTargetAttributeCSSProperty(targetElement,
attributeName)); | 204 ASSERT(SVGAnimationElement::isTargetAttributeCSSProperty(targetElement,
attributeName)); |
| 205 computeCSSPropertyValue(targetElement, cssPropertyID(attributeName.local
Name()), baseValue); | 205 computeCSSPropertyValue(targetElement, cssPropertyID(attributeName.local
Name()), baseValue); |
| 206 } | 206 } |
| 207 | 207 |
| 208 m_animatedProperty = m_animator.constructFromString(baseValue); | 208 m_animatedProperty = m_animator.constructFromString(baseValue); |
| 209 } | 209 } |
| 210 | 210 |
| 211 static inline void applyCSSPropertyToTarget(SVGElement* targetElement, CSSProper
tyID id, const String& value) | |
| 212 { | |
| 213 MutableStylePropertySet* propertySet = targetElement->ensureAnimatedSMILStyl
eProperties(); | |
| 214 if (!propertySet->setProperty(id, value, false, 0)) | |
| 215 return; | |
| 216 | |
| 217 targetElement->setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTra
cing::create(StyleChangeReason::Animation)); | |
| 218 } | |
| 219 | |
| 220 static inline void removeCSSPropertyFromTarget(SVGElement* targetElement, CSSPro
pertyID id) | |
| 221 { | |
| 222 targetElement->ensureAnimatedSMILStyleProperties()->removeProperty(id); | |
| 223 targetElement->setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTra
cing::create(StyleChangeReason::Animation)); | |
| 224 } | |
| 225 | |
| 226 static inline void applyCSSPropertyToTargetAndInstances(SVGElement* targetElemen
t, const QualifiedName& attributeName, const String& valueAsString) | 211 static inline void applyCSSPropertyToTargetAndInstances(SVGElement* targetElemen
t, const QualifiedName& attributeName, const String& valueAsString) |
| 227 { | 212 { |
| 228 ASSERT(targetElement); | 213 ASSERT(targetElement); |
| 229 if (attributeName == anyQName() || !targetElement->isConnected() || !targetE
lement->parentNode()) | 214 if (attributeName == anyQName() || !targetElement->isConnected() || !targetE
lement->parentNode()) |
| 230 return; | 215 return; |
| 231 | 216 |
| 232 CSSPropertyID id = cssPropertyID(attributeName.localName()); | 217 CSSPropertyID id = cssPropertyID(attributeName.localName()); |
| 218 MutableStylePropertySet* propertySet = targetElement->ensureAnimatedSMILStyl
eProperties(); |
| 219 if (!propertySet->setProperty(id, valueAsString, false, 0)) |
| 220 return; |
| 233 | 221 |
| 234 SVGElement::InstanceUpdateBlocker blocker(targetElement); | 222 targetElement->setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTra
cing::create(StyleChangeReason::Animation)); |
| 235 applyCSSPropertyToTarget(targetElement, id, valueAsString); | |
| 236 | |
| 237 // If the target element has instances, update them as well, w/o requiring t
he <use> tree to be rebuilt. | |
| 238 const HeapHashSet<WeakMember<SVGElement>>& instances = targetElement->instan
cesForElement(); | |
| 239 for (SVGElement* shadowTreeElement : instances) { | |
| 240 if (shadowTreeElement) | |
| 241 applyCSSPropertyToTarget(shadowTreeElement, id, valueAsString); | |
| 242 } | |
| 243 } | 223 } |
| 244 | 224 |
| 245 static inline void removeCSSPropertyFromTargetAndInstances(SVGElement* targetEle
ment, const QualifiedName& attributeName) | 225 static inline void removeCSSPropertyFromTargetAndInstances(SVGElement* targetEle
ment, const QualifiedName& attributeName) |
| 246 { | 226 { |
| 247 ASSERT(targetElement); | 227 ASSERT(targetElement); |
| 248 if (attributeName == anyQName() || !targetElement->isConnected() || !targetE
lement->parentNode()) | 228 if (attributeName == anyQName() || !targetElement->isConnected() || !targetE
lement->parentNode()) |
| 249 return; | 229 return; |
| 250 | 230 |
| 251 CSSPropertyID id = cssPropertyID(attributeName.localName()); | 231 CSSPropertyID id = cssPropertyID(attributeName.localName()); |
| 252 | 232 targetElement->ensureAnimatedSMILStyleProperties()->removeProperty(id); |
| 253 SVGElement::InstanceUpdateBlocker blocker(targetElement); | 233 targetElement->setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTra
cing::create(StyleChangeReason::Animation)); |
| 254 removeCSSPropertyFromTarget(targetElement, id); | |
| 255 | |
| 256 // If the target element has instances, update them as well, w/o requiring t
he <use> tree to be rebuilt. | |
| 257 const HeapHashSet<WeakMember<SVGElement>>& instances = targetElement->instan
cesForElement(); | |
| 258 for (SVGElement* shadowTreeElement : instances) { | |
| 259 if (shadowTreeElement) | |
| 260 removeCSSPropertyFromTarget(shadowTreeElement, id); | |
| 261 } | |
| 262 } | 234 } |
| 263 | 235 |
| 264 static inline void notifyTargetAboutAnimValChange(SVGElement* targetElement, con
st QualifiedName& attributeName) | 236 static inline void notifyTargetAboutAnimValChange(SVGElement* targetElement, con
st QualifiedName& attributeName) |
| 265 { | 237 { |
| 266 targetElement->invalidateSVGAttributes(); | 238 targetElement->invalidateSVGAttributes(); |
| 267 targetElement->svgAttributeChanged(attributeName); | 239 targetElement->svgAttributeChanged(attributeName); |
| 268 } | 240 } |
| 269 | 241 |
| 270 static inline void notifyTargetAndInstancesAboutAnimValChange(SVGElement* target
Element, const QualifiedName& attributeName) | 242 static inline void notifyTargetAndInstancesAboutAnimValChange(SVGElement* target
Element, const QualifiedName& attributeName) |
| 271 { | 243 { |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 { | 377 { |
| 406 visitor->trace(m_fromProperty); | 378 visitor->trace(m_fromProperty); |
| 407 visitor->trace(m_toProperty); | 379 visitor->trace(m_toProperty); |
| 408 visitor->trace(m_toAtEndOfDurationProperty); | 380 visitor->trace(m_toAtEndOfDurationProperty); |
| 409 visitor->trace(m_animatedProperty); | 381 visitor->trace(m_animatedProperty); |
| 410 visitor->trace(m_animator); | 382 visitor->trace(m_animator); |
| 411 SVGAnimationElement::trace(visitor); | 383 SVGAnimationElement::trace(visitor); |
| 412 } | 384 } |
| 413 | 385 |
| 414 } // namespace blink | 386 } // namespace blink |
| OLD | NEW |