Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b75776a843e5e4abec5ada0228e8103eef551861
      
https://github.com/WebKit/WebKit/commit/b75776a843e5e4abec5ada0228e8103eef551861
  Author: Karl Dubost <[email protected]>
  Date:   2026-10-07 (Wed, 07 Oct 2026)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGList-identity-across-attribute-change-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGList-reflected-attribute-synchronize-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGList-reflected-attribute-synchronize.html
    R 
LayoutTests/platform/gtk/svg/dom/SVGLengthList-xml-dom-modifications-expected.png
    R 
LayoutTests/platform/mac-tahoe-wk2-pixel/svg/dom/SVGLengthList-xml-dom-modifications-expected.png
    R 
LayoutTests/platform/mac/svg/dom/SVGLengthList-xml-dom-modifications-expected.png
    M LayoutTests/svg/dom/SVGLengthList-xml-dom-modifications-expected.txt
    M LayoutTests/svg/dom/SVGLengthList-xml-dom-modifications.xhtml
    M LayoutTests/svg/dom/SVGPointList-basics-expected.txt
    M LayoutTests/svg/dom/SVGPointList-basics.xhtml
    M Source/WebCore/svg/SVGLengthList.cpp
    M Source/WebCore/svg/SVGNumberList.cpp
    M Source/WebCore/svg/SVGPointList.cpp
    M Source/WebCore/svg/properties/SVGValuePropertyList.h

  Log Message:
  -----------
  Changing a list attribute detaches the SVGNumber, SVGLength and SVGPoint 
objects a script is holding instead of updating them
https://bugs.webkit.org/show_bug.cgi?id=322973
rdar://186835842

Reviewed by Said Abou-Hallawa.

1. A script reads an item from the rotate, x or points list.
2. The script changes the attribute.
3. The item still has its old value.
4. Writing to the item no longer changes the element.

    let n = text.rotate.baseVal.getItem(0);
    text.setAttribute('rotate', '40 50 60');
    n.value;    // 10, expected 40

SVG 2 defines what happens when the attribute changes:
1. If the new list is shorter, the extra items at the end are detached.
2. Every other item gets its new value.

    If length > new length, then:
        Detach each object in the list at an index greater than or
        equal to new length.
    ...
    Set item's value to v.

https://w3c.github.io/svgwg/svg2-draft/types.html#TermSynchronizeList

Before, SVGNumberList::parse(), SVGLengthList::parse() and
SVGPointList::parse():
1. Emptied the list, detaching every item.
2. Parsed the new values into new items.

Now they:
1. Parse the new values.
2. Add or remove items at the end if the count changed.
3. Write each value into the item at its index.

SVGTransformList already works this way.

Two WebKit tests expected the old behaviour:
- SVGLengthList-xml-dom-modifications.xhtml now expects the held items
  to take the new values. The pixel test no longer makes sense and is
  removed.
- SVGPointList-basics.xhtml puts its own point in the list, so the next
  setAttribute() changes that point. The test now checks this and resets
  the point before reusing it.

* 
LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGList-identity-across-attribute-change-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGList-reflected-attribute-synchronize-expected.txt:
* 
LayoutTests/platform/gtk/svg/dom/SVGLengthList-xml-dom-modifications-expected.png:
 Removed.
* 
LayoutTests/platform/mac-tahoe-wk2-pixel/svg/dom/SVGLengthList-xml-dom-modifications-expected.png:
 Removed.
* 
LayoutTests/platform/mac/svg/dom/SVGLengthList-xml-dom-modifications-expected.png:
 Removed.
* LayoutTests/svg/dom/SVGLengthList-xml-dom-modifications-expected.txt:
* LayoutTests/svg/dom/SVGLengthList-xml-dom-modifications.xhtml:
* LayoutTests/svg/dom/SVGPointList-basics-expected.txt:
* LayoutTests/svg/dom/SVGPointList-basics.xhtml:
* 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/properties/SVGValuePropertyList.h:
(WebCore::SVGValuePropertyList::updateItems):

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



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

Reply via email to