[Webkit-unassigned] [Bug 267401] Explore the 'serialization' issue in getAttribute('transform')
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Jan 29 19:12:40 PST 2024
https://bugs.webkit.org/show_bug.cgi?id=267401
--- Comment #4 from Karl Dubost <karlcow at apple.com> ---
@Brent
in Bug 264752, Ahmad fixed part of the serialization.
The changes are in
https://github.com/WebKit/WebKit/pull/22475/files
The test code though should be a WPT test, instead of something Apple only.
The test is this:
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')
Before Bug 264752:
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
After Bug 264752 (Tested in minibrowser ToT of today):
IN OUT
Safari: scale(-2, -4) scale(-2 -4). No comma, negative numbers
So Ahmad fixed the part, where the values were transformed as positive numbers!
Now there is the difference in between Firefox and Chrome.
With Ahmad's modification, Safari returns like Chrome.
The spec says:
https://drafts.csswg.org/css-transforms/#funcdef-transform-scale
scale() = scale( <number> , <number>? )
specifies a 2D scale operation by the [sx,sy] scaling vector described by the 2 parameters. If the second parameter is not provided, it takes a value equal to the first. For example, scale(1, 1) would leave an element unchanged, while scale(2, 2) would cause it to appear twice as long in both the X and Y axes, or four times its typical geometric size.
Note the comma, there is nothing which says it should be serialized without a comma.
So I think there is a bug in both Chrome and Safari, that needs to be fixed.
And fwiw,
setTranslate() has the same issue
So my initial comment is the parsing is correct, but the serialization is wrong when doing getAttribute('transform').
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240130/4530fe3f/attachment.htm>
More information about the webkit-unassigned
mailing list