Skip to content

[css-values-4] Clean up trig function definitions #3761

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

Merged
merged 2 commits into from
Mar 26, 2019

Conversation

AmeliaBR
Copy link
Contributor

Related to #2331 and commit b8935e7

The only normative change (from Tab's commit) is that atan2()
is changed to support values with dimensions (so long as both dimensions are the same).
I don't see any implementation reason not to allow it;
they type checking rules are the same as hypot
(except that the types cancel out, so don't affect the final type of the function).

Most other corrections should be obvious in the diff.

I changed the note about atan2 because it used terminology
based on a y-axis-up coordinate system
and CSS/SVG uses a y-axis-down system.

I changed the notes about simplifying at computed value time
to refer to calculations instead of math functions,
because some complex nested functions cannot be simplified early.
(E.g., hypot(100%, 5em) can't be simplified until percentages can be turned into lengths.)

Edits still required:

The Syntax and Serialization sections should probably include entries for the new functions. But I wasn't sure how that should look.

PS, Thanks for the main commit @tabatkins! I'd said I'd give it a go, but who knows when I would have got to it.

(And I probably would have just linked to ECMAScript for all the stuff to do with infinities and NaN.)

The only normative change is that `atan2()`
is changed to support values with dimensions (so long as both dimensions are the same).
I don't see any implementation reason not to allow it;
they type checking rules are the same as `hypot`
(except that the types cancel out, so don't affect the final type of the function).

Most other corrections should be obvious in the diff.

I changed the note about atan2 because it used terminology
based on a y-axis-up coordinate system
and CSS/SVG uses a y-axis-down system.

I changed the notes about simplifying at computed value time
to refer to _calculations_ instead of _math functions_,
because some complex nested functions cannot be simplified early.
(E.g., `hypot(100%, 5em)` can't be simplified until percentages can be turned into lengths.)

**Edits still required:**

The [Syntax](https://drafts.csswg.org/css-values/#calc-syntax) and
[Serialization](https://drafts.csswg.org/css-values/#calc-serialize) sections
should probably include entries for the new functions.
But I wasn't sure how that should look.
@AmeliaBR AmeliaBR requested a review from tabatkins March 26, 2019 01:40
@tabatkins tabatkins merged commit 3ed7e84 into master Mar 26, 2019
@tabatkins tabatkins deleted the AmeliaBR-patch-trig branch March 26, 2019 17:22
@tabatkins
Copy link
Member

Thanks for the fixes!

@syncbot syncbot restored the AmeliaBR-patch-trig branch March 29, 2019 17:23
@plinss plinss deleted the AmeliaBR-patch-trig branch April 5, 2019 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants