bool SVGElement::rendererIsNeeded(const RenderStyle& style) { // http://www.w3.org/TR/SVG/extend.html#PrivateData // Prevent anything other than SVG renderers from appearing in our render tree // Spec: SVG allows inclusion of elements from foreign namespaces anywhere // with the SVG content. In general, the SVG user agent will include the unknown // elements in the DOM but will otherwise ignore unknown elements. if (!parentOrShadowHostElement() || parentOrShadowHostElement()->isSVGElement()) return Element::rendererIsNeeded(style); return false; }
void PseudoElement::dispose() { ASSERT(parentOrShadowHostElement()); InspectorInstrumentation::pseudoElementDestroyed(this); ASSERT(!nextSibling()); ASSERT(!previousSibling()); detach(); RefPtr<Element> parent = parentOrShadowHostElement(); setParentOrShadowHostNode(0); removedFrom(parent.get()); }
void PseudoElement::dispose() { DCHECK(parentOrShadowHostElement()); InspectorInstrumentation::pseudoElementDestroyed(this); DCHECK(!nextSibling()); DCHECK(!previousSibling()); detachLayoutTree(); Element* parent = parentOrShadowHostElement(); document().adoptIfNeeded(*this); setParentOrShadowHostNode(0); removedFrom(parent); }
SVGElement* SVGGraphicsElement::farthestViewportElement() const { SVGElement* farthest = 0; for (Element* current = parentOrShadowHostElement(); current; current = current->parentOrShadowHostElement()) { if (isViewportElement(*current)) farthest = toSVGElement(current); } return farthest; }
SVGElement* SVGGraphicsElement::nearestViewportElement() const { for (Element* current = parentOrShadowHostElement(); current; current = current->parentOrShadowHostElement()) { if (isViewportElement(*current)) return toSVGElement(current); } return nullptr; }
bool SVGElement::isOutermostSVGSVGElement() const { if (!isSVGSVGElement(*this)) return false; // Element may not be in the document, pretend we're outermost for viewport(), getCTM(), etc. if (!parentNode()) return true; // We act like an outermost SVG element, if we're a direct child of a <foreignObject> element. if (isSVGForeignObjectElement(*parentNode())) return true; // If we're living in a shadow tree, we're a <svg> element that got created as replacement // for a <symbol> element or a cloned <svg> element in the referenced tree. In that case // we're always an inner <svg> element. if (inUseShadowTree() && parentOrShadowHostElement() && parentOrShadowHostElement()->isSVGElement()) return false; // This is true whenever this is the outermost SVG, even if there are HTML elements outside it return !parentNode()->isSVGElement(); }
PassRefPtr<ComputedStyle> PseudoElement::customStyleForLayoutObject() { return parentOrShadowHostElement()->layoutObject()->getCachedPseudoStyle(m_pseudoId); }
PassRefPtr<RenderStyle> PseudoElement::customStyleForRenderer() { return parentOrShadowHostElement()->renderer()->getCachedPseudoStyle(m_pseudoId); }
bool SVGGElement::rendererIsNeeded(const RenderStyle&) { // Unlike SVGElement::rendererIsNeeded(), we still create renderers, even if // display is set to 'none' - which is special to SVG <g> container elements. return parentOrShadowHostElement() && parentOrShadowHostElement()->isSVGElement(); }