SVGAnimationElement::ShouldApplyAnimation SVGAnimationElement::shouldApplyAnimation(SVGElement* targetElement, const QualifiedName& attributeName)
{
    if (!hasValidAttributeType() || !targetElement || attributeName == anyQName() || !targetElement->inActiveDocument())
        return DontApplyAnimation;

    // Always animate CSS properties, using the ApplyCSSAnimation code path, regardless of the attributeType value.
    if (isTargetAttributeCSSProperty(targetElement, attributeName)) {
        if (targetElement->isPresentationAttributeWithSVGDOM(attributeName))
            return ApplyXMLandCSSAnimation;

        return ApplyCSSAnimation;
    }
    // If attributeType="CSS" and attributeName doesn't point to a CSS property, ignore the animation.
    if (attributeType() == AttributeTypeCSS)
        return DontApplyAnimation;

    return ApplyXMLAnimation;
}
void SVGAnimationElement::checkInvalidCSSAttributeType(SVGElement* target)
{
    m_hasInvalidCSSAttributeType = target && hasValidAttributeName() && attributeType() == AttributeTypeCSS && !isTargetAttributeCSSProperty(target, attributeName());
}
void SVGAnimationElement::checkInvalidCSSAttributeType()
{
    bool hasInvalidCSSAttributeType = targetElement() && hasValidAttributeName() && attributeType() == AttributeTypeCSS && !isTargetAttributeCSSProperty(targetElement(), attributeName());

    if (hasInvalidCSSAttributeType != m_hasInvalidCSSAttributeType) {
        if (hasInvalidCSSAttributeType)
            unscheduleIfScheduled();

        m_hasInvalidCSSAttributeType = hasInvalidCSSAttributeType;

        if (!hasInvalidCSSAttributeType)
            schedule();
    }

    // Clear values that may depend on the previous target.
    if (targetElement())
        clearAnimatedType();
}