コード例 #1
0
bool SVGElement::isOutermostSVGSVGElement() const
{
    if (!hasTagName(SVGNames::svgTag))
        return false;

    // 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 (isInShadowTree() && parentOrShadowHostElement() && parentOrShadowHostElement()->isSVGElement())
        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 (parentNode()->hasTagName(SVGNames::foreignObjectTag))
        return true;

    // This is true whenever this is the outermost SVG, even if there are HTML elements outside it
    return !parentNode()->isSVGElement();
}
コード例 #2
0
ファイル: SVGAnimationElement.cpp プロジェクト: KDE/khtml
void SVGAnimationElement::parseMappedAttribute(MappedAttribute *attr)
{
    if (attr->name() == SVGNames::valuesAttr) {
        attr->value().string().split(';', m_values);
    } else if (attr->name() == SVGNames::keyTimesAttr) {
        parseKeyTimes(attr->value(), m_keyTimes, true);
    } else if (attr->name() == SVGNames::keyPointsAttr && hasTagName(SVGNames::animateMotionTag)) {
        // This is specified to be an animateMotion attribute only but it is simpler to put it here
        // where the other timing calculatations are.
        parseKeyTimes(attr->value(), m_keyPoints, false);
    } else if (attr->name() == SVGNames::keySplinesAttr) {
        parseKeySplines(attr->value(), m_keySplines);
    } else {
        if (SVGTests::parseMappedAttribute(attr)) {
            return;
        }
        if (SVGExternalResourcesRequired::parseMappedAttribute(attr)) {
            return;
        }
        SVGSMILElement::parseMappedAttribute(attr);
    }
}