Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[geometry-1] Define minimum and maximum as preferring NaN #395

Merged
merged 1 commit into from
Apr 1, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 31 additions & 20 deletions geometry/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -368,17 +368,21 @@ for=rectangle>height dimension</a> value. For the {{DOMRect}} interface, setting
{{DOMRect/height}} attribute must set the <a for=rectangle>height dimension</a> value to the new
value.

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

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

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

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


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

1. Let <var>bounds</var> be a {{DOMRect}} object.
2. Let <var>left</var> be the minimum of <a for=quadrilateral>point 1</a>'s <a for=point>x
coordinate</a>, <a for=quadrilateral>point 2</a>'s <a for=point>x coordinate</a>, <a
for=quadrilateral>point 3</a>'s <a for=point>x coordinate</a> and <a for=quadrilateral>point
2. Let <var>left</var> be the <a>NaN-safe minimum</a> of <a for=quadrilateral>point 1</a>'s <a
for=point>x coordinate</a>, <a for=quadrilateral>point 2</a>'s <a for=point>x coordinate</a>,
<a for=quadrilateral>point 3</a>'s <a for=point>x coordinate</a> and <a for=quadrilateral>point
4</a>'s <a for=point>x coordinate</a>.
3. Let <var>top</var> be the minimum of <a for=quadrilateral>point 1</a>'s <a for=point>y
coordinate</a>, <a for=quadrilateral>point 2</a>'s <a for=point>y coordinate</a>, <a
for=quadrilateral>point 3</a>'s <a for=point>y coordinate</a> and <a for=quadrilateral>point
3. Let <var>top</var> be the <a>NaN-safe minimum</a> of <a for=quadrilateral>point 1</a>'s <a
for=point>y coordinate</a>, <a for=quadrilateral>point 2</a>'s <a for=point>y coordinate</a>,
<a for=quadrilateral>point 3</a>'s <a for=point>y coordinate</a> and <a for=quadrilateral>point
4</a>'s <a for=point>y coordinate</a>.
4. Let <var>right</var> be the maximum of <a for=quadrilateral>point 1</a>'s <a for=point>x
coordinate</a>, <a for=quadrilateral>point 2</a>'s <a for=point>x coordinate</a>, <a
for=quadrilateral>point 3</a>'s <a for=point>x coordinate</a> and <a for=quadrilateral>point
4. Let <var>right</var> be the <a>NaN-safe maximum</a> of <a for=quadrilateral>point 1</a>'s <a
for=point>x coordinate</a>, <a for=quadrilateral>point 2</a>'s <a for=point>x coordinate</a>,
<a for=quadrilateral>point 3</a>'s <a for=point>x coordinate</a> and <a for=quadrilateral>point
4</a>'s <a for=point>x coordinate</a>.
5. Let <var>bottom</var> be the maximum of <a for=quadrilateral>point 1</a>'s <a for=point>y
coordinate</a>, <a for=quadrilateral>point 2</a>'s <a for=point>y coordinate</a>, <a
for=quadrilateral>point 3</a>'s <a for=point>y coordinate</a> and <a for=quadrilateral>point
5. Let <var>bottom</var> be the <a>NaN-safe maximum</a> of <a for=quadrilateral>point 1</a>'s <a
for=point>y coordinate</a>, <a for=quadrilateral>point 2</a>'s <a for=point>y coordinate</a>,
<a for=quadrilateral>point 3</a>'s <a for=point>y coordinate</a> and <a for=quadrilateral>point
4</a>'s <a for=point>y coordinate</a>.
6. Set <a for=rectangle>x coordinate</a> of <var>bounds</var> to <var>left</var>, <a
for=rectangle>y coordinate</a> of <var>bounds</var> to <var>top</var>, <a for=rectangle>width
Expand Down Expand Up @@ -1787,6 +1791,13 @@ Web. It is defined in this specification as an alias to {{DOMMatrix}}.
Some user agents supported a <code>MSCSSMatrix</code> interface. Implementations conforming to
this specification will not support <code>MSCSSMatrix</code>.

<h2 class="no-num" id="conventions">Document conventions</h2>

The <dfn>NaN-safe minimum</dfn> of a non-empty list of {{unrestricted double}} values is NaN if any
member of the list is NaN, or the minimum of the list otherwise.

Analogously, the <dfn>NaN-safe maximum</dfn> of a non-empty list of {{unrestricted double}} values
is NaN if any member of the list is NaN, or the maximum of the list otherwise.

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

Expand Down