bool SVGSwitchElement::childShouldCreateRenderer(Node* child) const
{
    for (Node* n = firstChild(); n != 0; n = n->nextSibling()) {
        SVGElement* element = svg_dynamic_cast(n);
        if (element && element->isValid())
            return (n == child); // Only allow this child if it's the first valid child
    }

    return false;
}
bool SVGTests::handleAttributeChange(const SVGElement* targetElement, const QualifiedName& attrName)
{
    if (!isKnownAttribute(attrName))
        return false;
    if (!targetElement->inDocument())
        return false;
    SVGElement* svgElement = const_cast<SVGElement*>(targetElement);
    ASSERT(svgElement);
    bool valid = svgElement->isValid();
    if (valid && !svgElement->attached())
        svgElement->attach();
    if (!valid && svgElement->attached())
        svgElement->detach();
    return true;
}
Beispiel #3
0
bool SVGSwitchElement::childShouldCreateRenderer(const Node* child) const
{
    // FIXME: This function does not do what the comment below implies it does.
    // It will create a renderer for any valid SVG element children, not just the first one.
    for (Node* node = firstChild(); node; node = node->nextSibling()) {
        if (!node->isSVGElement())
            continue;

        SVGElement* element = toSVGElement(node);
        if (!element || !element->isValid())
            continue;

        return node == child; // Only allow this child if it's the first valid child
    }

    return false;
}