Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: c2ced939fa425c189b0427f0acb5061b2627efac
https://github.com/WebKit/WebKit/commit/c2ced939fa425c189b0427f0acb5061b2627efac
Author: Taher Ali <[email protected]>
Date: 2026-07-14 (Tue, 14 Jul 2026)
Changed paths:
A LayoutTests/svg/paint-servers/external-paint-server-css-expected.html
A LayoutTests/svg/paint-servers/external-paint-server-css.html
A LayoutTests/svg/paint-servers/external-paint-server-gradient-expected.html
A LayoutTests/svg/paint-servers/external-paint-server-gradient.html
A LayoutTests/svg/paint-servers/external-paint-server-pattern-expected.html
A LayoutTests/svg/paint-servers/external-paint-server-pattern.html
A LayoutTests/svg/paint-servers/resources/paint-servers.svg
M Source/WTF/Scripts/GeneratePreferences.rb
M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
M Source/WebCore/Scripts/GenerateSettings.rb
M Source/WebCore/Sources.txt
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
M Source/WebCore/rendering/svg/legacy/SVGResources.cpp
M Source/WebCore/style/StylePendingResources.cpp
A Source/WebCore/svg/IsolatedSVGDocumentContext.cpp
A Source/WebCore/svg/IsolatedSVGDocumentContext.h
M Source/WebCore/svg/SVGDocumentExtensions.cpp
M Source/WebCore/svg/SVGDocumentExtensions.h
Log Message:
-----------
Introduce IsolatedSVGDocumentContext
https://bugs.webkit.org/show_bug.cgi?id=318229
rdar://181031373
Reviewed by Simon Fraser.
SVG paint servers referenced via data: or external URLs need to resolve a
gradient/pattern that lives in a different document. Unlike the frameless
document from CachedSVGDocument (used by <use> and filters, which only read
attributes), such a resource must be laid out before it can be referenced.
Introduce IsolatedSVGDocumentContext, a thin wrapper over the SVGImage
infrastructure.
The referenced SVG is fetched as a CachedImage and built into an SVGImage, which
already owns an isolated Page laid out.
Notes and follow-ups:
- Style::loadPendingResources fetches a non-local fill/stroke url() through the
loader layer, so external and data: references are handled uniformly and
CSP-checked. Going through the loader also means these documents are treated
as subresources and participate in the window.onload event.
- An IsolatedSVGDocumentContext's lifetime is currently scoped to the host
document.
Follow-up: move ownership onto the style value (as Style::FilterReference
does) so an unreferenced document is evicted once no element paints with it.
- The API surface is intentionally minimal, enough to serve paint servers in a
static form. Animated (SMIL) paint servers render a single frame: the isolated
timeline runs, but there is no cross-document invalidation to repaint the
host. Extending to animation/mutation is a follow-up.
* LayoutTests/svg/paint-servers/external-paint-server-css-expected.html: Added.
* LayoutTests/svg/paint-servers/external-paint-server-css.html: Added.
* LayoutTests/svg/paint-servers/external-paint-server-gradient-expected.html:
Added.
* LayoutTests/svg/paint-servers/external-paint-server-gradient.html: Added.
* LayoutTests/svg/paint-servers/external-paint-server-pattern-expected.html:
Added.
* LayoutTests/svg/paint-servers/external-paint-server-pattern.html: Added.
* LayoutTests/svg/paint-servers/resources/paint-servers.svg: Added.
* Source/WTF/Scripts/GeneratePreferences.rb:
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/Scripts/GenerateSettings.rb:
Treat "SVG" as an acronym so the generated accessor is svg...(), not sVG...().
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/rendering/svg/legacy/SVGResources.cpp:
(WebCore::paintingResourceFromTreeScopeAndId):
(WebCore::paintingResourceFromSVGPaint):
* Source/WebCore/style/StylePendingResources.cpp:
(WebCore::Style::loadPendingExternalSVGPaint):
(WebCore::Style::loadPendingResources):
* Source/WebCore/svg/IsolatedSVGDocumentContext.cpp: Added.
(WebCore::IsolatedSVGDocumentContext::create):
(WebCore::IsolatedSVGDocumentContext::IsolatedSVGDocumentContext):
(WebCore::IsolatedSVGDocumentContext::~IsolatedSVGDocumentContext):
(WebCore::IsolatedSVGDocumentContext::document const):
(WebCore::IsolatedSVGDocumentContext::imageChanged):
* Source/WebCore/svg/IsolatedSVGDocumentContext.h: Added.
* Source/WebCore/svg/SVGDocumentExtensions.cpp:
(WebCore::SVGDocumentExtensions::hasExternalSVGPaintResource const):
(WebCore::SVGDocumentExtensions::addExternalSVGPaintResource):
(WebCore::SVGDocumentExtensions::isolatedSVGPaintDocument const):
* Source/WebCore/svg/SVGDocumentExtensions.h:
Canonical link: https://commits.webkit.org/317199@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications