void SVGAnimationElement::setTargetAttributeAnimatedValue(const String &value) { if (!hasValidTarget()) { return; } SVGElement *target = targetElement(); String attributeName = this->attributeName(); if (!target || attributeName.isEmpty() || value.isNull()) { return; } // We don't want the instance tree to get rebuild. Instances are updated in the loop below. if (target->isStyled()) { static_cast<SVGStyledElement *>(target)->setInstanceUpdatesBlocked(true); } ExceptionCode ec; bool isCSS = targetAttributeIsCSS(); if (isCSS) { // FIXME: This should set the override style, not the inline style. // Sadly override styles are not yet implemented. target->style()->setProperty(attributeName, value, "", ec); } else { // FIXME: This should set the 'presentation' value, not the actual // attribute value. Whatever that means in practice. target->setAttribute(attributeName, value, ec); } if (target->isStyled()) { static_cast<SVGStyledElement *>(target)->setInstanceUpdatesBlocked(false); } // If the target element is used in an <use> instance tree, update that as well. HashSet<SVGElementInstance *> *instances = document()->accessSVGExtensions()->instancesForElement(target); if (!instances) { return; } HashSet<SVGElementInstance *>::iterator end = instances->end(); for (HashSet<SVGElementInstance *>::iterator it = instances->begin(); it != end; ++it) { SVGElement *shadowTreeElement = (*it)->shadowTreeElement(); ASSERT(shadowTreeElement); if (isCSS) { shadowTreeElement->style()->setProperty(attributeName, value, "", ec); } else { shadowTreeElement->setAttribute(attributeName, value, ec); } (*it)->correspondingUseElement()->setChanged(); } }
void SVGAnimationElement::setTargetAttributeAnimatedValue(const String& value) { if (!hasValidAttributeType()) return; SVGElement* targetElement = this->targetElement(); QualifiedName attributeName = this->attributeName(); if (!targetElement || attributeName == anyQName() || value.isNull()) return; // We don't want the instance tree to get rebuild. Instances are updated in the loop below. if (targetElement->isStyled()) static_cast<SVGStyledElement*>(targetElement)->setInstanceUpdatesBlocked(true); bool attributeIsCSSProperty = isTargetAttributeCSSProperty(targetElement, attributeName); // Stop animation, if attributeType is set to CSS by the user, but the attribute itself is not a CSS property. if (!attributeIsCSSProperty && attributeType() == AttributeTypeCSS) return; ExceptionCode ec; if (attributeIsCSSProperty) { // FIXME: This should set the override style, not the inline style. // Sadly override styles are not yet implemented. targetElement->style()->setProperty(attributeName.localName(), value, "", ec); } else { // FIXME: This should set the 'presentation' value, not the actual // attribute value. Whatever that means in practice. targetElement->setAttribute(attributeName, value, ec); } if (targetElement->isStyled()) static_cast<SVGStyledElement*>(targetElement)->setInstanceUpdatesBlocked(false); // If the target element is used in an <use> instance tree, update that as well. const HashSet<SVGElementInstance*>& instances = targetElement->instancesForElement(); const HashSet<SVGElementInstance*>::const_iterator end = instances.end(); for (HashSet<SVGElementInstance*>::const_iterator it = instances.begin(); it != end; ++it) { SVGElement* shadowTreeElement = (*it)->shadowTreeElement(); if (!shadowTreeElement) continue; if (attributeIsCSSProperty) shadowTreeElement->style()->setProperty(attributeName.localName(), value, "", ec); else shadowTreeElement->setAttribute(attributeName, value, ec); (*it)->correspondingUseElement()->setNeedsStyleRecalc(); } }