Closed Bug 1820673 Opened 3 years ago Closed 3 years ago

Firefox fails a subtest in acos-asin-atan-atan2-computed.html which requires that we evaluate `tan(pi/2)` as +infinity

Categories

(Core :: CSS Parsing and Computation, defect)

defect

Tracking

()

RESOLVED INVALID

People

(Reporter: dholbert, Unassigned)

References

(Blocks 1 open bug)

Details

We fail a subtest in http://wpt.live/css/css-values/acos-asin-atan-atan2-computed.html
wpt.fyi: https://wpt.fyi/results/css/css-values/acos-asin-atan-atan2-computed.html

We fail this one subtest there:

assert_array_approx_equals: calc(sin(atan(tan(pi/2)))) and 1 0.1
serialize to the same thing in used values.
property 0, expected 1 +/- 0.1, expected 1 but got -1

That seems to boil down to us serializing tan(pi/2) as a giant negative number, where other browsers serialize it as a giant positive number.

Here's a reduced testcase for that (using 90deg instead of pi/2 to be more clearly associate with the spec text):

data:text/html,<div style="z-index: calc(tan(90deg))">What's my computed z-index?

If you use devtools to query for the computed style of the div in that reduced testcase, Firefox shows a large negative number:

z-index: -22877334

whereas Chromium and WebKit both show a large positive number:

z-index: 2147483647

It looks like the spec requires +infinity here (i.e. the Chromium/WebKit behavior):

In tan(A), if A is one of the asymptote values (such as 90deg, 270deg, etc), the result must be +∞ for 90deg

https://www.w3.org/TR/css-values-4/#trig-infinities

Severity: -- → S3
Summary: Firefox fails a subtest in acos-asin-atan-atan2-computed.html related to evaluating `tan(pi/2)` as +infinity → Firefox fails a subtest in acos-asin-atan-atan2-computed.html which requires that we evaluate `tan(pi/2)` as +infinity

(In reply to Daniel Holbert [:dholbert] from comment #0)

It looks like the spec requires +infinity here (i.e. the Chromium/WebKit behavior):

In tan(A), if A is one of the asymptote values (such as 90deg, 270deg, etc), the result must be +∞ for 90deg

https://www.w3.org/TR/css-values-4/#trig-infinities

The spec goes on to say that -90deg should produce -infinity -- and other browsers do produce a large negative number, whereas Firefox produces a large positive number. Here's a testcase for that:

data:text/html,<div style="z-index: calc(tan(-90deg))">What's my computed z-index?

So basically, it looks like we've got the result swapped for +90deg and -90deg.

Emilio's proposed removing these special cases for tan in https://github.com/w3c/csswg-drafts/issues/8527 -- let's see how that shakes out before taking action here...

As noted in that github issue, the spec calls out this edge-case as being tan(90deg) instead of tan(pi/2) which might make sense since pi/2 isn't precisely representable and hence makes for a bad sentinel value to have a particular specified behavior for. At a minimum, we should probably update the test here to use 90deg instead of pi/2, to better-ground its expectations in the spec text and to use a precisely-representable specified value.

(Though that doesn't fix our test-failure since we still have the opposite behavior from other browsers & the spec's expectations even with 90deg units, as noted above with my reduced data-URI testcases.)

This was just discussed in the CSSWG call, and we resolved to un-define this magic 90deg behavior, so I think this subtest is going to be removed.

Subtests were removed in WPT PR: https://github.com/web-platform-tests/wpt/pull/39803

We pass all subtests in this file now :)
Closing as invalid as no longer expected/spec behavior.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.