Closed Bug 1821893 Opened 2 years ago Closed 2 years ago

Update color-mix() serialization to better align with the spec.

Categories

(Core :: CSS Parsing and Computation, defect)

defect

Tracking

()

RESOLVED FIXED
113 Branch
Tracking Status
firefox113 --- fixed

People

(Reporter: tlouw, Assigned: tlouw)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

color-mix() uses a calculation to determine whether a percentage in color-mix serialization can be omitted or not. here

The spec and wpt tests seems to just check whether the author added the percentage or not. spec

Now just keep track of whether the author omitted either of the
percentages and take that into account again when serializing.

What in the spec says this? In general we use the shortest serialization principle to omit percentages that can be omitted.

Flags: needinfo?(tlouw)

The spec doesn't specifically say this, but it doesn't say anything about omitting them either. The wpt tests in css/css-color/parsing/color-valid-color-mix-function.html follows the "omit if author omitted" guideline.

Would you rather we clarify the spec or for now just pass the wpt tests?

Flags: needinfo?(tlouw)

I think we should fix the tests. Lacking an explicit spec quote the shortest serialization principle applies, from https://drafts.csswg.org/cssom/#serialize-a-css-value:

If component values can be omitted or replaced with a shorter representation without changing the meaning of the value, omit/replace them.

As all 3 other browsers on wpt follow the tests as is, I added a issue on csswg here: https://github.com/w3c/csswg-drafts/issues/8564 just to clarify, rather then break everyone's tests.

Do you think its worth landing this in the meantime?

Changing this bug to update the WPT tests in stead as per discussion in the w3c issue here: https://github.com/w3c/csswg-drafts/issues/8564

Summary: color-mix() does not follow spec when omitting percentages → Update color-mix() serialization to better align with the spec.
Severity: -- → S3
Attachment #9322590 - Attachment is obsolete: true

After a discussion here https://github.com/w3c/csswg-drafts/issues/8564
I'm changing the tests to follow the shortest serialization principle
when serializing color-mix functions.

Biggest change is the left percentage is always present when the left
and right add up to 100%, even if the right was specified.

Assignee: nobody → tlouw
Status: NEW → ASSIGNED
Pushed by tlouw@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ab0d00ede27e Fix wpt tests to follow shortest serialization principle r=emilio
Failed to create upstream wpt PR due to merge conflicts. This requires fixup from a wpt sync admin.
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 113 Branch

(In reply to Web Platform Test Sync Bot (Matrix: #interop:mozilla.org) from comment #9)

Failed to create upstream wpt PR due to merge conflicts. This requires fixup
from a wpt sync admin.

Hmm, it looks like this^ never got resolved, so these changes never made it upstream.

As a result, wpt.fyi shows us failing a bunch of subtests in this test, with the first one being !EQ("color-mix(in hsl, red 60%, blue 40%)", "color-mix(in hsl, red 60%, blue)"), which was the first subtest that we fixed up here:
https://hg.mozilla.org/integration/autoland/rev/ab0d00ede27e#l2.12

jgraham, what do you suggest doing at this point?

(My guess: given that this test is interop-2023-score-impacting, I suspect we need to file a 'test change proposal' issue at https://github.com/web-platform-tests/interop/issues?page=1&q=is%3Aissue+label%3Atest-change-proposal+created%3A%3E2023-01-01 , correct? And then should we manually generate an upstream pull request to cover our diffs here, or something else?)

Flags: needinfo?(james)

(preemptively ticking ni=tlouw to follow up on whatever jgraham recommends in response to comment 11)

Flags: needinfo?(tlouw)

Yeah, I think at this point it would be best if we could make an upstream PR for our changes, and file a test change proposal issue, so that they can go through the approval process. If we can do that today they'll probably come up in the meeting tomorrow (not necessary, but sometimes helpful).

Flags: needinfo?(james)

I created this PR to sync the changes made here: https://github.com/web-platform-tests/wpt/pull/40500

I suspect we will get a conflict when pulling from upstream again once the changes have landed, but then we can just use whatever comes from upstream.

Flags: needinfo?(tlouw)
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/40808 for changes under testing/web-platform/tests

That PR should be empty and is just to convince the sync bot that there's nothing to do here.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: