void SVGAnimateElement::clearAnimatedType(SVGElement* targetElement) { if (!m_animatedProperty) return; if (!targetElement) { m_animatedProperty.clear(); return; } if (ensureAnimator()->isAnimatingCSSProperty()) { // CSS properties animation code-path. removeCSSPropertyFromTargetAndInstances(targetElement, attributeName()); m_animatedProperty.clear(); return; } // SVG DOM animVal animation code-path. if (m_animator) { WillBeHeapVector<RawPtrWillBeMember<SVGElement> > animatedElements = findElementInstances(targetElement); m_animator->stopAnimValAnimation(animatedElements); notifyTargetAndInstancesAboutAnimValChange(targetElement, attributeName()); } m_animatedProperty.clear(); }
void SVGAnimateElement::clearAnimatedType() { if (!m_animatedProperty) return; SVGElement* targetElement = this->targetElement(); if (!targetElement) { m_animatedProperty.clear(); return; } ShouldApplyAnimationType shouldApply = shouldApplyAnimation(targetElement, attributeName()); if (shouldApply == ApplyXMLandCSSAnimation) { removeCSSPropertyFromTargetAndInstances(targetElement, attributeName()); } else if (m_animator.isAnimatingCSSProperty()) { // CSS properties animation code-path. removeCSSPropertyFromTargetAndInstances(targetElement, attributeName()); m_animatedProperty.clear(); m_animator.clear(); return; } // SVG DOM animVal animation code-path. if (m_animatedProperty) { SVGElementInstances animatedElements = findElementInstances(targetElement); m_animator.stopAnimValAnimation(animatedElements); notifyTargetAndInstancesAboutAnimValChange(targetElement, attributeName()); } m_animatedProperty.clear(); m_animator.clear(); }
void SVGAnimateElement::resetAnimatedType() { SVGAnimatedTypeAnimator* animator = ensureAnimator(); ASSERT(m_animatedPropertyType == animator->type()); SVGElement* targetElement = this->targetElement(); const QualifiedName& attributeName = this->attributeName(); ShouldApplyAnimation shouldApply = shouldApplyAnimation(targetElement, attributeName); if (shouldApply == DontApplyAnimation) return; if (shouldApply == ApplyXMLAnimation) { // SVG DOM animVal animation code-path. m_animatedElements = findElementInstances(targetElement); ASSERT(!m_animatedElements.isEmpty()); Vector<SVGElement*>::const_iterator end = m_animatedElements.end(); for (Vector<SVGElement*>::const_iterator it = m_animatedElements.begin(); it != end; ++it) document().accessSVGExtensions().addElementReferencingTarget(this, *it); if (!m_animatedProperty) m_animatedProperty = animator->startAnimValAnimation(m_animatedElements); else m_animatedProperty = animator->resetAnimValToBaseVal(m_animatedElements); return; } // CSS properties animation code-path. ASSERT(m_animatedElements.isEmpty()); String baseValue; if (shouldApply == ApplyCSSAnimation) { ASSERT(SVGAnimationElement::isTargetAttributeCSSProperty(targetElement, attributeName)); computeCSSPropertyValue(targetElement, cssPropertyID(attributeName.localName()), baseValue); } m_animatedProperty = animator->constructFromString(baseValue); }
void SVGAnimateElement::resetAnimatedType() { SVGAnimatedTypeAnimator* animator = ensureAnimator(); SVGElement* targetElement = this->targetElement(); const QualifiedName& attributeName = this->attributeName(); ShouldApplyAnimation shouldApply = shouldApplyAnimation(targetElement, attributeName); if (shouldApply == DontApplyAnimation) return; if (shouldApply == ApplyXMLAnimation) { // SVG DOM animVal animation code-path. WillBeHeapVector<RawPtrWillBeMember<SVGElement> > animatedElements = findElementInstances(targetElement); ASSERT(!animatedElements.isEmpty()); WillBeHeapVector<RawPtrWillBeMember<SVGElement> >::const_iterator end = animatedElements.end(); for (WillBeHeapVector<RawPtrWillBeMember<SVGElement> >::const_iterator it = animatedElements.begin(); it != end; ++it) addReferenceTo(*it); if (!m_animatedProperty) m_animatedProperty = animator->startAnimValAnimation(animatedElements); else m_animatedProperty = animator->resetAnimValToBaseVal(animatedElements); return; } // CSS properties animation code-path. String baseValue; if (shouldApply == ApplyCSSAnimation) { ASSERT(SVGAnimationElement::isTargetAttributeCSSProperty(targetElement, attributeName)); computeCSSPropertyValue(targetElement, cssPropertyID(attributeName.localName()), baseValue); } m_animatedProperty = animator->constructFromString(baseValue); }
void SVGAnimateElement::resetAnimatedType() { SVGElement* targetElement = this->targetElement(); const QualifiedName& attributeName = this->attributeName(); m_animator.reset(targetElement); ShouldApplyAnimationType shouldApply = shouldApplyAnimation(targetElement, attributeName); if (shouldApply == DontApplyAnimation) return; if (shouldApply == ApplyXMLAnimation || shouldApply == ApplyXMLandCSSAnimation) { // SVG DOM animVal animation code-path. SVGElementInstances animatedElements = findElementInstances(targetElement); ASSERT(!animatedElements.isEmpty()); for (SVGElement* element : animatedElements) addReferenceTo(element); if (!m_animatedProperty) m_animatedProperty = m_animator.startAnimValAnimation(animatedElements); else m_animatedProperty = m_animator.resetAnimValToBaseVal(animatedElements); return; } // CSS properties animation code-path. String baseValue; if (shouldApply == ApplyCSSAnimation) { ASSERT(SVGAnimationElement::isTargetAttributeCSSProperty(targetElement, attributeName)); computeCSSPropertyValue(targetElement, cssPropertyID(attributeName.localName()), baseValue); } m_animatedProperty = m_animator.constructFromString(baseValue); }