Example #1
0
PassRefPtrWillBeRawPtr<CSSValue> SVGElement::getPresentationAttribute(const AtomicString& name)
{
    if (!hasAttributesWithoutUpdate())
        return nullptr;

    QualifiedName attributeName(nullAtom, name, nullAtom);
    const Attribute* attr = getAttributeItem(attributeName);
    if (!attr)
        return nullptr;

    RefPtr<MutableStylePropertySet> style = MutableStylePropertySet::create(SVGAttributeMode);
    CSSPropertyID propertyID = SVGElement::cssPropertyIdForSVGAttributeName(attr->name());
    style->setProperty(propertyID, attr->value());
    RefPtrWillBeRawPtr<CSSValue> cssValue = style->getPropertyCSSValue(propertyID);
    return cssValue ? cssValue->cloneForCSSOM() : nullptr;
}