bool SVGAnimateElement::calculateToAtEndOfDurationValue(const String& toAtEndOfDurationString) { if (toAtEndOfDurationString.isEmpty()) return false; m_toAtEndOfDurationProperty = ensureAnimator()->constructFromString(toAtEndOfDurationString); return true; }
void SVGAnimateElement::resetToBaseValue() { SVGAnimatedTypeAnimator* animator = ensureAnimator(); ASSERT(m_animatedPropertyType == animator->type()); SVGElement* targetElement = this->targetElement(); const QualifiedName& attributeName = this->attributeName(); ShouldApplyAnimation shouldApply = shouldApplyAnimation(targetElement, attributeName); if (shouldApply == ApplyXMLAnimation) { // SVG DOM animVal animation code-path. m_animatedProperties = animator->findAnimatedPropertiesForAttributeName(targetElement, attributeName); ASSERT(!m_animatedProperties.isEmpty()); ASSERT(propertyTypesAreConsistent(m_animatedPropertyType, m_animatedProperties)); if (!m_animatedType) m_animatedType = animator->startAnimValAnimation(m_animatedProperties); else animator->resetAnimValToBaseVal(m_animatedProperties, m_animatedType.get()); return; } // CSS properties animation code-path. ASSERT(m_animatedProperties.isEmpty()); String baseValue; if (shouldApply == ApplyCSSAnimation) { ASSERT(SVGAnimationElement::isTargetAttributeCSSProperty(targetElement, attributeName)); computeCSSPropertyValue(targetElement, cssPropertyID(attributeName.localName()), baseValue); } if (!m_animatedType) m_animatedType = animator->constructFromString(baseValue); else m_animatedType->setValueAsString(attributeName, baseValue); }
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::resetToBaseValue(const String& baseString) { // If animatedProperty is not null, we're dealing with a SVG DOM primitive animation. // In that case we don't need any base value strings, but can directly operate on these // SVG DOM primitives, like SVGLength. SVGAnimatedTypeAnimator* animator = ensureAnimator(); ASSERT(m_animatedPropertyType == animator->type()); SVGElement* targetElement = this->targetElement(); const QualifiedName& attributeName = this->attributeName(); ShouldApplyAnimation shouldApply = shouldApplyAnimation(targetElement, attributeName); if (shouldApply == ApplyXMLAnimation) m_animatedProperties = animator->findAnimatedPropertiesForAttributeName(targetElement, attributeName); else ASSERT(m_animatedProperties.isEmpty()); if (m_animatedProperties.isEmpty()) { // Legacy fallback code path, uses the passed-in baseString, which is cached. if (!m_animatedType) m_animatedType = animator->constructFromString(baseString); else m_animatedType->setValueAsString(attributeName, baseString); return; } ASSERT(propertyTypesAreConsistent(m_animatedPropertyType, m_animatedProperties)); if (!m_animatedType) m_animatedType = animator->startAnimValAnimation(m_animatedProperties); else animator->resetAnimValToBaseVal(m_animatedProperties, m_animatedType.get()); }
float SVGAnimateElement::calculateDistance(const String& fromString, const String& toString) { // FIXME: A return value of float is not enough to support paced animations on lists. SVGElement* targetElement = this->targetElement(); if (!targetElement) return -1; return ensureAnimator()->calculateDistance(fromString, toString); }
bool SVGAnimateElement::calculateFromAndToValues(const String& fromString, const String& toString) { SVGElement* targetElement = this->targetElement(); if (!targetElement) return false; determinePropertyValueTypes(fromString, toString); ensureAnimator()->calculateFromAndToValues(m_fromProperty, m_toProperty, fromString, toString); return true; }
bool SVGAnimateElement::calculateFromAndToValues(const String& fromString, const String& toString) { SVGElement* targetElement = this->targetElement(); if (!targetElement) return false; ensureAnimator()->calculateFromAndToValues(m_fromType, m_toType, fromString, toString); ASSERT(m_animatedPropertyType == m_animator->type()); return true; }
bool SVGAnimateElement::calculateFromAndByValues(const String& fromString, const String& byString) { SVGElement* targetElement = this->targetElement(); if (!targetElement) return false; ASSERT(!hasTagName(SVGNames::setTag)); ensureAnimator()->calculateFromAndByValues(m_fromType, m_toType, fromString, byString); ASSERT(m_animatedPropertyType == m_animator->type()); return true; }
void SVGAnimateElement::targetElementWillChange(SVGElement* currentTarget, SVGElement* newTarget) { SVGSMILElement::targetElementWillChange(currentTarget, newTarget); if (!m_animatedProperties.isEmpty()) { ensureAnimator()->stopAnimValAnimation(m_animatedProperties); m_animatedProperties.clear(); } m_animatedType.clear(); m_fromType.clear(); m_toType.clear(); m_animator.clear(); m_animatedPropertyType = newTarget ? determineAnimatedPropertyType(newTarget) : AnimatedString; }
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_animatedProperties = animator->findAnimatedPropertiesForAttributeName(targetElement, attributeName); SVGElementAnimatedPropertyList::const_iterator end = m_animatedProperties.end(); for (SVGElementAnimatedPropertyList::const_iterator it = m_animatedProperties.begin(); it != end; ++it) document().accessSVGExtensions()->addElementReferencingTarget(this, it->element); ASSERT(!m_animatedProperties.isEmpty()); ASSERT(propertyTypesAreConsistent(m_animatedPropertyType, m_animatedProperties)); if (!m_animatedType) m_animatedType = animator->startAnimValAnimation(m_animatedProperties); else { animator->resetAnimValToBaseVal(m_animatedProperties, m_animatedType.get()); animator->animValDidChange(m_animatedProperties); } return; } // CSS properties animation code-path. ASSERT(m_animatedProperties.isEmpty()); String baseValue; if (shouldApply == ApplyCSSAnimation) { ASSERT(SVGAnimationElement::isTargetAttributeCSSProperty(targetElement, attributeName)); computeCSSPropertyValue(targetElement, cssPropertyID(attributeName.localName()), baseValue); } if (!m_animatedType) m_animatedType = animator->constructFromString(baseValue); else m_animatedType->setValueAsString(attributeName, baseValue); }
bool SVGAnimateElement::calculateFromAndByValues(const String& fromString, const String& byString) { SVGElement* targetElement = this->targetElement(); if (!targetElement) return false; if (animationMode() == ByAnimation && !isAdditive()) return false; // from-by animation may only be used with attributes that support addition (e.g. most numeric attributes). if (animationMode() == FromByAnimation && !animatedPropertyTypeSupportsAddition()) return false; ASSERT(!isSVGSetElement(*this)); determinePropertyValueTypes(fromString, byString); ensureAnimator()->calculateFromAndByValues(m_fromProperty, m_toProperty, fromString, byString); return true; }
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); }
AnimatedPropertyType SVGAnimateElement::animatedPropertyType() { return ensureAnimator()->type(); }