Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 14f17f50a0e8de21487094c5c395ba6acd655a3c
      
https://github.com/WebKit/WebKit/commit/14f17f50a0e8de21487094c5c395ba6acd655a3c
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-08-10 (Mon, 10 Aug 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-rotated-container-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-rotated-container-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-rotated-container.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-rotated-shape-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-rotated-shape-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-rotated-shape.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-scaled-shape-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-scaled-shape-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-scaled-shape.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-view-box-rotated-shape-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-view-box-rotated-shape-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-view-box-rotated-shape.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-view-box-scaled-shape-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-view-box-scaled-shape-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-view-box-scaled-shape.html
    M Source/WebCore/rendering/svg/SVGRenderSupport.cpp

  Log Message:
  -----------
  [Legacy SVG] CSS clip-path basic-shape is mispositioned on a rotated or 
scaled SVG element
https://bugs.webkit.org/show_bug.cgi?id=321424
rdar://184494108

Reviewed by Nikolas Zimmermann.

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

clipContextToCSSClippingArea() mapped the clip-path reference box out through
localToParentTransform(), built the basic shape there, then mapped the 
resulting path back through
the inverse. The context is already in the renderer's local coordinate system 
when this runs -- every
legacy paint path applies its own transform before calling 
prepareToRenderSVGContent() -- and
clipPathReferenceBox() returns a box in that same space, so the round trip is 
redundant. It is also
lossy: mapRect() returns the axis-aligned bounding box, so a 200x100 box 
rotated 90 degrees becomes
100x200 and inset(0 100px 0 0) collapses to an empty clip; and absolute lengths 
resolve at the
parent's scale, so under scale(2) that same inset trimmed 50 user units rather 
than 100.

227370@main added the round trip for clip-path on the <svg> root, where the 
context is in viewBox
coordinates while the clip is in CSS coordinates. 281893@main then moved root 
clip-path handling to
RenderLayer::setupClipPath() and stopped calling this function for 
LegacyRenderSVGRoot, leaving the
round trip with no case to serve.

Resolve the shape directly against the reference box, matching the adjacent box 
path and
isPointInCSSClippingArea(), which both already treat it as local. Chrome and 
Firefox agree with the
new tests, including the view-box cases, where the box is sized from the 
nearest viewport but
positioned in the element's own user space.

NOTE: This bug does not reproduce in Layer Based SVG Engine (LBSE).

Tests: 
imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-rotated-container-ref.html
       
imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-rotated-container.html
       
imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-rotated-shape-ref.html
       
imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-rotated-shape.html
       
imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-scaled-shape-ref.html
       
imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-scaled-shape.html
       
imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-view-box-rotated-shape-ref.html
       
imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-view-box-rotated-shape.html
       
imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-view-box-scaled-shape-ref.html
       
imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-view-box-scaled-shape.html

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-rotated-container-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-rotated-container-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-rotated-container.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-rotated-shape-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-rotated-shape-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-rotated-shape.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-scaled-shape-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-scaled-shape-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-scaled-shape.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-view-box-rotated-shape-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-view-box-rotated-shape-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-view-box-rotated-shape.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-view-box-scaled-shape-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-view-box-scaled-shape-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-shape-svg-view-box-scaled-shape.html:
 Added.
* Source/WebCore/rendering/svg/SVGRenderSupport.cpp:
(WebCore::SVGRenderSupport::clipContextToCSSClippingArea):

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



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

Reply via email to