Bug 257906
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 |
Ahmad Saleem
Hi Team,
While going through WPT failure, came across another, where Safari / WebKit is odd one out.
WPT Test Link: https://wpt.fyi/results/svg/animations/scripted/animatetransform-type-missing-value-default.html?label=experimental&label=master&aligned
WPT Live Link: http://wpt.live/svg/animations/scripted/animatetransform-type-missing-value-default.html
_____
Blink Commit: https://chromium.googlesource.com/chromium/src.git/+/5351b4d9ef755bfde1e07f994197d6f7ef8317d4
____
Just wanted to raise so we can track this failure and fix it.
Thanks!
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Karl Dubost
https://searchfox.org/wubkat/source/Source/WebCore/svg/SVGAnimateTransformElement.cpp
Radar WebKit Bug Importer
<rdar://problem/110915695>
Ahmad Saleem
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.
Ahmad Saleem
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.
Ahmad Saleem
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.