Skip to content

Commit 5b19b37

Browse files
authored
Do nothing for NaN in setTransform(transform)/addPath(b, transform)
Fixes whatwg#2845. Tests: web-platform-tests/wpt#7473
1 parent f3c354a commit 5b19b37

File tree

1 file changed

+63
-32
lines changed

1 file changed

+63
-32
lines changed

source

Lines changed: 63 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3726,7 +3726,13 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
37263726
spec=GEOMETRY></p>
37273727

37283728
<ul class="brief">
3729-
<li><dfn data-x-href="https://drafts.fxtf.org/geometry/#dommatrix"><code>DOMMatrix</code></dfn> interface</li>
3729+
<li><dfn data-x-href="https://drafts.fxtf.org/geometry/#dommatrix"><code>DOMMatrix</code></dfn> interface, and associated
3730+
<dfn data-x-href="https://drafts.fxtf.org/geometry/#matrix-m11-element">m11 element</dfn>,
3731+
<dfn data-x-href="https://drafts.fxtf.org/geometry/#matrix-m12-element">m12 element</dfn>,
3732+
<dfn data-x-href="https://drafts.fxtf.org/geometry/#matrix-m21-element">m21 element</dfn>,
3733+
<dfn data-x-href="https://drafts.fxtf.org/geometry/#matrix-m22-element">m22 element</dfn>,
3734+
<dfn data-x-href="https://drafts.fxtf.org/geometry/#matrix-m41-element">m41 element</dfn>, and
3735+
<dfn data-x-href="https://drafts.fxtf.org/geometry/#matrix-m42-element">m42 element</dfn></li>
37303736
<li><dfn data-x-href="https://drafts.fxtf.org/geometry/#dictdef-dommatrix2dinit"><code>DOMMatrix2DInit</code></dfn> and
37313737
<dfn data-x-href="https://drafts.fxtf.org/geometry/#dictdef-dommatrixinit"><code>DOMMatrixInit</code></dfn> dictionaries</li>
37323738
<li>The <dfn data-x-href="https://drafts.fxtf.org/geometry/#create-a-dommatrix-from-the-dictionary">create a <code>DOMMatrix</code> from a dictionary</dfn> algorithm for <code>DOMMatrix2DInit</code> or <code>DOMMatrixInit</code></li>
@@ -60565,7 +60571,7 @@ idea from Mihai:
6056560571
<li><p>Let <var>a</var> be the argument.</p></li>
6056660572

