Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ce15568a0e8b7e6c2c2aed2913ef4d2c4b4150ff
      
https://github.com/WebKit/WebKit/commit/ce15568a0e8b7e6c2c2aed2913ef4d2c4b4150ff
  Author: Karl Dubost <[email protected]>
  Date:   2026-07-28 (Tue, 28 Jul 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGMatrix-expected.txt
    R 
LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGMatrix-tentative-expected.txt
    R 
LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGMatrix-tentative.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGMatrix.html
    M 
LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/WEB_FEATURES.yml
    M 
LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/w3c-import.log
    M LayoutTests/svg/dom/SVGMatrix-interface-expected.txt
    M LayoutTests/svg/dom/SVGMatrix-interface.xhtml
    M LayoutTests/svg/dom/SVGMatrix.html
    M Source/WebCore/css/DOMMatrixReadOnly.cpp
    M Source/WebCore/css/DOMMatrixReadOnly.h
    M Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp
    M Source/WebCore/html/canvas/Path2D.cpp
    M Source/WebCore/svg/SVGMatrix.h
    M Source/WebCore/svg/SVGMatrix.idl

  Log Message:
  -----------
  SVGMatrix.multiply should accept DOMMatrix2DInit per SVG 2
https://bugs.webkit.org/show_bug.cgi?id=318103
rdar://180896205

Reviewed by Simon Fraser.

`SVGMatrix.multiply()` still had the SVG 1.1 signature `multiply(SVGMatrix)`, so
passing a dictionary threw:

    svg.createSVGMatrix().multiply({a: 3, d: 2});  // TypeError

SVG 2 keeps `SVGMatrix` as its own interface but takes the DOM geometry
dictionaries as input. The SVG WG settled this in svgwg#706 and the prose landed
in w3c/svgwg#1143.

Fix by widening the IDL to `optional DOMMatrix2DInit secondMatrix = {}` and
building the `AffineTransform` through a new
`DOMMatrixReadOnly::toAffineTransform()`, which runs validate-and-fixup[1] and
reads the normalized `m11`..`m42`. `Path2D::addPath()` and
`CanvasRenderingContext2DBase::setTransform()` open-coded the same sequence, so
they use the helper too. Gecko has the equivalent `ToValidatedMatrixDouble()`.

Passing an `SVGMatrix` keeps working, since dictionary conversion reads `a`..`f`
off whatever object it gets. Two calls that used to throw now multiply by the
identity matrix: `multiply()` with no argument, and `multiply()` with an object
holding none of `a`..`f` / `m11`..`m42`.

Note that `CanvasPattern::setTransform()`, `SVGTransform::setMatrix()` and
`SVGSVGElement::createSVGTransformFromMatrix()` still read `a`..`f`. Since
validate-and-fixup only fills forward, setting `m11` from `a` but never `a` from
`m11`, those ignore `m11`-spelled input. Converting them changes behavior and
needs its own tests, so it is left for a follow-up.

The WPT test drops its `-tentative` suffix now that w3c/svgwg#1143 has merged,
and grows coverage for the aliasing rule: nothing in `svg/` passed the
`m11`..`m42` spelling to anything before this. 
`DOMMatrix2DInit-validate-fixup.html`
covers the algorithm well but drives it only through `ctx.setTransform()` and
`Path2D.addPath()`.

[1] https://drafts.csswg.org/geometry-1/#matrix-validate-and-fixup

* 
LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGMatrix-expected.txt:
 Renamed from SVGMatrix-tentative-expected.txt.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGMatrix.html: 
Renamed from SVGMatrix-tentative.html.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/WEB_FEATURES.yml:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/w3c-import.log:
* LayoutTests/svg/dom/SVGMatrix-interface-expected.txt:
* LayoutTests/svg/dom/SVGMatrix-interface.xhtml:
* LayoutTests/svg/dom/SVGMatrix.html:
* Source/WebCore/css/DOMMatrixReadOnly.cpp:
(WebCore::DOMMatrixReadOnly::toAffineTransform):
* Source/WebCore/css/DOMMatrixReadOnly.h:
* Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::setTransform):
* Source/WebCore/html/canvas/Path2D.cpp:
(WebCore::Path2D::addPath):
* Source/WebCore/svg/SVGMatrix.h:
(WebCore::SVGMatrix::multiply const):
* Source/WebCore/svg/SVGMatrix.idl:

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



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

Reply via email to