Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 584db591a774cd41fb0b8e8c89c1d4244ced8094
https://github.com/WebKit/WebKit/commit/584db591a774cd41fb0b8e8c89c1d4244ced8094
Author: Ahmad Saleem <[email protected]>
Date: 2026-05-12 (Tue, 12 May 2026)
Changed paths:
A LayoutTests/svg/dom/getScreenCTM-ancestor-transform-expected.txt
A LayoutTests/svg/dom/getScreenCTM-ancestor-transform.html
M Source/WebCore/svg/SVGSVGElement.cpp
Log Message:
-----------
[LegacySVG] getScreenCTM() returns incorrect result when document is scrolled
under a CSS-transformed ancestor
https://bugs.webkit.org/show_bug.cgi?id=314578
rdar://176814876
Reviewed by Brent Fulgham.
Per spec [1], getScreenCTM() must include the transforms from the
outermost <svg>'s CSS box up through every ancestor box to the initial
containing block.
The legacy outermost-<svg> path in localCoordinateSpaceTransform()
applied the scroll offset via transform.translate(-scrollPosition), which
post-multiplies it into the SVG's local space. Any non-trivial ancestor
CSS transform (rotate/scale) then rotates or scales that scroll vector,
so getScreenCTM() returns the wrong e/f when the page is scrolled under
such an ancestor.
Subtract the scroll offset from the output e/f components directly so it
is applied in screen space, after the ancestor transforms.
NOTE: This bug only exists in the Legacy SVG engine.
[1]
https://w3c.github.io/svgwg/svg2-draft/types.html#__svg__SVGGraphicsElement__getScreenCTM
Merge (Test only):
https://chromium.googlesource.com/chromium/src.git/+/2ad2a9bf7205ec77843cf27a7964fda92df386b2
Test: svg/dom/getScreenCTM-ancestor-transform.html
* Source/WebCore/svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::localCoordinateSpaceTransform const):
* LayoutTests/svg/dom/getScreenCTM-ancestor-transform-expected.txt: Added.
* LayoutTests/svg/dom/getScreenCTM-ancestor-transform.html: Added.
Canonical link: https://commits.webkit.org/313111@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications