SVGUseElement::~SVGUseElement() { setDocumentResource(0); #if !ENABLE(OILPAN) clearResourceReferences(); #endif }
void SVGMPathElement::buildPendingResource() { clearResourceReferences(); if (!inDocument()) return; String id; Element* target = SVGURIReference::targetElementFromIRIString(href(), document(), &id); if (!target) { // Do not register as pending if we are already pending this resource. if (document().accessSVGExtensions()->isPendingResource(this, id)) return; if (!id.isEmpty()) { document().accessSVGExtensions()->addPendingResource(id, this); ASSERT(hasPendingResources()); } } else if (target->isSVGElement()) { // 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, toSVGElement(target)); } targetPathChanged(); }
void SVGMPathElement::removedFrom(ContainerNode* rootParent) { SVGElement::removedFrom(rootParent); notifyParentOfPathChange(rootParent); if (rootParent->inDocument()) clearResourceReferences(); }
void SVGFEImageElement::buildPendingResource() { clearResourceReferences(); if (!inDocument()) return; String id; Element* target = SVGURIReference::targetElementFromIRIString(href(), document(), &id); if (!target) { if (hasPendingResources()) return; if (id.isEmpty()) requestImageResource(); else { document()->accessSVGExtensions()->addPendingResource(id, this); ASSERT(hasPendingResources()); } } else if (target->isSVGElement()) { // 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, static_cast<SVGElement*>(target)); } invalidate(); }
void SVGUseElement::buildPendingResource() { if (!referencedDocument() || isInShadowTree()) return; clearResourceReferences(); if (!inDocument()) return; String id; Element* target = SVGURIReference::targetElementFromIRIString(href(), document(), &id, externalDocument()); if (!target || !target->inDocument()) { // If we can't find the target of an external element, just give up. // We can't observe if the target somewhen enters the external document, nor should we do it. if (externalDocument()) return; if (id.isEmpty()) return; referencedDocument()->accessSVGExtensions()->addPendingResource(id, this); ASSERT(hasPendingResources()); return; } if (target->isSVGElement()) { buildShadowAndInstanceTree(toSVGElement(target)); invalidateDependentShadowTrees(); } ASSERT(!m_needsShadowTreeRecreation); }
void SVGSMILElement::removedFrom(ContainerNode& rootParent) { if (rootParent.inDocument()) { clearResourceReferences(); disconnectConditions(); setTargetElement(0); setAttributeName(anyQName()); animationAttributeChanged(); m_timeContainer = 0; } 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 SVGFEImageElement::buildPendingResource() { clearResourceReferences(); if (!inDocument()) return; String id; Element* target = SVGURIReference::targetElementFromIRIString(href(), document(), &id); if (!target) { if (hasPendingResources()) return; if (id.isEmpty()) requestImageResource(); else { document()->accessSVGExtensions()->addPendingResource(id, this); ASSERT(hasPendingResources()); } } invalidate(); }
void SVGFEImageElement::buildPendingResource() { clearResourceReferences(); if (!inDocument()) return; AtomicString id; Element* target = SVGURIReference::targetElementFromIRIString(hrefString(), treeScope(), &id); if (!target) { if (id.isEmpty()) { fetchImageResource(); } else { document().accessSVGExtensions().addPendingResource(id, this); ASSERT(hasPendingResources()); } } else if (target->isSVGElement()) { // 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(toSVGElement(target)); } invalidate(); }
void SVGUseElement::removedFrom(ContainerNode& rootParent) { SVGGraphicsElement::removedFrom(rootParent); if (rootParent.inDocument()) clearResourceReferences(); }
void SVGUseElement::buildShadowAndInstanceTree(SVGElement* target) { ASSERT(!m_targetElementInstance); // Do not build the shadow/instance tree for <use> elements living in a shadow tree. // The will be expanded soon anyway - see expandUseElementsInShadowTree(). if (isInShadowTree()) return; // Do not allow self-referencing. // 'target' may be null, if it's a non SVG namespaced element. if (!target || target == this) return; // Why a seperated instance/shadow tree? SVG demands it: // The instance tree is accesable from JavaScript, and has to // expose a 1:1 copy of the referenced tree, whereas internally we need // to alter the tree for correct "use-on-symbol", "use-on-svg" support. // Build instance tree. Create root SVGElementInstance object for the first sub-tree node. // // Spec: If the 'use' element references a simple graphics element such as a 'rect', then there is only a // single SVGElementInstance object, and the correspondingElement attribute on this SVGElementInstance object // is the SVGRectElement that corresponds to the referenced 'rect' element. m_targetElementInstance = SVGElementInstance::create(this, this, target); // Eventually enter recursion to build SVGElementInstance objects for the sub-tree children bool foundProblem = false; buildInstanceTree(target, m_targetElementInstance.get(), foundProblem, false); if (instanceTreeIsLoading(m_targetElementInstance.get())) return; // SVG specification does not say a word about <use> & cycles. My view on this is: just ignore it! // Non-appearing <use> content is easier to debug, then half-appearing content. if (foundProblem) { clearResourceReferences(); return; } // Assure instance tree building was successfull ASSERT(m_targetElementInstance); ASSERT(!m_targetElementInstance->shadowTreeElement()); ASSERT(m_targetElementInstance->correspondingUseElement() == this); ASSERT(m_targetElementInstance->directUseElement() == this); ASSERT(m_targetElementInstance->correspondingElement() == target); ShadowRoot* shadowTreeRootElement = shadowRoot(); ASSERT(shadowTreeRootElement); // Build shadow tree from instance tree // This also handles the special cases: <use> on <symbol>, <use> on <svg>. buildShadowTree(target, m_targetElementInstance.get()); // Expand all <use> elements in the shadow tree. // Expand means: replace the actual <use> element by what it references. expandUseElementsInShadowTree(shadowTreeRootElement); // Expand all <symbol> elements in the shadow tree. // Expand means: replace the actual <symbol> element by the <svg> element. expandSymbolElementsInShadowTree(shadowTreeRootElement); // Now that the shadow tree is completly expanded, we can associate // shadow tree elements <-> instances in the instance tree. associateInstancesWithShadowTreeElements(shadowTreeRootElement->firstChild(), m_targetElementInstance.get()); // If no shadow tree element is present, this means that the reference root // element was removed, as it is disallowed (ie. <use> on <foreignObject>) // Do NOT leave an inconsistent instance tree around, instead destruct it. if (!m_targetElementInstance->shadowTreeElement()) { clearResourceReferences(); return; } ASSERT(m_targetElementInstance->shadowTreeElement()->parentNode() == shadowTreeRootElement); // Transfer event listeners assigned to the referenced element to our shadow tree elements. transferEventListenersToShadowTree(m_targetElementInstance.get()); // Update relative length information. updateRelativeLengthsInformation(); // Eventually dump instance tree #ifdef DUMP_INSTANCE_TREE String text; unsigned int depth = 0; dumpInstanceTree(depth, text, m_targetElementInstance.get()); fprintf(stderr, "\nDumping <use> instance tree:\n%s\n", text.latin1().data()); #endif // Eventually dump shadow tree #ifdef DUMP_SHADOW_TREE RefPtr<XMLSerializer> serializer = XMLSerializer::create(); String markup = serializer->serializeToString(shadowTreeRootElement, ASSERT_NO_EXCEPTION); fprintf(stderr, "Dumping <use> shadow tree markup:\n%s\n", markup.latin1().data()); #endif }
void SVGFEImageElement::removedFrom(ContainerNode* rootParent) { SVGFilterPrimitiveStandardAttributes::removedFrom(rootParent); if (rootParent->inDocument()) clearResourceReferences(); }
SVGFEImageElement::~SVGFEImageElement() { clearResourceReferences(); }
SVGUseElement::~SVGUseElement() { setCachedDocument(0); clearResourceReferences(); }
void SVGTextPathElement::removedFrom(ContainerNode& rootParent) { SVGTextContentElement::removedFrom(rootParent); if (rootParent.inDocument()) clearResourceReferences(); }
SVGMPathElement::~SVGMPathElement() { clearResourceReferences(); }
SVGUseElement::~SVGUseElement() { setDocumentResource(0); clearResourceReferences(); }