6056760573
<li><p>If any value in <var>a</var> is not finite (e.g. an Infinity or a NaN value), or
60568-
if any value is negative (less than zero), then abort these steps (without throwing an exception;
60574+
if any value is negative (less than zero), then return (without throwing an exception;
6056960575
user agents could show a message on a developer console, though, as that would be helpful for
6057060576
debugging).</p></li>
6057160577

@@ -61713,7 +61719,7 @@ try {
6171361719
method, when invoked, must run these steps:</p>
6171461720

6171561721
<ol>
61716-
<li><p>If either of the arguments are infinite or NaN, then abort these steps.</p></li>
61722+
<li><p>If either of the arguments are infinite or NaN, then return.</p></li>
6171761723

6171861724
<li><p>Create a new subpath with the specified point as its first (and only) point.</p></li>
6171961725
</ol>
@@ -61746,7 +61752,7 @@ try {
6174661752
method, when invoked, must run these steps:</p>
6174761753

6174861754
<ol>
61749-
<li><p>If either of the arguments are infinite or NaN, then abort these steps.</p></li>
61755+
<li><p>If either of the arguments are infinite or NaN, then return.</p></li>
6175061756

6175161757
<li><p>If the object's path has no subpaths, then <span>ensure there is a subpath</span> for
6175261758
<span data-x="">(<var>x</var>, <var>y</var>)</span>.</p></li>
@@ -61761,7 +61767,7 @@ try {
6176161767
steps:</p>
6176261768

6176361769
<ol>
61764-
<li><p>If any of the arguments are infinite or NaN, then abort these steps.</p></li>
61770+
<li><p>If any of the arguments are infinite or NaN, then return.</p></li>
6176561771

6176661772
<li><p><span>Ensure there is a subpath</span> for <span data-x="">(<var>cpx</var>,
6176761773
<var>cpy</var>)</span></p></li>
@@ -61778,7 +61784,7 @@ try {
6177861784
method, when invoked, must run these steps:</p>
6177961785

6178061786
<ol>
61781-
<li><p>If any of the arguments are infinite or NaN, then abort these steps.</p></li>
61787+
<li><p>If any of the arguments are infinite or NaN, then return.</p></li>
6178261788

6178361789
<li><p><span>Ensure there is a subpath</span> for <span data-x="">(<var>cp1x</var>,
6178461790
<var>cp1y</var>)</span>.</p></li>
@@ -61797,7 +61803,7 @@ try {
6179761803
when invoked, must run these steps:</p>
6179861804

6179961805
<ol>
61800-
<li><p>If any of the arguments are infinite or NaN, then abort these steps.</p></li>
61806+
<li><p>If any of the arguments are infinite or NaN, then return.</p></li>
6180161807

6180261808
<li><p><span>Ensure there is a subpath</span> for <span data-x="">(<var>x1</var>,
6180361809
<var>y1</var>)</span>.</p></li>
@@ -61853,7 +61859,7 @@ try {
6185361859
steps:</p>
6185461860

6185561861
<ol>
61856-
<li><p>If any of the arguments are infinite or NaN, then abort these steps.</p></li>
61862+
<li><p>If any of the arguments are infinite or NaN, then return.</p></li>
6185761863

6185861864
<li><p>If either <var>radiusX</var> or <var>radiusY</var> are negative, then throw an
6185961865
<span>"<code>IndexSizeError</code>"</span> <code>DOMException</code>.</p></li>
@@ -61898,7 +61904,7 @@ try {
6189861904
<var>h</var>)</code></dfn> method, when invoked, must run these steps:</p>
6189961905

6190061906
<ol>
61901-
<li><p>If any of the arguments are infinite or NaN, then abort these steps.</p></li>
61907+
<li><p>If any of the arguments are infinite or NaN, then return.</p></li>
6190261908

6190361909
<li><p>Create a new subpath containing just the four points (<var>x</var>, <var>y</var>),
6190461910
(<var>x</var>+<var>w</var>, <var>y</var>), (<var>x</var>+<var>w</var>,
@@ -62075,14 +62081,18 @@ try {
6207562081

6207662082
<ol>
6207762083

62078-
<li><p>If the <code>Path2D</code> object <var>b</var> has no subpaths, then abort these
62079-
steps.</p></li>
62080-
62081-
<li><p>Create a copy of all the subpaths in <var>b</var>. Let this copy be known as <var>c</var>.</p></li>
62084+
<li><p>If the <code>Path2D</code> object <var>b</var> has no subpaths, then return.</p></li>
6208262085

6208362086
<li><p>Let <var>matrix</var> be the result of <span data-x="create a DOMMatrix from a
62084-
dictionary">creating a <code>DOMMatrix</code> from a dictionary</span>
62085-
<var>transform</var>, with <var>ignore3D</var> set to true.</p></li>
62087+
dictionary">creating a <code>DOMMatrix</code> from the dictionary</span> <var>transform</var>,
62088+
with <var>ignore3D</var> set to true.</p></li>
62089+
62090+
<li><p>If one or more of <var>matrix</var>'s <span>m11 element</span>, <span>m12 element</span>,
62091+
<span>m21 element</span>, <span>m22 element</span>, <span>m41 element</span>, or <span>m42
62092+
element</span> are infinite or NaN, then return.</p></li>
62093+
62094+
<li><p>Create a copy of all the subpaths in <var>b</var>. Let this copy be known as
62095+
<var>c</var>.</p></li>
6208662096

6208762097
<li><p>Transform all the coordinates and lines in <var>c</var> by the transform matrix
6208862098
<var>matrix</var>.</p></li>
@@ -62092,7 +62102,8 @@ try {
6209262102

6209362103
<li><p>Add all the subpaths in <var>c</var> to <var>a</var>.</p></li>
6209462104

62095-
<li><p>Create a new subpath in <var>a</var> with (<var>x</var>, <var>y</var>) as the only point in the subpath.</p></li>
62105+
<li><p>Create a new subpath in <var>a</var> with (<var>x</var>, <var>y</var>) as the only point
62106+
in the subpath.</p></li>
6209662107

6209762108
</ol>
6209862109

@@ -62206,7 +62217,7 @@ try {
6220662217
method, when invoked, must run these steps:</p>
6220762218

6220862219
<ol>
62209-
<li><p>If either of the arguments are infinite or NaN, then abort these steps.</p></li>
62220+
<li><p>If either of the arguments are infinite or NaN, then return.</p></li>
6221062221

6221162222
<li><p>Add the scaling transformation described by the arguments to the <span>current
6221262223
transformation matrix</span>. The <var>x</var> argument represents the scale factor in the
@@ -62218,7 +62229,7 @@ try {
6221862229
when invoked, must run these steps:</p>
6221962230

6222062231
<ol>
62221-
<li><p>If <var>angle</var> is infinite or NaN, then abort these steps.</p></li>
62232+
<li><p>If <var>angle</var> is infinite or NaN, then return.</p></li>
6222262233

6222362234
<li><p>Add the rotation transformation described by the argument to the <span>current
6222462235
transformation matrix</span>. The <var>angle</var> argument represents a clockwise rotation angle
@@ -62229,7 +62240,7 @@ try {
6222962240
<var>y</var>)</code></dfn> method, when invoked, must run these steps:</p>
6223062241

6223162242
<ol>
62232-
<li><p>If either of the arguments are infinite or NaN, then abort these steps.</p></li>
62243+
<li><p>If either of the arguments are infinite or NaN, then return.</p></li>
6223362244

6223462245
<li><p>Add the translation transformation described by the arguments to the <span>current
6223562246
transformation matrix</span>. The <var>x</var> argument represents the translation distance in
@@ -62242,7 +62253,7 @@ try {
6224262253
run these steps:</p>
6224362254

6224462255
<ol>
62245-
<li><p>If any of the arguments are infinite or NaN, then abort these steps.</p></li>
62256+
<li><p>If any of the arguments are infinite or NaN, then return.</p></li>
6224662257

6224762258
<li><p>Replace the <span>current transformation matrix</span> with the result of multiplying the
6224862259
current transformation matrix with the matrix described by:</p></li>
@@ -62291,7 +62302,7 @@ try {
6229162302
run these steps:</p>
6229262303

6229362304
<ol>
62294-
<li><p>If any of the arguments are infinite or NaN, then abort these steps.</p></li>
62305+
<li><p>If any of the arguments are infinite or NaN, then return.</p></li>
6229562306

6229662307
<li><p>Reset the <span>current transformation matrix</span> to the identity matrix.</p></li>
6229762308

@@ -62301,9 +62312,19 @@ try {
6230162312
</ol>
6230262313

6230362314
<p>The <dfn><code data-x="">setTransform(<var>transform</var>)</code></dfn> method, when invoked,
62304-
must reset the <span>current transformation matrix</span> to the value represented by the result
62305-
of <span data-x="create a DOMMatrix from a dictionary">creating a <code>DOMMatrix</code> from a
62306-
dictionary</span> <var>transform</var>, with <var>ignore3D</var> set to true.</p>
62315+
must run these steps:</p>
62316+
62317+
<ol>
62318+
<li><p>Let <var>matrix</var> be the result of <span data-x="create a DOMMatrix from a
62319+
dictionary">creating a <code>DOMMatrix</code> from the dictionary</span> <var>transform</var>,
62320+
with <var>ignore3D</var> set to true.</p>
62321+
62322+
<li><p>If one or more of <var>matrix</var>'s <span>m11 element</span>, <span>m12 element</span>,
62323+
<span>m21 element</span>, <span>m22 element</span>, <span>m41 element</span>, or <span>m42
62324+
element</span> are infinite or NaN, then return.</p></li>
62325+
62326+
<li><p>Reset the <span>current transformation matrix</span> to <var>matrix</var>.</p></li>
62327+
</ol>
6230762328

6230862329
<p>The <dfn><code data-x="dom-context-2d-resetTransform">resetTransform()</code></dfn> method,
6230962330
when invoked, must reset the <span>current transformation matrix</span> to the identity
@@ -62750,9 +62771,19 @@ try {
6275062771

6275162772
<p>The <dfn><code
6275262773
data-x="dom-canvaspattern-setTransform">setTransform(<var>transform</var>)</code></dfn> method,
62753-
when invoked, must reset the pattern's transformation matrix to the value represented by the
62754-
result of <span data-x="create a DOMMatrix from a dictionary">creating a <code>DOMMatrix</code>
62755-
from a dictionary</span> <var>transform</var>, with <var>ignore3D</var> set to true.</p>
62774+
when invoked, must run these steps:</p>
62775+
62776+
<ol>
62777+
<li><p>Let <var>matrix</var> be the result of <span data-x="create a DOMMatrix from a
62778+
dictionary">creating a <code>DOMMatrix</code> from the dictionary</span> <var>transform</var>,
62779+
with <var>ignore3D</var> set to true.</p>
62780+
62781+
<li><p>If one or more of <var>matrix</var>'s <span>m11 element</span>, <span>m12 element</span>,
62782+
<span>m21 element</span>, <span>m22 element</span>, <span>m41 element</span>, or <span>m42
62783+
element</span> are infinite or NaN, then return.</p></li>
62784+
62785+
<li><p>Reset the pattern's transformation matrix to <var>matrix</var>.</p></li>
62786+
</ol>
6275662787

6275762788
<p>When a pattern is to be rendered within an area, the user agent must run the following steps to
6275862789
determine what is rendered:</p>
@@ -62869,7 +62900,7 @@ try {
6286962900

6287062901
<ol>
6287162902

62872-
<li><p>If any of the arguments are infinite or NaN, then abort these steps.</p></li>
62903+
<li><p>If any of the arguments are infinite or NaN, then return.</p></li>
6287362904

6287462905
<li><p>Let <var>pixels</var> be the set of pixels in the specified rectangle that also
6287562906
intersect the current <span>clipping region</span>.</p></li>
@@ -62886,7 +62917,7 @@ try {
6288662917
<var>w</var>, <var>h</var>)</code></dfn> method, when invoked, must must run these steps:</p>
6288762918

6288862919
<ol>
62889-
<li><p>If any of the arguments are infinite or NaN, then abort these steps.</p></li>
62920+
<li><p>If any of the arguments are infinite or NaN, then return.</p></li>
6289062921

6289162922
<li><p>If either <var>w</var> or <var>h</var> are zero, then abort these steps.</p></li>
6289262923

@@ -62898,7 +62929,7 @@ try {
6289862929
<var>w</var>, <var>h</var>)</code></dfn> method, when invoked, must run these steps:</p>
6289962930

6290062931
<ol>
62901-
<li><p>If any of the arguments are infinite or NaN, then abort these steps.</p></li>
62932+
<li><p>If any of the arguments are infinite or NaN, then return.</p></li>
6290262933

6290362934
<li><p>Take the result of <span data-x="trace a path">tracing the path</span> described below,
6290462935
using the <code>CanvasPathDrawingStyles</code> interface's line styles, and fill it with the
@@ -62983,7 +63014,7 @@ try {
6298363014
are invoked, the user agent must run these steps:</p>
6298463015

6298563016
<ol>
62986-
<li><p>If any of the arguments are infinite or NaN, then abort these steps.</p></li>
63017+
<li><p>If any of the arguments are infinite or NaN, then return.</p></li>
6298763018

6298863019
<li><p>Run the <span>text preparation algorithm</span>, passing it <var>text</var>, the object
6298963020
implementing the <code>CanvasText</code> interface, and, if the <var>maxWidth</var> argument was
@@ -63713,7 +63744,7 @@ v6DVT (also check for '- -' bits in the part above) -->
6371363744
agent must run these steps:</p>
6371463745

6371563746
<ol>
63716-
<li><p>If any of the arguments are infinite or NaN, then abort these steps.</p></li>
63747+
<li><p>If any of the arguments are infinite or NaN, then return.</p></li>
6371763748

6371863749
<li><p><span>Check the usability of the <var>image</var> argument</span>. If this
6371963750
returns <i>aborted</i>, then an exception has been thrown and the method doesn't return anything;

0 commit comments

Comments
 (0)