Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a4d918a0ff56cea5f308154b8efc8a24f99d49a1
      
https://github.com/WebKit/WebKit/commit/a4d918a0ff56cea5f308154b8efc8a24f99d49a1
  Author: Karl Dubost <[email protected]>
  Date:   2026-03-01 (Sun, 01 Mar 2026)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svglengthlist-animation-invalid-value-1-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgnumberlist-animation-invalid-value-1-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgpointlist-animation-invalid-value-1-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGList-parse-invalid-clears-items-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGList-parse-invalid-clears-items.html
    M LayoutTests/svg/custom/poly-parsing-error-expected.txt
    M LayoutTests/svg/custom/poly-parsing-error.html
    M LayoutTests/svg/custom/polyline-invalid-points-expected.txt
    M LayoutTests/svg/dom/length-list-parser-expected.txt
    M LayoutTests/svg/dom/points-parser-expected.txt
    M LayoutTests/svg/dom/points-parser.html
    M Source/WebCore/svg/SVGLengthList.cpp
    M Source/WebCore/svg/SVGNumberList.cpp
    M Source/WebCore/svg/SVGPointList.cpp
    M Source/WebCore/svg/SVGStringList.cpp

  Log Message:
  -----------
  clearItems() consistency across SVG list types
https://bugs.webkit.org/show_bug.cgi?id=308744
rdar://171263290

Reviewed by Brent Fulgham.

The SVG2 list synchronization algorithm specifies that when a content
attribute is invalid, the list should use the attribute's initial value
(empty list). SVGLengthList, SVGNumberList, and SVGPointList were
retaining partially-parsed items on failure instead.

Fix by calling clearItems() after a failed parse, matching the existing
behavior of SVGTransformList and the SVG2 spec. SVGStringList is
intentionally not changed: the spec uses a separate branch for DOMString
("Replace the list with a new list consisting of the values in value")
and its parser has no failure path.

The SVG2 spec (section 4.3.6) states that SVGLengthList, SVGNumberList,
SVGPointList, SVGStringList, and SVGTransformList initialize as the empty
list when the reflected content attribute is absent or invalid. The
previous test expectations encoded pre-SVG2 "render up to first error"
behavior that no longer matches the spec.

Update LayoutTests/svg/custom/poly-parsing-error.html and
LayoutTests/svg/dom/points-parser.html to expect an empty list (0 items)
for attribute values that fail to parse: incomplete point pairs, lone
numbers, trailing commas, and trailing garbage characters.

Add SVGPointList to the WPT test now that WebKit matches the spec.

Add a WPT test covering all four spec-mandated list types.

Test: 
imported/w3c/web-platform-tests/svg/types/scripted/SVGList-parse-invalid-clears-items.html

* 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svglengthlist-animation-invalid-value-1-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgnumberlist-animation-invalid-value-1-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/svg/animations/svgpointlist-animation-invalid-value-1-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGList-parse-invalid-clears-items-expected.txt:
 Added
* 
LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGList-parse-invalid-clears-items.html:
* 
LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGList-parse-invalid-clears-items.html:
 Added.
* LayoutTests/svg/custom/poly-parsing-error-expected.txt:
* LayoutTests/svg/custom/poly-parsing-error.html:
* LayoutTests/svg/custom/polyline-invalid-points-expected.txt:
* LayoutTests/svg/dom/length-list-parser-expected.txt:
* LayoutTests/svg/dom/points-parser-expected.txt:
* LayoutTests/svg/dom/points-parser.html:
* Source/WebCore/svg/SVGLengthList.cpp:
(WebCore::SVGLengthList::parse):
* Source/WebCore/svg/SVGNumberList.cpp:
(WebCore::SVGNumberList::parse):
* Source/WebCore/svg/SVGPointList.cpp:
(WebCore::SVGPointList::parse):
* Source/WebCore/svg/SVGStringList.cpp:
(WebCore::SVGStringList::parse):

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



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

Reply via email to