Skip to content

Commit b65753a

Browse files
zcorpansvgeesus
authored andcommitted
WebKitCSSMatrix compat: constructors
Change fromString() static method into overloaded constructor, since Web content depends on it for WebKitCSSMatrix constructor. However, I could not find (github search) content that depends on WebKitCSSMatrix(other), so leave as fromMatrix() static method. Also add a no-argument constructor. I think this was accidentally left out when switching to static methods. Part of whatwg/compat#19
1 parent 1832f1b commit b65753a

File tree

1 file changed

+42
-30
lines changed

1 file changed

+42
-30
lines changed

geometry/Overview.bs

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -401,11 +401,12 @@ In the following sections, terms have the following meaning:
401401
</dl>
402402

403403
<pre class='idl'>
404-
[Constructor(sequence&lt;unrestricted double> numberSequence),
404+
[Constructor,
405+
Constructor(DOMString transformList),
406+
Constructor(sequence&lt;unrestricted double> numberSequence),
405407
Exposed=(Window,Worker)]
406408
interface DOMMatrixReadOnly {
407409
[NewObject] static DOMMatrixReadOnly fromMatrix(optional DOMMatrixInit other);
408-
[NewObject] static DOMMatrixReadOnly fromString(DOMString transformList);
409410
[NewObject] static DOMMatrixReadOnly fromFloat32Array(Float32Array array32);
410411
[NewObject] static DOMMatrixReadOnly fromFloat64Array(Float64Array array64);
411412

@@ -474,11 +475,12 @@ interface DOMMatrixReadOnly {
474475
serializer = { attribute };
475476
};
476477

477-
[Constructor(sequence&lt;unrestricted double> numberSequence),
478+
[Constructor,
479+
Constructor(DOMString transformList),
480+
Constructor(sequence&lt;unrestricted double> numberSequence),
478481
Exposed=(Window,Worker)]
479482
interface DOMMatrix : DOMMatrixReadOnly {
480483
[NewObject] static DOMMatrix fromMatrix(optional DOMMatrixInit other);
481-
[NewObject] static DOMMatrix fromString(DOMString transformList);
482484
[NewObject] static DOMMatrix fromFloat32Array(Float32Array array32);
483485
[NewObject] static DOMMatrix fromFloat64Array(Float64Array array64);
484486

@@ -645,8 +647,43 @@ with a sequence <var>numberSequence</var> of 16 elements, follow these steps:
645647
1. Set <a>is2D</a> to <code>false</code>.
646648
1. Return <var>matrix</var>
647649

650+
The <dfn dfn-type=constructor dfn-for=DOMMatrixReadOnly><code>DOMMatrixReadOnly()</code></dfn> and
651+
the <dfn dfn-type=constructor dfn-for=DOMMatrix><code>DOMMatrix()</code></dfn> constructors, when
652+
invoked with no argument, must run the following steps:
653+
654+
<ol>
655+
<li>Return the result of invoking <a>create a 2d matrix</a> of type {{DOMMatrixReadOnly}} or
656+
{{DOMMatrix}} as appropriate, with the sequence [''1'', ''0'', ''0'', ''1'', ''0'', ''0''].</li>
657+
</ol>
658+
659+
The <dfn dfn-type=constructor dfn-for=DOMMatrixReadOnly><code>DOMMatrixReadOnly(<var>transformList</var>)</code></dfn> and
660+
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:
661+
662+
<ol>
663+
<li>Parse <var>transformList</var> by following the syntax description in “<a href=http://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>
664+
<li>Let <var>2dTransform</var> track the 2D/3D dimension status of the <<transform-list>>.
665+
<dl class=switch>
666+
<dt>If the <<transform-list>> consists of any <a href='http://www.w3.org/TR/css-transforms-1/#three-d-transform-functions'>3D Transform functions</a></dt>
667+
<dd>Set <var>2dTransform</var> to <code>false</code>.</dd>
668+
<dt>Otherwise</dt>
669+
<dd>Set <var>2dTransform</var> to <code>true</code>.</dd>
670+
</dl>
671+
</li>
672+
<li>Transform all <<transform-function>>s to 4x4 matrices by following the “<a href=http://www.w3.org/TR/css-transforms-1/#mathematical-description>Mathematical Description of Transform Functions</a>[[!CSS3-TRANSFORMS]].</li>
673+
<li>Let <var>matrix</var> be a 4x4 matrix as shown in the initial figure of this section. Post-multiply all matrices from left to right and set <var>matrix</var> to this product.</li>
674+
<li>
675+
<dl class=switch>
676+
<dt>If <var>2dTransform</var> is set to <code>true</code></dt>
677+
<dd>Return the result of invoking <a>create a 2d matrix</a> of type {{DOMMatrixReadOnly}} or {{DOMMatrix}} as appropriate, with a sequence of numbers, the values being the elements <var>m11</var>, <var>m12</var>, <var>m21</var>, <var>m22</var>, <var>m41</var> and <var>m42</var> of <var>matrix</var>.</dd>
678+
<dt>If <var>2dTransform</var> is set to <code>false</code></dt>
679+
<dd>Return the result of invoking <a>create a 3d matrix</a> of type {{DOMMatrixReadOnly}} or {{DOMMatrix}} as appropriate, with a sequence of numbers, the values being the 16 elements of <var>matrix</var>.</dd>
680+
</dl>
681+
</li>
682+
</ol>
683+
648684
The <dfn dfn-type=constructor dfn-for=DOMMatrixReadOnly><code>DOMMatrixReadOnly(<var>numberSequence</var>)</code></dfn> and
649-
the <dfn dfn-type=constructor dfn-for=DOMMatrix><code>DOMMatrix(<var>numberSequence</var>)</code></dfn> constructors, when invoked, must run the following steps:
685+
the <dfn dfn-type=constructor dfn-for=DOMMatrix><code>DOMMatrix(<var>numberSequence</var>)</code></dfn> constructors,
686+
when invoked with a sequence argument, must run the following steps:
650687

651688
<dl class=switch>
652689
<dt>If <var>numberSequence</var> has 6 elements</dt>
@@ -673,31 +710,6 @@ the <dfn method lt=fromMatrix() dfn-for=DOMMatrix id=dom-dommatrix-frommatrix><c
673710
</li>
674711
</ol>
675712

676-
The <dfn method dfn-for=DOMMatrixReadOnly id=dom-dommatrixreadonly-fromstring><code>fromString(<var>transformList</var>)</code></dfn> static method on {{DOMMatrixReadOnly}} and
677-
the <dfn method dfn-for=DOMMatrix id=dom-dommatrix-fromstring><code>fromString(<var>transformList</var>)</code></dfn> static method on {{DOMMatrix}} must follow these steps:
678-
679-
<ol>
680-
<li>Parse <var>transformList</var> by following the syntax description in “<a href=http://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>
681-
<li>Let <var>2dTransform</var> track the 2D/3D dimension status of the <<transform-list>>.
682-
<dl class=switch>
683-
<dt>If the <<transform-list>> consists of any <a href='http://www.w3.org/TR/css-transforms-1/#three-d-transform-functions'>3D Transform functions</a></dt>
684-
<dd>Set <var>2dTransform</var> to <code>false</code>.</dd>
685-
<dt>Otherwise</dt>
686-
<dd>Set <var>2dTransform</var> to <code>true</code>.</dd>
687-
</dl>
688-
</li>
689-
<li>Transform all <<transform-function>>s to 4x4 matrices by following the “<a href=http://www.w3.org/TR/css-transforms-1/#mathematical-description>Mathematical Description of Transform Functions</a>[[!CSS3-TRANSFORMS]].</li>
690-
<li>Let <var>matrix</var> be a 4x4 matrix as shown in the initial figure of this section. Post-multiply all matrices from left to right and set <var>matrix</var> to this product.</li>
691-
<li>
692-
<dl class=switch>
693-
<dt>If <var>2dTransform</var> is set to <code>true</code></dt>
694-
<dd>Return the result of invoking <a>create a 2d matrix</a> of type {{DOMMatrixReadOnly}} or {{DOMMatrix}} as appropriate, with a sequence of numbers, the values being the elements <var>m11</var>, <var>m12</var>, <var>m21</var>, <var>m22</var>, <var>m41</var> and <var>m42</var> of <var>matrix</var> of <var>matrix</var>.</dd>
695-
<dt>If <var>2dTransform</var> is set to <code>false</code></dt>
696-
<dd>Return the result of invoking <a>create a 3d matrix</a> of type {{DOMMatrixReadOnly}} or {{DOMMatrix}} as appropriate, with a sequence of numbers, the values being the 16 elements of <var>matrix</var>.</dd>
697-
</dl>
698-
</li>
699-
</ol>
700-
701713
The <dfn method dfn-for=DOMMatrixReadOnly id=dom-dommatrixreadonly-fromfloat32array><code>fromFloat32Array(<var>array32</var>)</code></dfn> static method on {{DOMMatrixReadOnly}} and
702714
the <dfn method dfn-for=DOMMatrix id=dom-dommatrix-fromfloat32array><code>fromFloat32Array(<var>array32</var>)</code></dfn> static method on {{DOMMatrix}} must follow these steps:
703715

0 commit comments

Comments
 (0)