| Summary: | <animateTransform> broken with no type attribute | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Ahmad Saleem <ahmad.saleem792> |
| Component: | SVG | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW --- | ||
| Severity: | Normal | CC: | karlcow, sabouhallawa, webkit-bug-importer, zimmermann |
| Priority: | P2 | Keywords: | BrowserCompat, InRadar, WPTImpact |
| Version: | Safari Technology Preview | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
|
Description
Ahmad Saleem
2023-06-09 13:18:10 PDT
Changing this: https://searchfox.org/wubkat/source/Source/WebCore/svg/SVGAnimateTransformElement.cpp#36 from: , m_type(SVGTransformValue::SVG_TRANSFORM_UNKNOWN) to: , m_type(SVGTransformValue::SVG_TRANSFORM_TRANSLATE) _____ It progress one test. While we still fail last one, still looking into it. static SVGTransformValue parseTypeAttribute(const String& value)
{
if (value.isNull())
return SVGTransformValue::SVG_TRANSFORM_TRANSLATE;
auto transformType = SVGTransformable::parseTransformType(value);
// Since parseTransformType() is also used when parsing transform lists, it accepts the value
// "matrix". That value is however not recognized by the 'type' attribute, so treat it as invalid.
if (transformType == SVGTransformValue::SVG_TRANSFORM_MATRIX)
transformType = SVGTransformValue::SVG_TRANSFORM_UNKNOWN;
return transformType;
}
void SVGAnimateTransformElement::attributeChanged(const QualifiedName& name, const AtomString& oldValue, const AtomString& newValue, AttributeModificationReason attributeModificationReason)
{
if (name == SVGNames::typeAttr) {
auto oldTransformType = m_type;
m_type = SVGTransformable::parseTransformType(newValue);
if (m_type != oldTransformType)
animationAttributeChanged();
return;
}
SVGAnimateElementBase::attributeChanged(name, oldValue, newValue, attributeModificationReason);
}
___
Something like this but haven't tested or compiled locally.
static std::optional<SVGTransformValue::SVGTransformType> parseTypeAttribute(const String& value)
{
if (value.isNull())
return SVGTransformValue::SVG_TRANSFORM_TRANSLATE;
auto transformType = SVGTransformable::parseTransformType(value);
// Since parseTransformType() is also used when parsing transform lists, it accepts the value
// "matrix". That value is however not recognized by the 'type' attribute, so treat it as invalid.
if (transformType == SVGTransformValue::SVG_TRANSFORM_TRANSLATE)
transformType = SVGTransformValue::SVG_TRANSFORM_UNKNOWN;
return transformType;
}
void SVGAnimateTransformElement::attributeChanged(const QualifiedName& name, const AtomString& oldValue, const AtomString& newValue, AttributeModificationReason attributeModificationReason)
{
if (name == SVGNames::typeAttr) {
auto oldTransformType = m_type;
m_type = parseTypeAttribute(newValue);
if (m_type != oldTransformType)
animationAttributeChanged();
}
SVGAnimateElementBase::attributeChanged(name, oldValue, newValue, attributeModificationReason);
}
__
Get following error:
assigning to 'SVGTransformValue::SVGTransformType' from incompatible type
'std::optional<SVGTransformValue::SVGTransformType>'
m_type = parseTypeAttribute(newValue);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
|