Changeset 116451 in webkit
- Timestamp:
- May 8, 2012 12:44:17 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r116446 r116451 1 2012-05-04 Nikolas Zimmermann <nzimmermann@rim.com> 2 3 Tie lifetime of SVGAnimateElement::m_animatedType to the duration of the animation 4 https://bugs.webkit.org/show_bug.cgi?id=85627 5 6 Reviewed by Antti Koivisto. 7 8 Update animate-target-id-changed.svg test to match Firefox behavior. 9 When an animation element with fill="freeze" is changed to a new target 10 eg, via animate.href = "#someOtherID", the animation effect should be removed. 11 12 Add tests for assertions I ran into while developing this patch. 13 14 * platform/chromium/test_expectations.txt: Require new results for animate-target-id-changed-expected.txt. 15 * platform/mac/svg/custom/animate-target-id-changed-expected.png: 16 * svg/animations/list-wrapper-assertion-expected.svg: Added. 17 * svg/animations/list-wrapper-assertion.svg: Added. 18 * svg/custom/animate-target-id-changed-expected.txt: 19 * svg/custom/animate-target-id-changed.svg: 20 1 21 2012-05-08 Shezan Baig <shezbaig.wk@gmail.com> 2 22 -
trunk/LayoutTests/platform/chromium/test_expectations.txt
r116399 r116451 1162 1162 // ----------------------------------------------------------------- 1163 1163 1164 // Needs a rebaseline, should still be green. 1165 BUGWK85627 : svg/custom/animate-target-id-changed.svg = IMAGE+TEXT IMAGE TEXT PASS 1166 1164 1167 // Needs a rebaseline, only two circles should be visible now. 1165 1168 BUGWK84846 : svg/W3C-SVG-1.1/animate-elem-31-t.svg = IMAGE+TEXT IMAGE TEXT PASS -
trunk/LayoutTests/svg/custom/animate-target-id-changed-expected.txt
r107241 r116451 4 4 RenderSVGRoot {svg} at (0,0) size 100x100 5 5 RenderSVGRect {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#008000]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00] 6 RenderSVGRect {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#008000]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00] -
trunk/LayoutTests/svg/custom/animate-target-id-changed.svg
r107207 r116451 3 3 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runRepaintTest()"> 4 4 <script xlink:href="../../fast/repaint/resources/repaint.js"/> 5 <rect width="100" height="100" fill="green"/> 6 <rect id="target" width="100" height="100" fill="red"/> 7 <animate attributeName="fill" xlink:href="#target" from="green" to="green" begin="0s" dur="1s" fill="freeze"/> 5 <rect id="target" width="100" height="100" fill="green"/> 6 <animate attributeName="fill" xlink:href="#target" from="red" to="red" begin="0s" dur="1s" fill="freeze"/> 8 7 <script type="text/ecmascript"> 9 8 <![CDATA[ -
trunk/Source/WebCore/ChangeLog
r116450 r116451 1 2012-05-04 Nikolas Zimmermann <nzimmermann@rim.com> 2 3 Tie lifetime of SVGAnimateElement::m_animatedType to the duration of the animation 4 https://bugs.webkit.org/show_bug.cgi?id=85627 5 6 Reviewed by Antti Koivisto. 7 8 Example: 9 <rect width="10" height="100"> 10 <animate attributeName="width" from="10" to="100" begin="2s" dur="4s" fill="remove"/> 11 </rect> 12 13 At t=0s the <animate> element receives its first interval: begin=2s, end=6s. 14 At this point we've created the 'OwnPtr<SVGAnimatedType> m_animatedType' in 15 SVGAnimateElement, which holds the current animated value of the target type. 16 In this example it contains a SVGLength with '10' as value at t=0s. 17 18 Calling "rect.width.animVal.value" will return the value currently contained in the 19 m_animatedType from the SVGAnimateElement, even though the animation didn't begin 20 yet. This is fine, as the animVal equals to the baseVal, as long as no animation is 21 running. 22 23 At t=6s you'd expect that the whole 'animVal' object is destructed again, as it's no 24 longer needed, as animVal will be equal to baseVal again, but the current code keeps 25 the animVal alive, and just resets it to the baseVal. The animVals will be destructed 26 once the animate element leaves the tree. 27 28 CSS animations suffer from the same problem, we never remove the animated SMIL properties 29 but we only reset them to the base value. This makes integration with CSS Animations and 30 CSS Transitions harder, so this needs to be changed. 31 32 This patch starts tracking the start/end of an animation chain properly, to destruct 33 the animation effect for non-frozen animations at the end of their duration. This has to 34 work properly together with seeking (SVGSVGElement.setCurrentTime), as our testing relies 35 on the ability to drive the SMIL timeline from script. 36 37 Tests: svg/animations/list-wrapper-assertion-expected.svg 38 svg/animations/list-wrapper-assertion.svg 39 40 * svg/SVGAnimateElement.cpp: 41 (WebCore::SVGAnimateElement::resetAnimatedType): 42 (WebCore::applyCSSPropertyToTarget): 43 (WebCore::removeCSSPropertyFromTarget): 44 (WebCore::applyCSSPropertyToTargetAndInstances): 45 (WebCore::removeCSSPropertyFromTargetAndInstances): 46 (WebCore::notifyTargetAboutAnimValChange): 47 (WebCore::notifyTargetAndInstancesAboutAnimValChange): 48 (WebCore::SVGAnimateElement::clearAnimatedType): 49 (WebCore::SVGAnimateElement::applyResultsToTarget): 50 (WebCore::SVGAnimateElement::targetElementWillChange): 51 * svg/SVGAnimateElement.h: 52 (SVGAnimateElement): 53 * svg/SVGAnimateMotionElement.cpp: 54 (WebCore::SVGAnimateMotionElement::resetAnimatedType): 55 (WebCore::SVGAnimateMotionElement::clearAnimatedType): 56 * svg/SVGAnimateMotionElement.h: 57 (SVGAnimateMotionElement): 58 * svg/SVGAnimationElement.cpp: 59 * svg/SVGAnimationElement.h: 60 * svg/animation/SMILTimeContainer.cpp: 61 (WebCore::SMILTimeContainer::updateAnimations): 62 * svg/animation/SVGSMILElement.cpp: 63 (WebCore::SVGSMILElement::reset): 64 (WebCore::SVGSMILElement::targetElementWillChange): 65 (WebCore::SVGSMILElement::determineActiveState): 66 (WebCore::SVGSMILElement::progress): 67 * svg/animation/SVGSMILElement.h: 68 (SVGSMILElement): 69 * svg/properties/SVGAnimatedListPropertyTearOff.h: 70 Remove svgAttributeChanged() calls from animationEnded/animValDidChange. 71 Callers are now required to notify the target about changes. There are cases 72 where we want to call animValDidChange without invoking svgAttributeChanged(). 73 That is supported now. 74 (WebCore::SVGAnimatedListPropertyTearOff::animationEnded): 75 (WebCore::SVGAnimatedListPropertyTearOff::animValDidChange): 76 * svg/properties/SVGAnimatedProperty.h: Ditto. 77 (WebCore::SVGAnimatedProperty::commitChange): Add safety guard. 78 * svg/properties/SVGAnimatedPropertyTearOff.h: Ditto. 79 (WebCore::SVGAnimatedPropertyTearOff::animationEnded): 80 (WebCore::SVGAnimatedPropertyTearOff::animValDidChange): 81 * svg/properties/SVGAnimatedStaticPropertyTearOff.h: Ditto. 82 (WebCore::SVGAnimatedStaticPropertyTearOff::animationEnded): 83 (WebCore::SVGAnimatedStaticPropertyTearOff::animValDidChange): 84 1 85 2012-05-08 Ryuan Choi <ryuan.choi@samsung.com> 2 86 -
trunk/Source/WebCore/svg/SVGAnimateElement.cpp
r115950 r116451 197 197 #endif 198 198 199 void SVGAnimateElement::reset ToBaseValue()199 void SVGAnimateElement::resetAnimatedType() 200 200 { 201 201 SVGAnimatedTypeAnimator* animator = ensureAnimator(); … … 213 213 if (!m_animatedType) 214 214 m_animatedType = animator->startAnimValAnimation(m_animatedProperties); 215 else 215 else { 216 216 animator->resetAnimValToBaseVal(m_animatedProperties, m_animatedType.get()); 217 animator->animValDidChange(m_animatedProperties); 218 } 217 219 return; 218 220 } … … 233 235 } 234 236 237 static inline void applyCSSPropertyToTarget(SVGElement* targetElement, CSSPropertyID id, const String& value) 238 { 239 ASSERT(!targetElement->m_deletionHasBegun); 240 241 StylePropertySet* propertySet = targetElement->ensureAnimatedSMILStyleProperties(); 242 if (!propertySet->setProperty(id, value, false, 0)) 243 return; 244 245 targetElement->setNeedsStyleRecalc(SyntheticStyleChange); 246 } 247 248 static inline void removeCSSPropertyFromTarget(SVGElement* targetElement, CSSPropertyID id) 249 { 250 ASSERT(!targetElement->m_deletionHasBegun); 251 targetElement->ensureAnimatedSMILStyleProperties()->removeProperty(id); 252 targetElement->setNeedsStyleRecalc(SyntheticStyleChange); 253 } 254 255 static inline void applyCSSPropertyToTargetAndInstances(SVGElement* targetElement, const QualifiedName& attributeName, const String& valueAsString) 256 { 257 ASSERT(targetElement); 258 if (attributeName == anyQName() || !targetElement->inDocument() || !targetElement->parentNode()) 259 return; 260 261 CSSPropertyID id = cssPropertyID(attributeName.localName()); 262 263 SVGElementInstance::InstanceUpdateBlocker blocker(targetElement); 264 applyCSSPropertyToTarget(targetElement, id, valueAsString); 265 266 // If the target element has instances, update them as well, w/o requiring the <use> tree to be rebuilt. 267 const HashSet<SVGElementInstance*>& instances = targetElement->instancesForElement(); 268 const HashSet<SVGElementInstance*>::const_iterator end = instances.end(); 269 for (HashSet<SVGElementInstance*>::const_iterator it = instances.begin(); it != end; ++it) { 270 if (SVGElement* shadowTreeElement = (*it)->shadowTreeElement()) 271 applyCSSPropertyToTarget(shadowTreeElement, id, valueAsString); 272 } 273 } 274 275 static inline void removeCSSPropertyFromTargetAndInstances(SVGElement* targetElement, const QualifiedName& attributeName) 276 { 277 ASSERT(targetElement); 278 if (attributeName == anyQName() || !targetElement->inDocument() || !targetElement->parentNode()) 279 return; 280 281 CSSPropertyID id = cssPropertyID(attributeName.localName()); 282 283 SVGElementInstance::InstanceUpdateBlocker blocker(targetElement); 284 removeCSSPropertyFromTarget(targetElement, id); 285 286 // If the target element has instances, update them as well, w/o requiring the <use> tree to be rebuilt. 287 const HashSet<SVGElementInstance*>& instances = targetElement->instancesForElement(); 288 const HashSet<SVGElementInstance*>::const_iterator end = instances.end(); 289 for (HashSet<SVGElementInstance*>::const_iterator it = instances.begin(); it != end; ++it) { 290 if (SVGElement* shadowTreeElement = (*it)->shadowTreeElement()) 291 removeCSSPropertyFromTarget(shadowTreeElement, id); 292 } 293 } 294 295 static inline void notifyTargetAboutAnimValChange(SVGElement* targetElement, const QualifiedName& attributeName) 296 { 297 ASSERT(!targetElement->m_deletionHasBegun); 298 targetElement->svgAttributeChanged(attributeName); 299 } 300 301 static inline void notifyTargetAndInstancesAboutAnimValChange(SVGElement* targetElement, const QualifiedName& attributeName) 302 { 303 ASSERT(targetElement); 304 if (attributeName == anyQName() || !targetElement->inDocument() || !targetElement->parentNode()) 305 return; 306 307 SVGElementInstance::InstanceUpdateBlocker blocker(targetElement); 308 notifyTargetAboutAnimValChange(targetElement, attributeName); 309 310 // If the target element has instances, update them as well, w/o requiring the <use> tree to be rebuilt. 311 const HashSet<SVGElementInstance*>& instances = targetElement->instancesForElement(); 312 const HashSet<SVGElementInstance*>::const_iterator end = instances.end(); 313 for (HashSet<SVGElementInstance*>::const_iterator it = instances.begin(); it != end; ++it) { 314 if (SVGElement* shadowTreeElement = (*it)->shadowTreeElement()) 315 notifyTargetAboutAnimValChange(shadowTreeElement, attributeName); 316 } 317 } 318 319 void SVGAnimateElement::clearAnimatedType(SVGElement* targetElement) 320 { 321 if (!m_animatedType) 322 return; 323 324 if (!targetElement) { 325 m_animatedType.clear(); 326 return; 327 } 328 329 if (m_animatedProperties.isEmpty()) { 330 // CSS properties animation code-path. 331 removeCSSPropertyFromTargetAndInstances(targetElement, attributeName()); 332 m_animatedType.clear(); 333 return; 334 } 335 336 // SVG DOM animVal animation code-path. 337 if (m_animator) { 338 m_animator->stopAnimValAnimation(m_animatedProperties); 339 notifyTargetAndInstancesAboutAnimValChange(targetElement, attributeName()); 340 } 341 342 m_animatedProperties.clear(); 343 m_animatedType.clear(); 344 } 345 235 346 void SVGAnimateElement::applyResultsToTarget() 236 347 { 237 348 ASSERT(m_animatedPropertyType != AnimatedTransformList || hasTagName(SVGNames::animateTransformTag)); 238 349 ASSERT(m_animatedPropertyType != AnimatedUnknown); 239 ASSERT(m_animatedType);240 350 ASSERT(m_animator); 351 352 // Early exit if our animated type got destructed by a previous endedActiveInterval(). 353 if (!m_animatedType) 354 return; 241 355 242 356 if (m_animatedProperties.isEmpty()) { 243 357 // CSS properties animation code-path. 244 setTargetAttributeAnimatedCSSValue(m_animatedType.get()); 358 // Convert the result of the animation to a String and apply it as CSS property on the target & all instances. 359 applyCSSPropertyToTargetAndInstances(targetElement(), attributeName(), m_animatedType->valueAsString()); 245 360 return; 246 361 } 247 362 248 363 // SVG DOM animVal animation code-path. 364 // At this point the SVG DOM values are already changed, unlike for CSS. 365 // We only have to trigger update notifications here. 249 366 m_animator->animValDidChange(m_animatedProperties); 367 notifyTargetAndInstancesAboutAnimValChange(targetElement(), attributeName()); 250 368 } 251 369 … … 283 401 SVGSMILElement::targetElementWillChange(currentTarget, newTarget); 284 402 285 if (!m_animatedProperties.isEmpty()) { 286 ensureAnimator()->stopAnimValAnimation(m_animatedProperties); 287 m_animatedProperties.clear(); 288 } 289 290 m_animatedType.clear(); 403 ASSERT(!m_animatedType); 291 404 m_fromType.clear(); 292 405 m_toType.clear(); -
trunk/Source/WebCore/svg/SVGAnimateElement.h
r115950 r116451 44 44 SVGAnimateElement(const QualifiedName&, Document*); 45 45 46 virtual void resetToBaseValue(); 46 virtual void resetAnimatedType(); 47 virtual void clearAnimatedType(SVGElement* targetElement); 47 48 virtual bool calculateToAtEndOfDurationValue(const String& toAtEndOfDurationString); 48 49 virtual bool calculateFromAndToValues(const String& fromString, const String& toString); -
trunk/Source/WebCore/svg/SVGAnimateMotionElement.cpp
r115950 r116451 165 165 } 166 166 167 void SVGAnimateMotionElement::reset ToBaseValue()167 void SVGAnimateMotionElement::resetAnimatedType() 168 168 { 169 169 if (!hasValidAttributeType()) 170 170 return; 171 AffineTransform* transform = targetElement()->supplementalTransform(); 172 if (!transform) 173 return; 174 transform->makeIdentity(); 171 SVGElement* targetElement = this->targetElement(); 172 if (!targetElement) 173 return; 174 if (AffineTransform* transform = targetElement->supplementalTransform()) 175 transform->makeIdentity(); 176 } 177 178 void SVGAnimateMotionElement::clearAnimatedType(SVGElement* targetElement) 179 { 180 if (!targetElement) 181 return; 182 if (AffineTransform* transform = targetElement->supplementalTransform()) 183 transform->makeIdentity(); 175 184 } 176 185 -
trunk/Source/WebCore/svg/SVGAnimateMotionElement.h
r115950 r116451 40 40 virtual void parseAttribute(Attribute*) OVERRIDE; 41 41 42 virtual void resetToBaseValue(); 42 virtual void resetAnimatedType(); 43 virtual void clearAnimatedType(SVGElement* targetElement); 43 44 virtual bool calculateToAtEndOfDurationValue(const String& toAtEndOfDurationString); 44 45 virtual bool calculateFromAndToValues(const String& fromString, const String& toString); -
trunk/Source/WebCore/svg/SVGAnimationElement.cpp
r115950 r116451 32 32 #include "CSSParser.h" 33 33 #include "CSSPropertyNames.h" 34 #include "Color.h"35 34 #include "Document.h" 36 #include "Event.h"37 #include "EventListener.h"38 35 #include "FloatConversion.h" 39 #include "HTMLNames.h" 40 #include "PlatformString.h" 36 #include "RenderObject.h" 41 37 #include "SVGAnimateElement.h" 42 38 #include "SVGElementInstance.h" … … 44 40 #include "SVGParserUtilities.h" 45 41 #include "SVGStyledElement.h" 46 #include "SVGURIReference.h"47 #include "SVGUseElement.h"48 #include "XLinkNames.h"49 #include <wtf/StdLibExtras.h>50 51 using namespace std;52 42 53 43 namespace WebCore { … … 340 330 341 331 return SVGStyledElement::isAnimatableCSSProperty(attributeName); 342 }343 344 static inline void applyCSSPropertyToTarget(SVGElement* targetElement, CSSPropertyID id, const String& value)345 {346 StylePropertySet* propertySet = targetElement->ensureAnimatedSMILStyleProperties();347 if (propertySet->setProperty(id, value, false, 0))348 targetElement->setNeedsStyleRecalc(SyntheticStyleChange);349 }350 351 void SVGAnimationElement::setTargetAttributeAnimatedCSSValue(SVGAnimatedType* animatedType)352 {353 ASSERT(animatedType);354 SVGElement* targetElement = this->targetElement();355 ASSERT(targetElement);356 357 const QualifiedName& attributeName = this->attributeName();358 ASSERT(attributeName != anyQName());359 CSSPropertyID id = cssPropertyID(attributeName.localName());360 361 const String& valueAsString = animatedType->valueAsString();362 SVGElementInstance::InstanceUpdateBlocker blocker(targetElement);363 applyCSSPropertyToTarget(targetElement, id, valueAsString);364 365 // If the target element has instances, update them as well, w/o requiring the <use> tree to be rebuilt.366 const HashSet<SVGElementInstance*>& instances = targetElement->instancesForElement();367 const HashSet<SVGElementInstance*>::const_iterator end = instances.end();368 for (HashSet<SVGElementInstance*>::const_iterator it = instances.begin(); it != end; ++it) {369 if (SVGElement* shadowTreeElement = (*it)->shadowTreeElement())370 applyCSSPropertyToTarget(shadowTreeElement, id, valueAsString);371 }372 332 } 373 333 -
trunk/Source/WebCore/svg/SVGAnimationElement.h
r115950 r116451 191 191 192 192 String targetAttributeBaseValue(); 193 void setTargetAttributeAnimatedCSSValue(SVGAnimatedType*);194 193 195 194 // from SVGSMILElement 196 virtual void startedActiveInterval() ;197 virtual void updateAnimation(float percent, unsigned repeat, SVGSMILElement* resultElement) ;195 virtual void startedActiveInterval() OVERRIDE; 196 virtual void updateAnimation(float percent, unsigned repeat, SVGSMILElement* resultElement) OVERRIDE; 198 197 199 198 AnimatedPropertyValueType m_fromPropertyValueType; -
trunk/Source/WebCore/svg/animation/SMILTimeContainer.cpp
r115947 r116451 225 225 typedef HashMap<ElementAttributePair, RefPtr<SVGSMILElement> > ResultElementMap; 226 226 ResultElementMap resultsElements; 227 HashSet<SVGSMILElement*> contributingElements; 227 228 for (unsigned n = 0; n < toAnimate.size(); ++n) { 228 229 SVGSMILElement* animation = toAnimate[n]; … … 248 249 continue; 249 250 resultElement = animation; 250 resultElement->resetToBaseValue();251 251 resultsElements.add(key, resultElement); 252 252 } 253 253 254 254 // This will calculate the contribution from the animation and add it to the resultsElement. 255 animation->progress(elapsed, resultElement, seekToTime); 255 if (animation->progress(elapsed, resultElement, seekToTime)) 256 contributingElements.add(resultElement); 256 257 257 258 SMILTime nextFireTime = animation->nextProgressTime(); … … 262 263 Vector<SVGSMILElement*> animationsToApply; 263 264 ResultElementMap::iterator end = resultsElements.end(); 264 for (ResultElementMap::iterator it = resultsElements.begin(); it != end; ++it) 265 animationsToApply.append(it->second.get()); 265 for (ResultElementMap::iterator it = resultsElements.begin(); it != end; ++it) { 266 SVGSMILElement* animation = it->second.get(); 267 if (contributingElements.contains(animation)) 268 animationsToApply.append(animation); 269 } 270 271 unsigned animationsToApplySize = animationsToApply.size(); 272 if (!animationsToApplySize) { 273 startTimer(earliersFireTime, animationFrameDelay); 274 return; 275 } 266 276 267 277 // Sort <animateTranform> to be the last one to be applied. <animate> may change transform attribute as 268 278 // well (directly or indirectly by modifying <use> x/y) and this way transforms combine properly. 269 279 sortByApplyOrder(animationsToApply); 270 280 271 281 // Apply results to target elements. 272 for (unsigned n = 0; n < animationsToApply.size(); ++n)273 animationsToApply[ n]->applyResultsToTarget();282 for (unsigned i = 0; i < animationsToApplySize; ++i) 283 animationsToApply[i]->applyResultsToTarget(); 274 284 275 285 startTimer(earliersFireTime, animationFrameDelay); 276 277 286 Document::updateStyleForAllDocuments(); 278 287 } -
trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp
r116030 r116451 179 179 void SVGSMILElement::reset() 180 180 { 181 // Don't clear the animated type if we're frozen, only take action here if we're active. 182 if (m_activeState == Active) 183 clearAnimatedType(m_targetElement); 184 181 185 m_activeState = Inactive; 182 186 m_isWaitingForFirstInterval = true; … … 561 565 } 562 566 563 void SVGSMILElement::targetElementWillChange(SVGElement*, SVGElement*) 564 { 565 // If the animation state is Active, always reset to a clear state before leaving the old target element. 566 if (m_activeState == Active) 567 void SVGSMILElement::targetElementWillChange(SVGElement* currentTarget, SVGElement*) 568 { 569 // Only clear the animated type, if we had a target before. 570 if (currentTarget) 571 clearAnimatedType(currentTarget); 572 573 // If the animation state is not Inactive, always reset to a clear state before leaving the old target element. 574 if (m_activeState != Inactive) 567 575 endedActiveInterval(); 568 576 } … … 991 999 return Active; 992 1000 993 if (m_activeState == Active) 994 return fill() == FillFreeze ? Frozen : Inactive; 995 996 return m_activeState; 1001 return fill() == FillFreeze ? Frozen : Inactive; 997 1002 } 998 1003 … … 1003 1008 } 1004 1009 1005 void SVGSMILElement::progress(SMILTime elapsed, SVGSMILElement* resultElement, bool seekToTime) 1006 { 1010 bool SVGSMILElement::progress(SMILTime elapsed, SVGSMILElement* resultElement, bool seekToTime) 1011 { 1012 ASSERT(resultElement); 1007 1013 ASSERT(m_timeContainer); 1008 1014 ASSERT(m_isWaitingForFirstInterval || m_intervalBegin.isFinite()); … … 1014 1020 ASSERT(m_activeState == Inactive); 1015 1021 m_nextProgressTime = SMILTime::unresolved(); 1016 return ;1017 } 1018 1022 return false; 1023 } 1024 1019 1025 if (elapsed < m_intervalBegin) { 1020 1026 ASSERT(m_activeState != Active); 1021 if (m_activeState == Frozen && resultElement)1027 if (m_activeState == Frozen) 1022 1028 updateAnimation(m_lastPercent, m_lastRepeat, resultElement); 1023 1029 m_nextProgressTime = m_intervalBegin; 1024 return ;1030 return false; 1025 1031 } 1026 1032 1027 1033 m_previousIntervalBegin = m_intervalBegin; 1028 1029 if (m_ activeState == Inactive) {1034 1035 if (m_isWaitingForFirstInterval) { 1030 1036 m_isWaitingForFirstInterval = false; 1031 m_activeState = Active; 1032 startedActiveInterval(); 1037 resolveFirstInterval(); 1033 1038 } 1034 1039 … … 1045 1050 ActiveState oldActiveState = m_activeState; 1046 1051 m_activeState = determineActiveState(elapsed); 1047 if (isContributing(elapsed)) { 1048 if (resultElement) 1049 updateAnimation(percent, repeat, resultElement); 1052 bool animationIsContributing = isContributing(elapsed); 1053 1054 // Only reset the animated type to the base value once for the lowest priority animation that animates a particular element/attribute pair. 1055 if (this == resultElement) 1056 resetAnimatedType(); 1057 1058 if (animationIsContributing) { 1059 if (oldActiveState == Inactive) 1060 startedActiveInterval(); 1061 1062 updateAnimation(percent, repeat, resultElement); 1050 1063 m_lastPercent = percent; 1051 1064 m_lastRepeat = repeat; 1052 1065 } 1053 1066 1054 if (oldActiveState == Active && m_activeState != Active) 1067 if (oldActiveState == Active && m_activeState != Active) { 1055 1068 endedActiveInterval(); 1069 if (m_activeState != Frozen) 1070 clearAnimatedType(m_targetElement); 1071 } 1056 1072 1057 1073 m_nextProgressTime = calculateNextProgressTime(elapsed); 1074 return animationIsContributing; 1058 1075 } 1059 1076 -
trunk/Source/WebCore/svg/animation/SVGSMILElement.h
r115947 r116451 91 91 92 92 void seekToIntervalCorrespondingToTime(SMILTime elapsed); 93 voidprogress(SMILTime elapsed, SVGSMILElement* resultsElement, bool seekToTime);93 bool progress(SMILTime elapsed, SVGSMILElement* resultsElement, bool seekToTime); 94 94 SMILTime nextProgressTime() const; 95 95 … … 107 107 108 108 virtual bool isAdditive() const = 0; 109 virtual void resetToBaseValue() = 0; 109 virtual void resetAnimatedType() = 0; 110 virtual void clearAnimatedType(SVGElement* targetElement) = 0; 110 111 virtual void applyResultsToTarget() = 0; 111 112 … … 118 119 // Sub-classes may need to take action when the target is changed. 119 120 virtual void targetElementWillChange(SVGElement* currentTarget, SVGElement* newTarget); 120 virtual void endedActiveInterval();121 121 122 122 private: 123 123 virtual void startedActiveInterval() = 0; 124 void endedActiveInterval(); 124 125 virtual void updateAnimation(float percent, unsigned repeat, SVGSMILElement* resultElement) = 0; 125 126 -
trunk/Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h
r113184 r116451 117 117 m_animatedWrappers.clear(); 118 118 m_isAnimating = false; 119 120 ASSERT(contextElement());121 contextElement()->svgAttributeChanged(attributeName());122 119 } 123 120 … … 150 147 ASSERT(m_values.size() == m_wrappers.size()); 151 148 synchronizeWrappersIfNeeded(); 152 153 ASSERT(contextElement());154 contextElement()->svgAttributeChanged(attributeName());155 149 } 156 150 -
trunk/Source/WebCore/svg/properties/SVGAnimatedProperty.h
r115518 r116451 41 41 { 42 42 ASSERT(m_contextElement); 43 ASSERT(!m_contextElement->m_deletionHasBegun); 43 44 m_contextElement->invalidateSVGAttributes(); 44 45 m_contextElement->svgAttributeChanged(m_attributeName); -
trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyTearOff.h
r113003 r116451 79 79 m_animVal->setValue(m_property); 80 80 m_isAnimating = false; 81 82 SVGElement* element = contextElement();83 if (!element || !element->inDocument() || !element->parentNode())84 return;85 ASSERT(!element->m_deletionHasBegun);86 element->svgAttributeChanged(attributeName());87 81 } 88 82 … … 96 90 void animValDidChange() 97 91 { 92 // no-op for non list types. 98 93 ASSERT(m_isAnimating); 99 94 ASSERT(m_animVal); 100 101 ASSERT(contextElement());102 contextElement()->svgAttributeChanged(attributeName());103 95 } 104 96 -
trunk/Source/WebCore/svg/properties/SVGAnimatedStaticPropertyTearOff.h
r113003 r116451 82 82 m_animatedProperty = 0; 83 83 m_isAnimating = false; 84 85 SVGElement* element = contextElement();86 if (!element || !element->inDocument() || !element->parentNode())87 return;88 ASSERT(!element->m_deletionHasBegun);89 element->svgAttributeChanged(attributeName());90 84 } 91 85 … … 99 93 void animValDidChange() 100 94 { 95 // no-op for non list types. 101 96 ASSERT(m_isAnimating); 102 97 ASSERT(m_animatedProperty); 103 104 ASSERT(contextElement());105 contextElement()->svgAttributeChanged(attributeName());106 98 } 107 99
Note: See TracChangeset
for help on using the changeset viewer.