Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: bda67bee92094a1ee81d8a9213930fed831b7196
https://github.com/WebKit/WebKit/commit/bda67bee92094a1ee81d8a9213930fed831b7196
Author: Nikolas Zimmermann <[email protected]>
Date: 2026-10-05 (Mon, 05 Oct 2026)
Changed paths:
M Source/WebCore/rendering/ClipPathPaintScope.cpp
M Source/WebCore/rendering/ClipPathPaintScope.h
M Source/WebCore/rendering/PaintInfo.h
M Source/WebCore/rendering/RenderLayerSVGAdditions.cpp
M Source/WebCore/rendering/TransformPaintScope.h
M Source/WebCore/rendering/svg/RenderSVGShape.cpp
Log Message:
-----------
[LBSE] Avoid redundant save/restore pairs when painting transformed SVG shapes
https://bugs.webkit.org/show_bug.cgi?id=326196
Reviewed by Rob Buis.
Painting a transformed non-layer SVG shape saves and restores the
GraphicsContext state up to three times. TransformPaintScope restores the
CTM with setCTM, ClipPathPaintScope wraps the clip-path in a save/restore
pair, and RenderSVGShape::paint adds another pair around the
fill/stroke/marker painting. The legacy engine uses a single save/restore
pair per shape - adapt LBSE to the same design.
With GPUP DOM rendering, each state changes correpondes to an IPC message.
On my M4, LBSE sent sent ~8.5 messages per shape on average vs. ~6.5 for
the legacy engine (after 319635@main, which specifically optimized avoiding
redundant save/restore pairs for gradients).
This patch removes the LBSE-specific pairs around the transform and clip-path
handling, bringing LBSE down to ~6.5 messages per shape as well, closing
the gap to the legacy engine again.
* Source/WebCore/rendering/ClipPathPaintScope.cpp:
(WebCore::ClipPathPaintScope::ClipPathPaintScope):
(WebCore::ClipPathPaintScope::saveContextStateIfNeeded):
(WebCore::ClipPathPaintScope::applyBasicShapeOrBoxClip):
(WebCore::ClipPathPaintScope::applySVGResourceClip):
(WebCore::ClipPathPaintScope::applyLegacySVGResourceClip):
* Source/WebCore/rendering/ClipPathPaintScope.h:
* Source/WebCore/rendering/PaintInfo.h:
* Source/WebCore/rendering/RenderLayerSVGAdditions.cpp:
(WebCore::SVGNonLayerClippingAndMaskingScope::SVGNonLayerClippingAndMaskingScope):
(WebCore::SVGNonLayerClippingAndMaskingScope::paintsIntoMaskLayer const):
(WebCore::RenderLayer::paintRendererByApplyingTransformForSVG):
* Source/WebCore/rendering/TransformPaintScope.h:
(WebCore::TransformPaintScope::TransformPaintScope):
(WebCore::TransformPaintScope::~TransformPaintScope):
* Source/WebCore/rendering/svg/RenderSVGShape.cpp:
(WebCore::RenderSVGShape::paint):
Canonical link: https://commits.webkit.org/322676@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications