Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 87ba7d11a1e8aac065e906b3ef1d04999e812535
      
https://github.com/WebKit/WebKit/commit/87ba7d11a1e8aac065e906b3ef1d04999e812535
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-03-16 (Mon, 16 Mar 2026)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGGraphicsElement-padding-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGGraphicsElement.getScreenCTM-expected.txt
    M LayoutTests/svg/zoom/page/zoom-get-screen-ctm-expected.txt
    M LayoutTests/svg/zoom/page/zoom-get-screen-ctm.html
    A LayoutTests/svg/zoom/zoomed-inline-svg-getscreenctm-expected.txt
    A LayoutTests/svg/zoom/zoomed-inline-svg-getscreenctm.html
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGShape.cpp
    M Source/WebCore/svg/SVGSVGElement.cpp

  Log Message:
  -----------
  getScreenCTM() should include CSS transforms and zoom contributions in legacy 
SVG path
https://bugs.webkit.org/show_bug.cgi?id=308970
rdar://171525696

Reviewed by Brent Fulgham.

getScreenCTM() used localToAbsolute() which only returns a point,
discarding rotation/scale from CSS transforms on HTML ancestors.
It also divided by usedZoom() (page zoom × CSS zoom) instead of
just page zoom, incorrectly stripping CSS zoom from the result.

This patch:

1. Uses mapLocalToContainer() + TransformState to preserve the
full accumulated CSS transform matrix.

2. Divides only by page zoom (RenderView::pageZoomFactor()), keeping
CSS zoom contributions in the CTM.

3. Drops the viewBox translation subtraction, unnecessary since
mapLocalToContainer works in CSS box coordinates.

4. Adds legacyNonScalingStrokeCTM() for non-scaling-stroke, which
needs the SVG-internal-only CTM since legacy paint doesn't
include HTML ancestor CSS transforms.

Merge (Zoom Test): 
https://chromium.googlesource.com/chromium/src/+/7254890a169ba91d8ad6f61374cd93ec59029441

* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGShape.cpp:
(WebCore::legacyNonScalingStrokeCTM):
(WebCore::LegacyRenderSVGShape::nonScalingStrokeTransform const):
* Source/WebCore/svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::localCoordinateSpaceTransform const):
* 
LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGGraphicsElement-padding-expected.txt:
 Progressions
* 
LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGGraphicsElement.getScreenCTM-expected.txt:
 Ditto
* LayoutTests/svg/zoom/zoomed-inline-svg-getscreenctm-expected.txt: Added.
* LayoutTests/svg/zoom/zoomed-inline-svg-getscreenctm.html: Added.
* LayoutTests/svg/zoom/page/zoom-get-screen-ctm-expected.txt:
* LayoutTests/svg/zoom/page/zoom-get-screen-ctm.html: Synced from Blink - which 
has tolerance for any floating point conversions

Canonical link: https://commits.webkit.org/309354@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to