Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 46269d2e53cdb264c66524bda9ae5003fdf56ca8
      
https://github.com/WebKit/WebKit/commit/46269d2e53cdb264c66524bda9ae5003fdf56ca8
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-06-01 (Mon, 01 Jun 2026)

  Changed paths:
    A 
LayoutTests/svg/custom/non-scaling-stroke-zero-length-subpath-linecaps-expected.html
    A 
LayoutTests/svg/custom/non-scaling-stroke-zero-length-subpath-linecaps.html
    M Source/WebCore/rendering/svg/RenderSVGPath.cpp
    M Source/WebCore/rendering/svg/RenderSVGPath.h
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGPath.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGPath.h

  Log Message:
  -----------
  Apply vector-effect transform to path geometry - not stroke geometry
https://bugs.webkit.org/show_bug.cgi?id=249265
rdar://103573160

Reviewed by Simon Fraser.

This patch aligns WebKit with Gecko / Firefox and Blink / Chromium.

Merge (Test) & Inspired by: 
https://chromium.googlesource.com/chromium/blink/+/dd578478d0d2affea98eb5cf59f9f6f525cfd890

When drawing line caps for zero-length subpaths, the path-derived
geometry is the position of the linecap, and not the generated shape.
Hence the non-scaling-stroke transform should be applied to the position
where the line cap shape should be drawn, and not the shape itself.
Previously the transform was applied to the whole cap shape, so a
non-uniform transform (e.g. scale(2,1)) would distort the cap itself -
turning a round cap into an ellipse and a square cap into a rectangle -
which is exactly what vector-effect: non-scaling-stroke should prevent.

This also lets us simplify the code by calling fillRect/fillEllipse
directly instead of going through a temporary Path object, so the
zeroLengthLinecapPath() helper is removed.

NOTE: This patch fixes the bug in both Legacy and Layer based SVG engine.

* Source/WebCore/rendering/svg/RenderSVGPath.cpp:
(WebCore::RenderSVGPath::strokeZeroLengthSubpaths const):
(WebCore::RenderSVGPath::zeroLengthLinecapPath const): Deleted.
* Source/WebCore/rendering/svg/RenderSVGPath.h:
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGPath.cpp:
(WebCore::LegacyRenderSVGPath::strokeZeroLengthSubpaths const):
(WebCore::LegacyRenderSVGPath::zeroLengthLinecapPath const): Deleted.
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGPath.h:
* 
LayoutTests/svg/custom/non-scaling-stroke-zero-length-subpath-linecaps-expected.html:
 Added.
* LayoutTests/svg/custom/non-scaling-stroke-zero-length-subpath-linecaps.html: 
Added.

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



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

Reply via email to