Beispiel #1
0
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();
}
Beispiel #2
0
void SVGSMILElement::removedFrom(ContainerNode* rootParent) {
  if (rootParent->isConnected()) {
    clearResourceAndEventBaseReferences();
    clearConditions();
    setTargetElement(nullptr);
    setAttributeName(anyQName());
    animationAttributeChanged();
    m_timeContainer = nullptr;
  }

  SVGElement::removedFrom(rootParent);
}
void SVGSMILElement::buildPendingResource()
{
    clearResourceReferences();

    if (!inDocument()) {
        // Reset the target element if we are no longer in the document.
        setTargetElement(0);
        return;
    }

    String id;
    String href = getAttribute(XLinkNames::hrefAttr);
    Element* target;
    if (href.isEmpty())
        target = parentNode() && parentNode()->isElementNode() ? toElement(parentNode()) : 0;
    else
        target = SVGURIReference::targetElementFromIRIString(href, document(), &id);
    SVGElement* svgTarget = target && target->isSVGElement() ? toSVGElement(target) : 0;

    if (svgTarget && !svgTarget->inDocument())
        svgTarget = 0;

    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.
        document().accessSVGExtensions()->addElementReferencingTarget(this, svgTarget);
    }
}
void SVGSMILElement::removedFrom(ContainerNode& rootParent)
{
    if (rootParent.inDocument()) {
        clearResourceReferences();
        disconnectConditions();
        setTargetElement(0);
        setAttributeName(anyQName());
        animationAttributeChanged();
        m_timeContainer = 0;
    }

    SVGElement::removedFrom(rootParent);
}
void SVGSMILElement::clearTarget()
{
    setTargetElement(nullptr);
}