Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: aa1b9b223e9760f309aa77ff99f36e346421ddeb
      
https://github.com/WebKit/WebKit/commit/aa1b9b223e9760f309aa77ff99f36e346421ddeb
  Author: Ahmad Saleem <[email protected]>
  Date:   2025-12-09 (Tue, 09 Dec 2025)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/svg/geometry/svg-baseval-in-display-none-expected.txt
    M Source/WebCore/svg/SVGElement.cpp
    M Source/WebCore/svg/SVGElement.h
    M Source/WebCore/svg/SVGLengthContext.cpp

  Log Message:
  -----------
  SVGLength percentage resolution fails for elements inside non-instanced 
<symbol> or when viewportElement() returns nullptr
https://bugs.webkit.org/show_bug.cgi?id=303127
rdar://165431008

Reviewed by Simon Fraser.

SVGLength.value was throwing `NotSupportedError` when resolving percentage
values for elements inside non-instanced <symbol> elements or display:none
containers. According to the SVG specification [1], either an <svg> element
or a <symbol> element that is instanced by a <use> element establishes a
new viewport. For non-instanced <symbol> elements, the nearest ancestor
<svg> should provide the viewport for percentage resolution.

Fix viewport calculation by extending viewportElement() with a
ViewportElementType enum that allows callers to specify whether they want
any viewport element (including <symbol>) or specifically an <svg> element.
This eliminates the need for manual ancestor walks in computeViewportSize()
while preserving the original behavior for normal viewport elements.

When ViewportElementType::SVGSVGOnly is specified, viewportElement() now
walks up the ancestor tree to find the nearest <svg> element, skipping
<symbol> elements. This matches other browser engines (Blink / Chromium
and Gecko / Firefox).

[1] https://svgwg.org/svg2-draft/coords.html#EstablishingANewSVGViewport

NOTE: We still don't progress WPT due to floating point issue with height
in WPT test but it progress for width.

* Source/WebCore/svg/SVGElement.cpp:
(WebCore::SVGElement::viewportElement const):
* Source/WebCore/svg/SVGElement.h:
* Source/WebCore/svg/SVGLengthContext.cpp:
(WebCore::SVGLengthContext::computeViewportSize const):
* 
LayoutTests/imported/w3c/web-platform-tests/svg/geometry/svg-baseval-in-display-none-expected.txt:
 Partial Progression

Canonical link: https://commits.webkit.org/304197@main



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

Reply via email to