Skip to content

Commit e061e40

Browse files
chrishtrsvgeesus
authored andcommitted
Merge pull request #395 from TimothyGu/nan
[geometry-1] Define minimum and maximum as preferring NaN
1 parent 08df530 commit e061e40

File tree

1 file changed

+31
-20
lines changed

1 file changed

+31
-20
lines changed

geometry/Overview.bs

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -368,17 +368,21 @@ for=rectangle>height dimension</a> value. For the {{DOMRect}} interface, setting
368368
{{DOMRect/height}} attribute must set the <a for=rectangle>height dimension</a> value to the new
369369
value.
370370

371-
The <dfn><code>top</code></dfn> attribute, on getting, must return min(<a for=rectangle>y
372-
coordinate</a>, <a for=rectangle>y coordinate</a> + <a for=rectangle>height dimension</a>).
371+
The <dfn><code>top</code></dfn> attribute, on getting, must return the <a>NaN-safe minimum</a> of
372+
the <a for=rectangle>y coordinate</a> and the sum of the <a for=rectangle>y coordinate</a> and the
373+
<a for=rectangle>height dimension</a>.
373374

374-
The <dfn><code>right</code></dfn> attribute, on getting, must return max(<a for=rectangle>x
375-
coordinate</a>, <a for=rectangle>x coordinate</a> + <a for=rectangle>width dimension</a>).
375+
The <dfn><code>right</code></dfn> attribute, on getting, must return the <a>NaN-safe maximum</a> of
376+
the <a for=rectangle>x coordinate</a> and the sum of the <a for=rectangle>x coordinate</a> and the
377+
<a for=rectangle>width dimension</a>.
376378

377-
The <dfn><code>bottom</code></dfn> attribute, on getting, must return max(<a for=rectangle>y
378-
coordinate</a>, <a for=rectangle>y coordinate</a> + <a for=rectangle>height dimension</a>).
379+
The <dfn><code>bottom</code></dfn> attribute, on getting, must return the <a>NaN-safe maximum</a>
380+
of the <a for=rectangle>y coordinate</a> and the sum of the <a for=rectangle>y coordinate</a> and
381+
the <a for=rectangle>height dimension</a>.
379382

380-
The <dfn><code>left</code></dfn> attribute, on getting, must return min(<a for=rectangle>x
381-
coordinate</a>, <a for=rectangle>x coordinate</a> + <a for=rectangle>width dimension</a>).
383+
The <dfn><code>left</code></dfn> attribute, on getting, must return the <a>NaN-safe minimum</a> of
384+
the <a for=rectangle>x coordinate</a> and the sum of the <a for=rectangle>x coordinate</a> and the
385+
<a for=rectangle>width dimension</a>.
382386
</div>
383387

384388

@@ -528,21 +532,21 @@ The <dfn method for=DOMQuad>getBounds()</dfn> method, when invoked, must run the
528532
algorithm:
529533

530534
1. Let <var>bounds</var> be a {{DOMRect}} object.
531-
2. Let <var>left</var> be the minimum of <a for=quadrilateral>point 1</a>'s <a for=point>x
532-
coordinate</a>, <a for=quadrilateral>point 2</a>'s <a for=point>x coordinate</a>, <a
533-
for=quadrilateral>point 3</a>'s <a for=point>x coordinate</a> and <a for=quadrilateral>point
535+
2. Let <var>left</var> be the <a>NaN-safe minimum</a> of <a for=quadrilateral>point 1</a>'s <a
536+
for=point>x coordinate</a>, <a for=quadrilateral>point 2</a>'s <a for=point>x coordinate</a>,
537+
<a for=quadrilateral>point 3</a>'s <a for=point>x coordinate</a> and <a for=quadrilateral>point
534538
4</a>'s <a for=point>x coordinate</a>.
535-
3. Let <var>top</var> be the minimum of <a for=quadrilateral>point 1</a>'s <a for=point>y
536-
coordinate</a>, <a for=quadrilateral>point 2</a>'s <a for=point>y coordinate</a>, <a
537-
for=quadrilateral>point 3</a>'s <a for=point>y coordinate</a> and <a for=quadrilateral>point
539+
3. Let <var>top</var> be the <a>NaN-safe minimum</a> of <a for=quadrilateral>point 1</a>'s <a
540+
for=point>y coordinate</a>, <a for=quadrilateral>point 2</a>'s <a for=point>y coordinate</a>,
541+
<a for=quadrilateral>point 3</a>'s <a for=point>y coordinate</a> and <a for=quadrilateral>point
538542
4</a>'s <a for=point>y coordinate</a>.
539-
4. Let <var>right</var> be the maximum of <a for=quadrilateral>point 1</a>'s <a for=point>x
540-
coordinate</a>, <a for=quadrilateral>point 2</a>'s <a for=point>x coordinate</a>, <a
541-
for=quadrilateral>point 3</a>'s <a for=point>x coordinate</a> and <a for=quadrilateral>point
543+
4. Let <var>right</var> be the <a>NaN-safe maximum</a> of <a for=quadrilateral>point 1</a>'s <a
544+
for=point>x coordinate</a>, <a for=quadrilateral>point 2</a>'s <a for=point>x coordinate</a>,
545+
<a for=quadrilateral>point 3</a>'s <a for=point>x coordinate</a> and <a for=quadrilateral>point
542546
4</a>'s <a for=point>x coordinate</a>.
543-
5. Let <var>bottom</var> be the maximum of <a for=quadrilateral>point 1</a>'s <a for=point>y
544-
coordinate</a>, <a for=quadrilateral>point 2</a>'s <a for=point>y coordinate</a>, <a
545-
for=quadrilateral>point 3</a>'s <a for=point>y coordinate</a> and <a for=quadrilateral>point
547+
5. Let <var>bottom</var> be the <a>NaN-safe maximum</a> of <a for=quadrilateral>point 1</a>'s <a
548+
for=point>y coordinate</a>, <a for=quadrilateral>point 2</a>'s <a for=point>y coordinate</a>,
549+
<a for=quadrilateral>point 3</a>'s <a for=point>y coordinate</a> and <a for=quadrilateral>point
546550
4</a>'s <a for=point>y coordinate</a>.
547551
6. Set <a for=rectangle>x coordinate</a> of <var>bounds</var> to <var>left</var>, <a
548552
for=rectangle>y coordinate</a> of <var>bounds</var> to <var>top</var>, <a for=rectangle>width
@@ -1787,6 +1791,13 @@ Web. It is defined in this specification as an alias to {{DOMMatrix}}.
17871791
Some user agents supported a <code>MSCSSMatrix</code> interface. Implementations conforming to
17881792
this specification will not support <code>MSCSSMatrix</code>.
17891793

1794+
<h2 class="no-num" id="conventions">Document conventions</h2>
1795+
1796+
The <dfn>NaN-safe minimum</dfn> of a non-empty list of {{unrestricted double}} values is NaN if any
1797+
member of the list is NaN, or the minimum of the list otherwise.
1798+
1799+
Analogously, the <dfn>NaN-safe maximum</dfn> of a non-empty list of {{unrestricted double}} values
1800+
is NaN if any member of the list is NaN, or the maximum of the list otherwise.
17901801

17911802
<h2 class="no-num" id="changes">Changes since last publication</h2>
17921803

0 commit comments

Comments
 (0)