void SVGSMILElement::svgAttributeChanged(const QualifiedName& attrName) { if (attrName == SVGNames::durAttr) { m_cachedDur = invalidCachedTime; } else if (attrName == SVGNames::repeatDurAttr) { m_cachedRepeatDur = invalidCachedTime; } else if (attrName == SVGNames::repeatCountAttr) { m_cachedRepeatCount = invalidCachedTime; } else if (attrName == SVGNames::minAttr) { m_cachedMin = invalidCachedTime; } else if (attrName == SVGNames::maxAttr) { m_cachedMax = invalidCachedTime; } else if (attrName == SVGNames::attributeNameAttr) { setAttributeName(constructQualifiedName(this, fastGetAttribute(SVGNames::attributeNameAttr))); } else if (attrName.matches(SVGNames::hrefAttr) || attrName.matches(XLinkNames::hrefAttr)) { // TODO(fs): Could be smarter here when 'href' is specified and 'xlink:href' is changed. SVGElement::InvalidationGuard invalidationGuard(this); buildPendingResource(); if (m_targetElement) clearAnimatedType(); } else if (attrName == SVGNames::beginAttr || attrName == SVGNames::endAttr) { if (inDocument()) { connectEventBaseConditions(); if (attrName == SVGNames::beginAttr) beginListChanged(elapsed()); else if (attrName == SVGNames::endAttr) endListChanged(elapsed()); } } else { SVGElement::svgAttributeChanged(attrName); return; } animationAttributeChanged(); }
void SVGSMILElement::buildPendingResource() { clearResourceAndEventBaseReferences(); if (!isConnected()) { // Reset the target element if we are no longer in the document. setTargetElement(nullptr); return; } AtomicString id; const AtomicString& href = SVGURIReference::legacyHrefString(*this); Element* target; if (href.isEmpty()) target = parentNode() && parentNode()->isElementNode() ? toElement(parentNode()) : nullptr; else target = SVGURIReference::targetElementFromIRIString(href, treeScope(), &id); SVGElement* svgTarget = target && target->isSVGElement() ? toSVGElement(target) : nullptr; if (svgTarget && !svgTarget->isConnected()) svgTarget = nullptr; if (svgTarget != targetElement()) setTargetElement(svgTarget); if (!svgTarget) { // Do not register as pending if we are already pending this resource. if (document().accessSVGExtensions().isElementPendingResource(this, id)) return; if (!id.isEmpty()) { document().accessSVGExtensions().addPendingResource(id, this); ASSERT(hasPendingResources()); } } else { // Register us with the target in the dependencies map. Any change of // hrefElement that leads to relayout/repainting now informs us, so we can // react to it. addReferenceTo(svgTarget); } connectEventBaseConditions(); }