Closed Bug 1774589 Opened 4 months ago Closed 1 month ago

[css-values-4] Implement trigonometric functions and constants

Categories

(Core :: CSS Parsing and Computation, enhancement)

Firefox 103
enhancement

Tracking

()

RESOLVED FIXED
105 Branch
Tracking Status
firefox105 --- fixed

People

(Reporter: seokho, Assigned: emilio)

References

(Blocks 2 open bugs, )

Details

(Keywords: dev-doc-needed)

Attachments

(1 file, 1 obsolete file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36

Expected results:

According to the new CSS specification [1], CSS should support trigonometric functions sin(), cos(), tan(), asin(), acos(), atan(), atan2().

[1] https://www.w3.org/TR/css-values-4/#trig-funcs

Component: Untriaged → CSS Parsing and Computation
Product: Firefox → Core
Blocks: css-values-4
Keywords: dev-doc-needed
Summary: CSS Trigonometric function should be implement in CSS → [css-values-4] Implement trigonometric functions

These are implemented already behind layout.css.trig.enabled. When I implemented them, the missing bits were test coverage.

Cool! Sounds like this is basically shippable. Is there already a bug for adding those tests? And should there be a separate one for shipping them or should this bug be used for that?

Sebastian

Depends on: 1729804
Flags: needinfo?(emilio)
Duplicate of this bug: 1785120
Summary: [css-values-4] Implement trigonometric functions → [css-values-4] Implement trigonometric functions and constants

For reference, the constants that are obviously also already implemented behind the pref mentioned in comment 1 are defined at https://drafts.csswg.org/css-values-4/#calc-constants.

Sebastian

We now have test coverage, so let's do this.

The remaining failures are just about infinity/nan, which is a
completely different feature.

Assignee: nobody → emilio
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

While I was looking at this, let's fix some incorrect tests.

The changes to expect simplification come from
https://drafts.csswg.org/css-values-4/#calc-simplification:

Internal representations of math functions are eagerly simplified to
the extent possible, using standard algebraic simplifications
(distributing multiplication over sums, combining similar units,
etc.)

The changes to tests that expected 0% / 0px / etc are just wrong because
the test harness treat 0 as the "default" used value, and fails. These
fail in all browsers.

Depends on D154831

Let's enable on nightly for now, we can enable everywhere after the soft freeze.

Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/03b2061c924b
Implement atan2(), and enable calc() trigonometric functions by default on nightly. r=boris
https://hg.mozilla.org/integration/autoland/rev/bcf5fcb47b4a
Fix a couple css-values tests while at it. r=boris
Failed to create upstream wpt PR due to merge conflicts. This requires fixup from a wpt sync admin.
Pushed by emilio@crisal.io:
https://hg.mozilla.org/integration/autoland/rev/1d850765046a
Annotate a test that's failing on macOS.
Regressions: 1785732

Backed out 5 changesets (Bug 1682444, Bug 1774589) for causing wpt failures on acos-asin-atan-atan2-serialize.html.
Backout link
Push with failures --> 1st push <--> push with fix
Failure Log wpt6 1st push <--> wpt6 push with fix

Flags: needinfo?(emilio)
Attachment #9290182 - Attachment description: Bug 1774589 - Implement atan2(), and enable calc() trigonometric functions by default on nightly. r=#style → Bug 1774589 - Implement atan2(), and enable calc() trigonometric functions by default on nightly. r=boris
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/02eccb000404
Implement atan2(), and enable calc() trigonometric functions by default on nightly. r=boris
https://hg.mozilla.org/integration/autoland/rev/fc449cf7d476
Fix a couple css-values tests while at it. r=boris
Attachment #9290182 - Attachment is obsolete: true
Flags: needinfo?(emilio)
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 105 Branch
Blocks: 1787070

I'm tracking documentation tasks for these changes in the following parent ticket on GitHub: https://github.com/mdn/content/issues/19832

Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/36038 for changes under testing/web-platform/tests
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.