Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f860040267ad9b46e9fec0023855c58ce2dbd981
      
https://github.com/WebKit/WebKit/commit/f860040267ad9b46e9fec0023855c58ce2dbd981
  Author: Nikolas Zimmermann <[email protected]>
  Date:   2026-08-18 (Tue, 18 Aug 2026)

  Changed paths:
    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-mask-01-b-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/absolute-root-position-masking-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/absolute-sized-content-with-resources-expected.png
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/absolute-sized-content-with-resources-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/empty-mask-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/grayscale-gradient-mask-2-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/grayscale-gradient-mask-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/js-late-mask-and-object-creation-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/js-late-mask-creation-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/mask-changes-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/mask-child-changes-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/mask-colorspace-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/mask-excessive-malloc-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/mask-invalidation-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/mask-on-multiple-objects-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/mask-with-all-units-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/mask-with-default-value-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/resource-invalidate-on-target-update-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/transformedMaskFails-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/repaint/text-mask-update-expected.txt
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/transforms/text-with-mask-with-svg-transform-expected.png
    M 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/transforms/text-with-mask-with-svg-transform-expected.txt
    A LayoutTests/svg/masking/mask-and-clip-path-on-shape-in-group-expected.html
    A LayoutTests/svg/masking/mask-and-clip-path-on-shape-in-group.html
    A LayoutTests/svg/masking/mask-on-shape-in-group-expected.html
    A LayoutTests/svg/masking/mask-on-shape-in-group.html
    A LayoutTests/svg/masking/mask-on-transformed-shape-in-group-expected.html
    A LayoutTests/svg/masking/mask-on-transformed-shape-in-group.html
    M Source/WebCore/rendering/ClipPathPaintScope.h
    M Source/WebCore/rendering/RenderElement.h
    M Source/WebCore/rendering/RenderElementStyleInlines.h
    M Source/WebCore/rendering/RenderLayerModelObject.cpp
    M Source/WebCore/rendering/RenderLayerSVGAdditions.cpp
    M Source/WebCore/rendering/svg/RenderSVGModelObject.cpp
    M Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp

  Log Message:
  -----------
  [LBSE] Don't create a RenderLayer for SVG mask
https://bugs.webkit.org/show_bug.cgi?id=321403

Reviewed by Simon Fraser.

A mask no longer forces a layer in LBSE. It is applied during paint through
SVGNonLayerClippingAndMaskingScope (renamed from SVGNonLayerClipPathScope), 
which now
covers both masking possibilites: it opens one transparency layer capturing
the renderer's foreground, and composites the mask and also handles clips
that cannot be a path.

The two are painted in the same order as the layer paint path, which runs
paintMaskForFragments before paintChildClippingMaskForFragments. The mask is
painted from the offset the foreground painted with, since a renderer positions
its mask from the paint offset the same way it positions its foreground.

A container with a mask still takes a layer, mirroring the clip-path rule: the
mask applies to its whole subtree, which is painted only by its own
paintChildrenInDOMOrderForSVG(), and without a layer its layered descendants
would be orphaned. A leaf has no descendants and stays layer-free.

The DOM-order paint cache treats a masked non-layer child as one unit so the
mask covers its whole subtree, and is rebuilt when the mask is added or removed.

Covered by existing tests and three new reftests.

* 
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-mask-01-b-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/absolute-root-position-masking-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/absolute-sized-content-with-resources-expected.png:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/absolute-sized-content-with-resources-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/empty-mask-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/grayscale-gradient-mask-2-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/grayscale-gradient-mask-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/js-late-mask-and-object-creation-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/js-late-mask-creation-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/mask-changes-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/mask-child-changes-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/mask-colorspace-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/mask-excessive-malloc-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/mask-invalidation-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/mask-on-multiple-objects-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/mask-with-all-units-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/mask-with-default-value-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/recursive-mask-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/transformedMaskFails-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/repaint/text-mask-update-expected.txt:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/transforms/text-with-mask-with-svg-transform-expected.png:
* 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/transforms/text-with-mask-with-svg-transform-expected.txt:
* LayoutTests/svg/masking/mask-and-clip-path-on-shape-in-group-expected.html: 
Added.
* LayoutTests/svg/masking/mask-and-clip-path-on-shape-in-group.html: Added.
* LayoutTests/svg/masking/mask-on-shape-in-group-expected.html: Added.
* LayoutTests/svg/masking/mask-on-shape-in-group.html: Added.
* LayoutTests/svg/masking/mask-on-transformed-shape-in-group-expected.html: 
Added.
* LayoutTests/svg/masking/mask-on-transformed-shape-in-group.html: Added.
* Source/WebCore/rendering/ClipPathPaintScope.h:
* Source/WebCore/rendering/RenderElement.h:
* Source/WebCore/rendering/RenderElementStyleInlines.h:
(WebCore::RenderElement::createsGroupForStyleExcludingClipPathAndMask):
(WebCore::RenderElement::createsGroupForStyle):
(WebCore::RenderElement::createsGroupForStyleExcludingClipPath): Deleted.
* Source/WebCore/rendering/RenderLayerModelObject.cpp:
(WebCore::RenderLayerModelObject::requiresLayerForSVGIntrinsicReasons const):
* Source/WebCore/rendering/RenderLayerSVGAdditions.cpp:
(WebCore::SVGNonLayerClippingAndMaskingScope::SVGNonLayerClippingAndMaskingScope):
(WebCore::SVGNonLayerClippingAndMaskingScope::~SVGNonLayerClippingAndMaskingScope):
(WebCore::SVGNonLayerClippingAndMaskingScope::paintPhase):
(WebCore::RenderLayer::appendChildrenInDOMOrderForSVG):
(WebCore::RenderLayer::paintChildrenInDOMOrderForSVG):
(WebCore::RenderLayer::paintRendererByApplyingTransformForSVG):
(WebCore::RenderLayer::paintSubtreeWithinTransformScopeForSVG):
(WebCore::SVGNonLayerClipPathScope::SVGNonLayerClipPathScope): Deleted.
(WebCore::SVGNonLayerClipPathScope::~SVGNonLayerClipPathScope): Deleted.
* Source/WebCore/rendering/svg/RenderSVGModelObject.cpp:
(WebCore::RenderSVGModelObject::requiresLayer const):
(WebCore::RenderSVGModelObject::styleDidChange):
* Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp:
(WebCore::RenderSVGResourceMasker::applyMask):

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



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

Reply via email to