Closed Bug 1744847 Opened 3 years ago Closed 3 years ago

WPT test grid-area-computed.html needs to be permissive of shorter serializations

Categories

(Core :: Layout: Grid, defect)

defect

Tracking

()

RESOLVED FIXED
97 Branch
Tracking Status
firefox97 --- fixed

People

(Reporter: dholbert, Assigned: dholbert)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

We fail 10 subtests from WPT test grid-area-computed.html right now, which I think is due simply to our selection of more-concise serializations for the computed values of some properties.

WPT.fyi link:
https://wpt.fyi/results/css/css-grid/parsing/grid-area-computed.html
Live link to test:
https://wpt.live/css/css-grid/parsing/grid-area-computed.html

The simplest cases are the first two, where e.g. the test expects auto / auto / auto / auto but we serialize as auto (which is equivalent and shorter).

Filing this bug to fix up the test to get us passing.

The relevant spec text is here, for the grid-row parts of this test:
https://www.w3.org/TR/css-grid-1/#propdef-grid-row

It effectively says the second value can be omitted if it's the same as the first value (which is what we're doing in our serialization).

For grid-area, the spec text is:
https://www.w3.org/TR/css-grid-1/#propdef-grid-area

It says the 4-value-syntax encodes row-start / col-start / row-end / col-end. If there are fewer than four values, then the missing value(s) are assumed to be the last one(s) in this syntax, and are assumed to match their corresponding value from earlier in the syntax, if it's a <custom-ident>, and otherwise are assumed to be auto.

So for example in this failing case...

Fail	Property grid-area value 'auto / i / auto / i'
assert_equals: expected "auto / i / auto / i" but got "auto / i"

...our behavior is clearly valid -- we're fine to drop the trailing auto / i (which represents row-end / col-end), and that doesn't lose any meaning, since they are then implicitly the same as row-start / col-start which are specified in our shorter serialization of auto / i here.

The WPT test grid-area-computed.html seems to expect its shorthands to
serialize (via getComputedStyle) with the verbose all-subproperties-specified
syntax. But the spec allows shorter syntax, where later values are implicitly
the same as the earlier corresponding value (or implicitly 'auto', when the
earlier value isn't a <custom-ident>). Firefox uses this shorter syntax in its
getCommputedStyle serialization, where possible, with no loss of meaning.

This commit adjusts the WPT test to allow for both the shorter and longer
serialization, in the cases where Firefox chooses something shorter than what
the test is expecting.

Here's a diagnostic patch that I used locally, to confirm that the shorter and longer serializations are in fact equivalent. I verified that Chrome and Firefox pass the assertions in this diagnostic patch; this confirms that Chrome and Firefox agree that the serialization-options in my main patch are indeed equivalent (despite Firefox and Chrome having different preferences about which one to serialize into).

(side note / spitballing: It might be nice to have something like the diagnostic patch included in WPT, but I'm not sure if it would be worth doing, since it might cause test failures for cases where a test is intending to allow multiple syntaxes and some of those syntaxes aren't understood by one or more browser engines, or they're mutually incompatible for some reason [e.g. unresolved spec issues]. In that scenario, such a diagnostic would end up being kind of a cumbersome footgun which would make it harder to write permissive tests. I suppose we could work around that by allowing for an "opt-out" parameter to be passed in those cases, to skip the diagnostic, though... But in any case, I don't actually want to do this right now; I'm just using the diagnostic to validate my own work here. :) )

Pushed by dholbert@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c547f1331c2e Adjust WPT grid-area-computed.html to allow valid shorter serializations. r=emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/31959 for changes under testing/web-platform/tests
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 97 Branch
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: