Skip to content

Commit

Permalink
[css-values-4] Define how to serialize a math function that's infinit…
Browse files Browse the repository at this point in the history
…e or NaN. Fixes #3768.
  • Loading branch information
tabatkins committed Oct 3, 2019
1 parent 6171c00 commit 1511ec2
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions css-values-4/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -3594,12 +3594,25 @@ Serialization</h3>
then serialize the value as normal
and return the result.

2. Let |s| be a [=string=] that initially contains
2. If |fn| represents an infinite or NaN value:
1. Let |s| be the [=string=] "calc(".
2. Create a numeric value
in the [=canonical unit=] for |fn|'s [=CSSNumericValue/type=]
(such as ''px'' for <<length>>),
with a value of 1 if |fn| represents +∞,
a value of -1 if |fn| represents −∞,
or a value of 0 if |fn| represents NaN.
Serialize this numeric value
and append it to |s|.
3. Append " / 0)" to |s|,
and return |s|.

3. Let |s| be a [=string=] that initially contains
the |fn|'s name
(such as "calc", "sin", etc)
followed by a "(" (open parenthesis).

3. For each comma-separated [=calculation=] argument of |fn|,
4. For each comma-separated [=calculation=] argument of |fn|,
[=serialize the calculation tree=].
If a result of this starts with a "(" (open parenthesis)
and ends with a ")" (close parenthesis),
Expand All @@ -3608,9 +3621,9 @@ Serialization</h3>
using ", " (comma followed by space),
then append the result to |s|.

4. Append ")" (close parenthesis) to |s|.
5. Append ")" (close parenthesis) to |s|.

5. Return |s|.
6. Return |s|.
</div>

<div algorithm>
Expand Down

0 comments on commit 1511ec2

Please sign in to comment.