Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 5338a02f6f6e5d75321ad40cd2d62557f0ec07a5
https://github.com/WebKit/WebKit/commit/5338a02f6f6e5d75321ad40cd2d62557f0ec07a5
Author: Nikolas Zimmermann <[email protected]>
Date: 2026-08-01 (Sat, 01 Aug 2026)
Changed paths:
M
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/W3C-SVG-1.1/masking-intro-01-f-expected.png
M
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/W3C-SVG-1.1/masking-intro-01-f-expected.txt
M
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/W3C-SVG-1.1/masking-path-01-b-expected.txt
M
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/W3C-SVG-1.1/masking-path-02-b-expected.txt
M
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/W3C-SVG-1.1/masking-path-04-b-expected.txt
M
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/W3C-SVG-1.1/masking-path-05-f-expected.txt
M
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/batik/paints/patternPreserveAspectRatioA-expected.txt
M
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/batik/paints/patternRegionA-expected.txt
M
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/batik/text/textEffect2-expected.png
M
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/batik/text/textEffect2-expected.txt
M
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/batik/text/textProperties-expected.txt
M
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/focus-ring-expected.txt
M
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/js-late-clipPath-and-object-creation-expected.txt
M
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/js-late-clipPath-creation-expected.txt
M
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/pattern-referencing-preserve-aspect-ratio-expected.txt
M
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/recursive-mask-expected.txt
M
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/recursive-pattern-expected.txt
M
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/resource-invalidate-on-target-update-expected.txt
M
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/text-clip-expected.txt
M
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/transformedMaskFails-expected.txt
M
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/use-clipped-transform-expected.txt
M
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/use-on-clip-path-with-transformation-expected.txt
M
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/use-on-symbol-inside-pattern-expected.txt
M
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/transforms/svg-css-transforms-clip-path-expected.txt
A LayoutTests/svg/clip-path/clip-path-shape-circle-in-group-expected.html
A LayoutTests/svg/clip-path/clip-path-shape-circle-in-group.html
A LayoutTests/svg/clip-path/clip-path-shape-inset-in-group-expected.html
A LayoutTests/svg/clip-path/clip-path-shape-inset-in-group.html
A LayoutTests/svg/clip-path/clip-path-shape-polygon-in-group-expected.html
A LayoutTests/svg/clip-path/clip-path-shape-polygon-in-group.html
M Source/WebCore/Sources.txt
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
A Source/WebCore/rendering/ClipPathPaintScope.cpp
A Source/WebCore/rendering/ClipPathPaintScope.h
M Source/WebCore/rendering/ReferencedSVGResources.cpp
M Source/WebCore/rendering/RenderElement.h
M Source/WebCore/rendering/RenderElementStyleInlines.h
M Source/WebCore/rendering/RenderLayer.cpp
M Source/WebCore/rendering/RenderLayer.h
M Source/WebCore/rendering/RenderLayerBacking.cpp
M Source/WebCore/rendering/RenderLayerModelObject.cpp
M Source/WebCore/rendering/RenderLayerSVGAdditions.cpp
M Source/WebCore/rendering/svg/RenderSVGModelObject.cpp
M Source/WebCore/rendering/svg/RenderSVGModelObject.h
M Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp
M Source/WebCore/rendering/svg/RenderSVGResourceClipper.h
M Source/WebCore/rendering/svg/RenderSVGResourceClipperInlines.h
M Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp
M Source/WebCore/rendering/svg/RenderSVGResourceContainer.h
M Source/WebCore/svg/SVGElement.cpp
M Source/WebCore/svg/SVGElement.h
Log Message:
-----------
[LBSE] Don't create a RenderLayer for SVG clip-path
https://bugs.webkit.org/show_bug.cgi?id=318130
Reviewed by Simon Fraser.
A bare clip-path no longer forces a layer in LBSE. The clip is applied during
paint through a shared ClipPathPaintScope, an RAII scope that owns the
graphics-state and region savers and sets the clip up in its constructor. It
handles CSS basic-shape and box clip-paths as well as SVG clipper resources, so
it serves both regular CSS boxes and SVG content. Both paint paths use it: the
layer-driven path via RenderLayer::setupClipPath(), and the LBSE non-layer path
via SVGNonLayerClipPathScope wrapped around the three non-layer paint paths,
which adds a transparency-layer fallback for clips that need a mask instead of
a path. Clip geometry for SVG content below the SVG root is not device-pixel
snapped, matching the rest of LBSE SVG painting.
A container with a clip-path still takes a layer so its layered descendants are
not orphaned, and the DOM-order paint cache is rebuilt when clip-path is
toggled.
Grouping effects (opacity, filter, blend, 3D) keep their layer even inside a
resource container, so mask and pattern content still renders correctly.
RenderSVGResourceClipper caches the path-vs-mask decision and flushes it from
repaintAllClients(), so changes to the clip children or a use target invalidate
it. applyMaskClipping() no longer requires the target to have a layer, since
non-layer targets now reach it.
A bare clip-path no longer takes a layer, so a clipped shape no longer keeps the
layer's stored repaint rect from the previous cycle, and it gets no post-layout
position update to repaint its old and new bounds. Instead
CSSSVGResourceElementClient::resourceChanged() captures the client's old repaint
rects from its cached visual overflow (kept current at the end of the client's
own
layout) before invalidating that cache, then repaints the union of the old and
new
bounds. This mirrors the old-and-new-boundary repaint layered clients get from
their position update, so the affected region (e.g. a shrinking clip) is
repainted.
Covered by existing tests and a few new reftests.
*
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/W3C-SVG-1.1/masking-intro-01-f-expected.png:
*
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/W3C-SVG-1.1/masking-intro-01-f-expected.txt:
*
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/W3C-SVG-1.1/masking-path-01-b-expected.txt:
*
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/W3C-SVG-1.1/masking-path-02-b-expected.txt:
*
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/W3C-SVG-1.1/masking-path-04-b-expected.txt:
*
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/W3C-SVG-1.1/masking-path-05-f-expected.txt:
*
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/batik/paints/patternPreserveAspectRatioA-expected.txt:
*
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/batik/paints/patternRegionA-expected.txt:
*
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/batik/text/textEffect2-expected.png:
*
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/batik/text/textEffect2-expected.txt:
*
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/batik/text/textProperties-expected.txt:
*
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/focus-ring-expected.txt:
*
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/js-late-clipPath-and-object-creation-expected.txt:
*
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/js-late-clipPath-creation-expected.txt:
*
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/pattern-referencing-preserve-aspect-ratio-expected.txt:
*
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/recursive-mask-expected.txt:
*
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/recursive-pattern-expected.txt:
*
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/resource-invalidate-on-target-update-expected.txt:
*
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/text-clip-expected.txt:
*
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/transformedMaskFails-expected.txt:
*
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/use-clipped-transform-expected.txt:
*
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/use-on-clip-path-with-transformation-expected.txt:
*
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/use-on-symbol-inside-pattern-expected.txt:
*
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/transforms/svg-css-transforms-clip-path-expected.txt:
* LayoutTests/svg/clip-path/clip-path-shape-circle-in-group-expected.html:
Added.
* LayoutTests/svg/clip-path/clip-path-shape-circle-in-group.html: Added.
* LayoutTests/svg/clip-path/clip-path-shape-inset-in-group-expected.html: Added.
* LayoutTests/svg/clip-path/clip-path-shape-inset-in-group.html: Added.
* LayoutTests/svg/clip-path/clip-path-shape-polygon-in-group-expected.html:
Added.
* LayoutTests/svg/clip-path/clip-path-shape-polygon-in-group.html: Added.
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/rendering/ClipPathPaintScope.cpp: Added.
(WebCore::ClipPathPaintScope::ClipPathPaintScope):
(WebCore::ClipPathPaintScope::referenceBoxRectForClipPath):
(WebCore::ClipPathPaintScope::computeClipPath):
(WebCore::ClipPathPaintScope::applyBasicShapeOrBoxClip):
(WebCore::ClipPathPaintScope::applySVGResourceClip):
(WebCore::ClipPathPaintScope::applyLegacySVGResourceClip):
* Source/WebCore/rendering/ClipPathPaintScope.h: Added.
(WebCore::ClipPathPaintScope::needsMaskClipping const):
* Source/WebCore/rendering/ReferencedSVGResources.cpp:
(WebCore::CSSSVGResourceElementClient::resourceChanged):
* Source/WebCore/rendering/RenderElement.h:
* Source/WebCore/rendering/RenderElementStyleInlines.h:
(WebCore::RenderElement::createsGroupForStyleExcludingClipPath):
(WebCore::RenderElement::createsGroupForStyle):
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::setupClipPath):
(WebCore::RenderLayer::paintLayerContents):
(WebCore::RenderLayer::referenceBoxRectForClipPath const): Deleted.
(WebCore::RenderLayer::computeClipPath const): Deleted.
* Source/WebCore/rendering/RenderLayer.h:
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateMaskingLayerGeometry):
* Source/WebCore/rendering/RenderLayerModelObject.cpp:
(WebCore::RenderLayerModelObject::requiresLayerForSVGIntrinsicReasons const):
* Source/WebCore/rendering/RenderLayerSVGAdditions.cpp:
(WebCore::SVGNonLayerClipPathScope::SVGNonLayerClipPathScope):
(WebCore::SVGNonLayerClipPathScope::~SVGNonLayerClipPathScope):
(WebCore::RenderLayer::appendChildrenInDOMOrderForSVG):
(WebCore::RenderLayer::paintChildrenInDOMOrderForSVG):
(WebCore::RenderLayer::paintRendererByApplyingTransformForSVG):
(WebCore::RenderLayer::paintSubtreeWithinTransformScopeForSVG):
* Source/WebCore/rendering/svg/RenderSVGModelObject.cpp:
(WebCore::RenderSVGModelObject::requiresLayer const):
(WebCore::RenderSVGModelObject::isInsideSVGResourceContainer const):
(WebCore::RenderSVGModelObject::styleDidChange):
* Source/WebCore/rendering/svg/RenderSVGModelObject.h:
* Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp:
(WebCore::RenderSVGResourceClipper::shouldApplyPathClipping const):
(WebCore::RenderSVGResourceClipper::repaintAllClients const):
(WebCore::RenderSVGResourceClipper::applyPathClipping):
(WebCore::RenderSVGResourceClipper::applyMaskClipping):
* Source/WebCore/rendering/svg/RenderSVGResourceClipper.h:
* Source/WebCore/rendering/svg/RenderSVGResourceClipperInlines.h:
* Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp:
(WebCore::RenderSVGResourceContainer::RenderSVGResourceContainer):
* Source/WebCore/rendering/svg/RenderSVGResourceContainer.h:
* Source/WebCore/svg/SVGElement.cpp:
(WebCore::SVGElement::removingSteps):
(WebCore::SVGElement::insertionSteps):
(WebCore::SVGElement::isResourceContainerTagName):
(WebCore::SVGElement::isInSVGResourceContainer const):
* Source/WebCore/svg/SVGElement.h:
Canonical link: https://commits.webkit.org/318375@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications