Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 05449891110d798e44001fd9078b35eaf1491798
https://github.com/WebKit/WebKit/commit/05449891110d798e44001fd9078b35eaf1491798
Author: Nikolas Zimmermann <[email protected]>
Date: 2026-08-10 (Mon, 10 Aug 2026)
Changed paths:
A LayoutTests/svg/repaint/pending-fill-paint-server-repaint-expected.txt
A LayoutTests/svg/repaint/pending-fill-paint-server-repaint.html
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
M Source/WebCore/rendering/ReferencedSVGResources.cpp
M Source/WebCore/rendering/ReferencedSVGResources.h
M Source/WebCore/rendering/RenderLayerModelObject.cpp
M Source/WebCore/rendering/RenderLayerModelObject.h
M Source/WebCore/rendering/svg/RenderSVGInline.h
M Source/WebCore/rendering/svg/RenderSVGShape.h
M Source/WebCore/rendering/svg/RenderSVGText.h
A Source/WebCore/rendering/svg/SVGPaintServerCache.h
A Source/WebCore/rendering/svg/SVGPaintServerCacheInlines.h
Log Message:
-----------
[LBSE] Cache the SVG fill and stroke paint server on the renderer
https://bugs.webkit.org/show_bug.cgi?id=321404
Reviewed by Simon Fraser.
Resolving fill and stroke was cached on ReferencedSVGResources, which lives in
RenderElement's rare data, so every fill and every stroke paid the cost of a
rare data hash map lookup to reach the cache. Move the two cached weak pointers
into the new SVGPaintServerCache class, held by the renderers that paint fill
and stroke: RenderSVGShape, RenderSVGText and RenderSVGInline. They are reached
through a single new virtual, RenderLayerModelObject::svgPaintServerCache(),
which returns null for every other renderer.
Also fix a shape that references a paint server which does not exist yet. Once
an element finally takes that id, the shape keeps painting unfilled. The shape
registers itself as a pending resource under the full resolved URL, while both
readers look the id up bare, so the shape is neither registered as a client of
the new paint server nor repainted. Register the bare fragment identifier, in
the tree scope the readers use.
Covered by existing tests + a new reftest. Small win in LBSE Suits performance.
* LayoutTests/svg/repaint/pending-fill-paint-server-repaint-expected.txt: Added.
* LayoutTests/svg/repaint/pending-fill-paint-server-repaint.html: Added.
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/rendering/ReferencedSVGResources.cpp:
(WebCore::ReferencedSVGResources::cachedFillPaintServer const): Deleted.
(WebCore::ReferencedSVGResources::cachedStrokePaintServer const): Deleted.
(WebCore::ReferencedSVGResources::setCachedPaintServer): Deleted.
* Source/WebCore/rendering/ReferencedSVGResources.h:
(WebCore::ReferencedSVGResources::invalidatePaintServerCache): Deleted.
* Source/WebCore/rendering/RenderLayerModelObject.cpp:
(WebCore::RenderLayerModelObject::svgPaintServerResourceFromStyle const):
(WebCore::RenderLayerModelObject::invalidateSVGPaintServerCache const):
* Source/WebCore/rendering/RenderLayerModelObject.h:
(WebCore::RenderLayerModelObject::svgPaintServerCache const):
* Source/WebCore/rendering/svg/RenderSVGInline.h:
* Source/WebCore/rendering/svg/RenderSVGShape.h:
* Source/WebCore/rendering/svg/RenderSVGText.h:
* Source/WebCore/rendering/svg/SVGPaintServerCache.h: Added.
(WebCore::SVGPaintServerCache::clear):
* Source/WebCore/rendering/svg/SVGPaintServerCacheInlines.h: Added.
(WebCore::SVGPaintServerCache::paintServer const):
(WebCore::SVGPaintServerCache::setPaintServer):
Canonical link: https://commits.webkit.org/318882@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications