Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 16340664d2de48560add5591dbaf9fb29a1f4694
      
https://github.com/WebKit/WebKit/commit/16340664d2de48560add5591dbaf9fb29a1f4694
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-05-25 (Mon, 25 May 2026)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/hit-test/clip-path-element-objectboundingbox-002-expected.txt
    M Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGResourceClipper.cpp

  Log Message:
  -----------
  Hit-test of clip-path with nested objectBoundingBox <clipPath> uses wrong 
reference box
https://bugs.webkit.org/show_bug.cgi?id=315272
rdar://177605894

Reviewed by Simon Fraser.

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

When a <clipPath> referenced via clip-path itself carries a clip-path
attribute, hit-testing resolved the nested clipPath's objectBoundingBox
units against the inner <clipPath>'s own bounding box instead of the
original referencing element's. RenderSVGResourceClipper::hitTestClipContent
(and the legacy variant) reached the nested clipper through
pointInSVGClippingArea / SVGRenderSupport::pointInClippingArea, both of
which forward *this->objectBoundingBox() — which for a <clipPath> is the
union of its children's bboxes (e.g. (0,0,0.5,0.5) for a 0.5×0.5 rect),
not the target's box.

Painting already handles this correctly: applyMaskClipping recurses with
the original targetRenderer/objectBoundingBox. Mirror that in hit-testing
by calling the nested clipper's hitTestClipContent directly with the
caller-supplied objectBoundingBox, instead of relying on pointInSVGClippingArea.

NOTE: This fixes bug in both Legacy and Layer Based SVG engines.

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-masking/hit-test/clip-path-element-objectboundingbox-002-expected.txt:
 Progression
* Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp:
(WebCore::RenderSVGResourceClipper::hitTestClipContent):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGResourceClipper.cpp:
(WebCore::LegacyRenderSVGResourceClipper::hitTestClipContent):

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



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

Reply via email to