Ejemplo n.º 1
0
bool LayoutSVGInline::isChildAllowed(LayoutObject* child,
                                     const ComputedStyle& style) const {
  if (child->isText())
    return SVGLayoutSupport::isLayoutableTextNode(child);

  if (isSVGAElement(*node())) {
    // Disallow direct descendant 'a'.
    if (isSVGAElement(*child->node()))
      return false;
  }

  if (!child->isSVGInline() && !child->isSVGInlineText())
    return false;

  return LayoutInline::isChildAllowed(child, style);
}
bool RenderSVGTransformableContainer::isChildAllowed(RenderObject* child, RenderStyle* style) const
{
    ASSERT(element());
    if (isSVGSwitchElement(*element())) {
        Node* node = child->node();
        // Reject non-SVG/non-valid elements.
        if (!node->isSVGElement() || !toSVGElement(node)->isValid())
            return false;
        // Reject this child if it isn't the first valid node.
        if (hasValidPredecessor(node))
            return false;
    } else if (isSVGAElement(*element())) {
        // http://www.w3.org/2003/01/REC-SVG11-20030114-errata#linking-text-environment
        // The 'a' element may contain any element that its parent may contain, except itself.
        if (isSVGAElement(*child->node()))
            return false;
        if (parent() && parent()->isSVG())
            return parent()->isChildAllowed(child, style);
    }
    return RenderSVGContainer::isChildAllowed(child, style);
}
Ejemplo n.º 3
0
bool SVGTSpanElement::rendererIsNeeded(const RenderStyle& style)
{
    if (parentNode()
        && (isSVGAElement(*parentNode())
#if ENABLE(SVG_FONTS)
            || isSVGAltGlyphElement(*parentNode())
#endif
            || isSVGTextElement(*parentNode())
            || isSVGTextPathElement(*parentNode())
            || isSVGTSpanElement(*parentNode())))
        return Element::rendererIsNeeded(style);

    return false;
}