Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ccba346ddcc57b22c5a34f3cb45215b934e34c41
      
https://github.com/WebKit/WebKit/commit/ccba346ddcc57b22c5a34f3cb45215b934e34c41
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-01-09 (Fri, 09 Jan 2026)

  Changed paths:
    A 
LayoutTests/svg/clip-path/visible-clip-path-as-hidden-use-element-expected.html
    A LayoutTests/svg/clip-path/visible-clip-path-as-hidden-use-element.html
    A 
LayoutTests/svg/clip-path/visible-nested-clip-path-as-hidden-use-element-expected.html
    A 
LayoutTests/svg/clip-path/visible-nested-clip-path-as-hidden-use-element.html
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGResourceClipper.cpp
    M Source/WebCore/svg/SVGClipPathElement.cpp
    M Source/WebCore/svg/SVGUseElement.cpp
    M Source/WebCore/svg/SVGUseElement.h

  Log Message:
  -----------
  Fix clipping when <use> element in <clipPath> has visibility:hidden but 
references visible content
https://bugs.webkit.org/show_bug.cgi?id=304896
rdar://167491519

Reviewed by Nikolas Zimmermann and Brent Fulgham.

This patch aligns WebKit with Gecko / Firefox and Blink / Chromium. 
Additionally,
it fixes the bug in both LegacySVG and Layer Based SVG engine (LBSE).

Merge: 
https://chromium.googlesource.com/chromium/src/+/53cbed151cea16f4d27cc887a272d9e672c41b75

When a <use> element inside a <clipPath> has visibility:hidden, but the element
it references has visibility:visible, the clipping should still be applied based
on the referenced element's visibility, not the <use> element's visibility.

Previously, WebKit incorrectly checked the <use> element's own visibility state,
causing valid clips to be ignored. Now we correctly look through to the 
referenced
element to determine if clipping should be applied

And remove reportError() to print error info for <clipPath> usage on 
SVGUseElement.

* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGResourceClipper.cpp:
(WebCore::LegacyRenderSVGResourceClipper::pathOnlyClipping):
(WebCore::LegacyRenderSVGResourceClipper::drawContentIntoMaskImage):
(WebCore::LegacyRenderSVGResourceClipper::calculateClipContentRepaintRect):
* Source/WebCore/svg/SVGClipPathElement.cpp:
(WebCore::SVGClipPathElement::shouldApplyPathClipping const):
(WebCore::SVGClipPathElement::calculateClipContentRepaintRect):
* Source/WebCore/svg/SVGUseElement.cpp:
(WebCore::SVGUseElement::visibleTargetGraphicsElementForClipping const):
(WebCore::SVGUseElement::toClipPath):
* Source/WebCore/svg/SVGUseElement.h:
* 
LayoutTests/svg/clip-path/visible-clip-path-as-hidden-use-element-expected.html:
 Added.
* LayoutTests/svg/clip-path/visible-clip-path-as-hidden-use-element.html: Added.
* 
LayoutTests/svg/clip-path/visible-nested-clip-path-as-hidden-use-element-expected.html:
 Added.
* 
LayoutTests/svg/clip-path/visible-nested-clip-path-as-hidden-use-element.html: 
Added.

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



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

Reply via email to