SVGElementAnimatedPropertyList SVGAnimatedTypeAnimator::findAnimatedPropertiesForAttributeName(SVGElement& targetElement, const QualifiedName& attributeName)
{
    SVGElementAnimatedPropertyList result;

    if (!SVGAnimatedType::supportsAnimVal(m_type))
        return result;

    auto& propertyMap = targetElement.localAttributeToPropertyMap();
    auto targetProperties = propertyMap.properties(targetElement, attributeName);

    if (targetProperties.isEmpty())
        return result;

    result.append(SVGElementAnimatedProperties { &targetElement, WTF::move(targetProperties) });

    for (SVGElement* instance : targetElement.instances())
        result.append(SVGElementAnimatedProperties { instance, propertyMap.properties(*instance, attributeName) });

#if !ASSERT_DISABLED
    for (auto& animatedProperties : result) {
        for (auto& property : animatedProperties.properties) {
            if (property->animatedPropertyType() != m_type) {
                ASSERT(m_type == AnimatedAngle);
                ASSERT(property->animatedPropertyType() == AnimatedEnumeration);
            }
        }
    }
#endif

    return result;
}
Example #2
0
void SVGElement::synchronizeAnimatedSVGAttribute(const QualifiedName& name) const
{
    if (!elementData() || !elementData()->animatedSVGAttributesAreDirty())
        return;

    SVGElement* nonConstThis = const_cast<SVGElement*>(this);
    if (name == anyQName())
        synchronizeAllAnimatedSVGAttribute(nonConstThis);
    else
        nonConstThis->localAttributeToPropertyMap().synchronizeProperty(*nonConstThis, name);
}