Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9ba5d25ffcf1387456e70a8d4b9d95400c512d1c
      
https://github.com/WebKit/WebKit/commit/9ba5d25ffcf1387456e70a8d4b9d95400c512d1c
  Author: Karl Dubost <[email protected]>
  Date:   2026-05-19 (Tue, 19 May 2026)

  Changed paths:
    M LayoutTests/TestExpectations
    R LayoutTests/platform/gtk/svg/custom/use-extern-href-expected.png
    R 
LayoutTests/platform/mac-tahoe-wk2-lbse-text/svg/custom/use-extern-href-expected.txt
    R 
LayoutTests/platform/mac-tahoe-wk2-pixel/svg/custom/use-extern-href-expected.png
    R LayoutTests/platform/mac/svg/custom/use-extern-href-expected.png
    M LayoutTests/svg/custom/use-extern-href-expected.txt
    M LayoutTests/svg/custom/use-extern-href.svg
    M Source/WebCore/svg/SVGURIReference.cpp
    M Source/WebCore/svg/SVGUseElement.cpp

  Log Message:
  -----------
  SVG <use> should work without specifying a fragment identifier
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



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

Reply via email to