| Summary: | Negative SVGTransform scale values should be correctly stringified | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Ahmad Saleem <ahmad.saleem792> |
| Component: | SVG | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | karlcow, sabouhallawa, webkit-bug-importer, zimmermann |
| Priority: | P2 | Keywords: | BrowserCompat, InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=267401 | ||
|
Description
Ahmad Saleem
2023-11-13 10:03:53 PST
There are potentially two different issues
* negative to positive number
* serialization with/without comma
as the 3 browsers return something different.
IN OUT
Safari: scale(-2, -4) scale(2 4). No comma, positive numbers
Firefox: scale(-2, -4) scale(-2, -4) Comma, negative numbers
Chrome: scale(-2, -4) scale(-2 -4) No comma, negative numbers
I have the feeling that Firefox is right here for the comma.
https://drafts.csswg.org/css-transforms/#funcdef-transform-scale
I didn't find a reference why it should be serialize differently, aka without the comma.
But WebKit definitely needs to return negative numbers.
The test:
var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
var g = document.createElementNS('http://www.w3.org/2000/svg', 'g');
var transform = svg.createSVGTransform();
transform.setScale(-2, -4);
g.transform.baseVal.appendItem(transform)
g.getAttribute('transform')
We need to update this: https://searchfox.org/wubkat/rev/c22ca98693565713efde37e8311190dd00e165ef/Source/WebCore/svg/SVGTransformValue.h#267 void appendScale(StringBuilder& builder) const { appendFixedPrecisionNumbers(builder, m_matrix->value().xScale(), m_matrix->value().yScale()); } TO: void appendScale(StringBuilder& builder) const { appendFixedPrecisionNumbers(builder, m_matrix->a(), m_matrix->d()); } __ Compiles and make us pass but match 'Chrome'. As for ',' issue highlighted in Comment 02. I think it might be 'Parser' issue? I am happy to fix this and then have separate bug to discuss ',' issue. Draft PR - https://github.com/WebKit/WebKit/pull/22475 To see if it fails anything else on EWS. :-) Committed 272885@main (2efdea0ba354): <https://commits.webkit.org/272885@main> Reviewed commits have been landed. Closing PR #22475 and removing active labels. |