SVG <use> should work without specifying a fragment identifier#64752
Merged
webkit-commit-queue merged 1 commit intoMay 20, 2026
Merged
Conversation
Collaborator
|
EWS run on previous version of this PR (hash d30849f) Details
|
Contributor
|
LGTM |
brentfulgham
approved these changes
May 18, 2026
Contributor
brentfulgham
left a comment
There was a problem hiding this comment.
Looks good, and Taher has reviewed the SVG bits. r=me
d30849f to
beba1b3
Compare
Collaborator
|
EWS run on current version of this PR (hash beba1b3) Details
|
Member
Author
|
failures are unrelated. |
https://bugs.webkit.org/show_bug.cgi?id=290983 rdar://148973201 Reviewed by Brent Fulgham. Per SVG 2: The 'use' element can reference an entire SVG document by specifying an 'href' value without a fragment. Such references are taken to be referring to the root element of the referenced document. — https://svgwg.org/svg2-draft/struct.html#UseElementHrefAttribute WebKit previously bailed out of `updateExternalDocument()` when the URL had no fragment identifier, so the external document was never fetched and the `<use>` rendered at 0x0. Fetch the document unconditionally and, when the caller supplies an external document and the URL has no fragment, resolve to the external document's root element. The new branch in `targetElementFromIRIString()` is gated on `externalDocument != nullptr`, so every non-<use> caller (markers, gradients, filters, patterns, textPath, SMIL, feImage, tref, …) keeps its exact current behaviour. * LayoutTests/TestExpectations: Remove the expectation; the WPT use-external-svg-resource-no-fragment-id.html passes with this patch. * LayoutTests/platform/gtk/svg/custom/use-extern-href-expected.png: Removed. * LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/use-extern-href-expected.txt: Removed. * LayoutTests/platform/mac-tahoe-wk2-pixel/svg/custom/use-extern-href-expected.png: Removed. * LayoutTests/platform/mac/svg/custom/use-extern-href-expected.png: Removed. * LayoutTests/svg/custom/use-extern-href-expected.txt: Rebaseline; the <use y="240" href="rgb.svg"/> now renders the external root per SVG 2. * LayoutTests/svg/custom/use-extern-href.svg: Update the comment to cite SVG 2's clarification. * Source/WebCore/svg/SVGURIReference.cpp: (WebCore::SVGURIReference::targetElementFromIRIString): * Source/WebCore/svg/SVGUseElement.cpp: (WebCore::SVGUseElement::updateExternalDocument): Canonical link: https://commits.webkit.org/313550@main
beba1b3 to
9ba5d25
Compare
Collaborator
|
Committed 313550@main (9ba5d25): https://commits.webkit.org/313550@main Reviewed commits have been landed. Closing PR #64752 and removing active labels. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
9ba5d25
beba1b3
🧪 ios-wk2-wpt🧪 api-mac-debug🧪 api-ios