void SVGAnimationElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
    if (!isSupportedAttribute(name)) {
        SVGSMILElement::parseAttribute(name, value);
        return;
    }

    if (name == SVGNames::valuesAttr) {
        // Per the SMIL specification, leading and trailing white space,
        // and white space before and after semicolon separators, is allowed and will be ignored.
        // http://www.w3.org/TR/SVG11/animate.html#ValuesAttribute
        value.string().split(';', m_values);
        for (unsigned i = 0; i < m_values.size(); ++i)
            m_values[i] = m_values[i].stripWhiteSpace();

        updateAnimationMode();
        return;
    }

    if (name == SVGNames::keyTimesAttr) {
        parseKeyTimes(value, m_keyTimes, true);
        return;
    }

    if (name == SVGNames::keyPointsAttr) {
        if (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(value, m_keyPoints, false);
        }
        return;
    }

    if (name == SVGNames::keySplinesAttr) {
        parseKeySplines(value, m_keySplines);
        return;
    }

    if (name == SVGNames::attributeTypeAttr) {
        setAttributeType(value);
        return;
    }

    if (name == SVGNames::calcModeAttr) {
        setCalcMode(value);
        return;
    }

    if (name == SVGNames::fromAttr || name == SVGNames::toAttr || name == SVGNames::byAttr) {
        updateAnimationMode();
        return;
    }

    if (SVGTests::parseAttribute(name, value))
        return;
    if (SVGExternalResourcesRequired::parseAttribute(name, value))
        return;

    ASSERT_NOT_REACHED();
}
void SVGAnimationElement::parseAttribute(const QualifiedName& name, const AtomicString& oldValue, const AtomicString& value)
{
    if (name == SVGNames::valuesAttr) {
        if (!parseValues(value, m_values)) {
            reportAttributeParsingError(ParsingAttributeFailedError, name, value);
            return;
        }
        updateAnimationMode();
        return;
    }

    if (name == SVGNames::keyTimesAttr) {
        if (!parseKeyTimes(value, m_keyTimes, true))
            reportAttributeParsingError(ParsingAttributeFailedError, name, value);
        return;
    }

    if (name == SVGNames::keyPointsAttr) {
        if (isSVGAnimateMotionElement(*this)) {
            // This is specified to be an animateMotion attribute only but it is simpler to put it here
            // where the other timing calculatations are.
            if (!parseKeyTimes(value, m_keyPoints, false))
                reportAttributeParsingError(ParsingAttributeFailedError, name, value);
        }
        return;
    }

    if (name == SVGNames::keySplinesAttr) {
        if (!parseKeySplines(value, m_keySplines))
            reportAttributeParsingError(ParsingAttributeFailedError, name, value);
        return;
    }

    if (name == SVGNames::attributeTypeAttr) {
        setAttributeType(value);
        return;
    }

    if (name == SVGNames::calcModeAttr) {
        setCalcMode(value);
        return;
    }

    if (name == SVGNames::fromAttr || name == SVGNames::toAttr || name == SVGNames::byAttr) {
        updateAnimationMode();
        return;
    }

    SVGSMILElement::parseAttribute(name, oldValue, value);
}
Ejemplo n.º 3
0
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);
    }
}