Skip to content

Commit 3e6d1f3

Browse files
zcorpansvgeesus
authored andcommitted
Tweak parsing of transformList
For DOMMatrix(transformList) and setMatrixValue(transformList), the empty string is the identity matrix, and keywords other than 'none' throw. Fixes https://www.w3.org/Bugs/Public/show_bug.cgi?id=29446.
1 parent 2674d6e commit 3e6d1f3

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

geometry/Overview.bs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,14 @@ The <dfn dfn-type=constructor dfn-for=DOMMatrixReadOnly><code>DOMMatrixReadOnly(
666666
the <dfn dfn-type=constructor dfn-for=DOMMatrix><code>DOMMatrix(<var>transformList</var>)</code></dfn> constructors, when invoked with a {{DOMString}} argument, must follow these steps:
667667

668668
<ol>
669-
<li>Parse <var>transformList</var> by following the syntax description in “<a href=https://www.w3.org/TR/css-transforms-1/#svg-syntax>Syntax of the SVG ‘transform’ attribute</a>[[!CSS3-TRANSFORMS]] to a <<transform-list>>. If parsing is not successful or any <<transform-function>> has <<length>> values without <a spec='css-values'>absolute length</a> units<!--For WD: <a spec='css-values-3'>absolute length units</a>-->, throw a {{SyntaxError}} exception.</li>
669+
<li>If <var>transformList</var> is the empty string, set it to the string "<code lt>matrix(1, 0,
670+
0, 1, 0, 0)</code>".</li>
671+
<li>Parse <var>transformList</var> by following the syntax description in “<a
672+
href=https://www.w3.org/TR/css-transforms-1/#svg-syntax>Syntax of the SVG ‘transform’
673+
attribute</a>[[!CSS3-TRANSFORMS]] to a <<transform-list>>. If parsing is not successful, or any
674+
<<transform-function>> has <<length>> values without <a spec='css-values'>absolute length</a>
675+
units<!--For WD: <a spec='css-values-3'>absolute length units</a>-->, or any keyword other than
676+
''transform/none'' is used, throw a {{SyntaxError}} exception.</li>
670677
<li>Let <var>2dTransform</var> track the 2D/3D dimension status of the <<transform-list>>.
671678
<dl class=switch>
672679
<dt>If the <<transform-list>> consists of any <a href='https://www.w3.org/TR/css-transforms-1/#three-d-transform-functions'>3D Transform functions</a></dt>
@@ -1127,7 +1134,14 @@ Note: Authors who use chained method calls are recommended to use mutable transf
11271134
<dt><dfn>setMatrixValue(<var>transformList</var>)</dfn></dt>
11281135
<dd>
11291136
<ol>
1130-
<li>Parse <var>transformList</var> by following the syntax description in “<a href=https://www.w3.org/TR/css-transforms-1/#svg-syntax>Syntax of the SVG ‘transform’ attribute</a>[[!CSS3-TRANSFORMS]] to a <<transform-list>>. If parsing is not successful or any <<transform-function>> has <<length>> values without <a spec='css-values'>absolute length</a> units<!--For WD: <a spec='css-values-3'>absolute length units</a>-->, throw a {{SyntaxError}} exception.</li>
1137+
<li>If <var>transformList</var> is the empty string, set it to the string "<code lt>matrix(1,
1138+
0, 0, 1, 0, 0)</code>".</li>
1139+
<li>Parse <var>transformList</var> by following the syntax description in “<a
1140+
href=https://www.w3.org/TR/css-transforms-1/#svg-syntax>Syntax of the SVG ‘transform’
1141+
attribute</a>[[!CSS3-TRANSFORMS]] to a <<transform-list>>. If parsing is not successful, or
1142+
any <<transform-function>> has <<length>> values without <a spec='css-values'>absolute
1143+
length</a> units<!--For WD: <a spec='css-values-3'>absolute length units</a>-->, or any
1144+
keyword other than ''transform/none'' is used, throw a {{SyntaxError}} exception.</li>
11311145
<li>Set <a>is2D</a> to <code>false</code> if the <<transform-list>> consists of any <a href='https://www.w3.org/TR/css-transforms-1/#three-d-transform-functions'>3D Transform functions</a>. Otherwise set <a>is2D</a> to <code>true</code>.</li>
11321146
<li>Transform all <<transform-function>>s to 4x4 matrices by following the “<a href=https://www.w3.org/TR/css-transforms-1/#mathematical-description>Mathematical Description of Transform Functions</a>[[!CSS3-TRANSFORMS]].</li>
11331147
<li>Post-multiply all matrices from left to right to a combined 4x4 matrix.</li>

0 commit comments

Comments
 (0)