Closed Bug 1893966 Opened 1 year ago Closed 1 year ago

[css-color] Relative color syntax doesn't support the currentcolor keyword as origin color

Categories

(Core :: CSS Parsing and Computation, defect, P2)

defect

Tracking

()

RESOLVED FIXED
133 Branch
Tracking Status
firefox133 --- fixed

People

(Reporter: tlouw, Assigned: tlouw)

References

(Blocks 1 open bug)

Details

(Keywords: parity-safari)

Attachments

(1 file)

Right now currentcolor is resolved as BLACK to get the values from the origin color.

Currentcolor and other non-absolute origin colors should be preserved in the specified/calculated value until it can be resolved to absolute when a "color" is available.

Duplicate of this bug: 1890972
Depends on: 1851292
Keywords: parity-safari

I'm guessing this is related to the various relative-currentcolor-* failures that we have, right?

wpt.fyi:
https://wpt.fyi/results/css/css-color/relative-currentcolor-a98rgb-01.html
https://wpt.fyi/results/css/css-color/relative-currentcolor-displayp3-01.html
https://wpt.fyi/results/css/css-color/relative-currentcolor-hsl-01.html
https://wpt.fyi/results/css/css-color/relative-currentcolor-hsl-02.html
https://wpt.fyi/results/css/css-color/relative-currentcolor-hsl-02.html
https://wpt.fyi/results/css/css-color/relative-currentcolor-lab-01.html
https://wpt.fyi/results/css/css-color/relative-currentcolor-lch-01.html
https://wpt.fyi/results/css/css-color/relative-currentcolor-oklab-01.html
https://wpt.fyi/results/css/css-color/relative-currentcolor-oklch-01.html
https://wpt.fyi/results/css/css-color/relative-currentcolor-prophoto-01.html
https://wpt.fyi/results/css/css-color/relative-currentcolor-rec2020-01.html
https://wpt.fyi/results/css/css-color/relative-currentcolor-rec2020-02.html
https://wpt.fyi/results/css/css-color/relative-currentcolor-rgb-01.html
https://wpt.fyi/results/css/css-color/relative-currentcolor-rgb-02.html
https://wpt.fyi/results/css/css-color/relative-currentcolor-xyzd50-01.html
https://wpt.fyi/results/css/css-color/relative-currentcolor-xyzd65-01.html

They use syntax like...
background-color: color(from currentColor rec2020 r g b);
...which ends up rendering as black in the testcases that I looked at (and they get the rendering correct if I swap currentColor for green).

I used wpt.fyi "triage mode" to link up all of the tests in comment 2 to this bug.

I think our failures here are also mostly from this bug too, so I linked those up as well:
https://wpt.fyi/results/css/css-color/parsing/color-valid-relative-color.html
(filtered for failures: https://wpt.fyi/results/css/css-color/parsing/color-valid-relative-color.html?q=firefox%3Afail )
Specifically, 18 out of our 20 subtest-failures in that test are for syntax that involves from currentColor. (The other 2 subtest failures are for hsl(from rebeccapurple none none none / none) and the same value but with hsla; and all browsers currently fail those 2 subtests, FWIW.)

(FWIW Chrome just fixed their version of this bug, in https://issues.chromium.org/issues/325309578 , and I guess WebKit fixed their version a few months back in https://bugs.webkit.org/show_bug.cgi?id=245970 / https://github.com/WebKit/WebKit/pull/28445 .)

Tiaan, I think this is on your radar to take at some point -- if you can, it might be nice to front-load it ahead of grid interop fixes, since this one is responsible for such an outsized interop score bump.

(Chrome's fix for this one bug took them from ~15% to 95% in their interop-2024-relative-color score, and from 93.1% to 97.8% in overall score. This is a +80% delta in the relative-color category, and a 4.7% delta in the top-line interop-2024 score.)

Flags: needinfo?(tlouw)

FWIW, with that implemented, the overall interop score will also jump above 90% from currently 86%.

Sebastian

Depends on: 1920496

Patches is in progress.

Flags: needinfo?(tlouw)
Depends on: 1894263
Depends on: 1921766

This is an accumulation of all the changes to tests made by the patches
in this stack.

color-invalid-relative-color.html.ini tests that percentages are used
correctly inside calc(..) nodes. There are some edge cases we are not
passing. See: https://bugzilla.mozilla.org/show_bug.cgi?id=1894263

relative-color-out-of-gamut.html.ini does conversions from an out of
gamma color to the rgb(..) syntax. Relative colors should not use the
rgb(..) syntax any more, but the color(srgb ..) syntax instead. See:
https://bugzilla.mozilla.org/show_bug.cgi?id=1921766

color-computed-relative-color.html.ini has some errors where the
none keyword is not forwarded from the origin color to the final
color according to the spec. It also has the same out of gamma tests
that is in relative-color-out-of-gamut.html.ini. See:
https://bugzilla.mozilla.org/show_bug.cgi?id=1899009 which is
dependent on clarification of the spec here:
https://github.com/w3c/csswg-drafts/issues/10360

color-valid-relative-color.html.ini contains serialization
discrepencies where the calc(..) keyword is used if the origin values
were specified with calc(..), but according to the color spec, the
calc(..) is not needed for color components. These tests are dependent
on the outcome of:
https://github.com/web-platform-tests/wpt/issues/47921

Assignee: nobody → tlouw
Attachment #9428083 - Attachment description: WIP: Bug 1893966 - Tests for supporting currentcolor in relative color syntax r=emilio,#layout → Bug 1893966 - Tests for supporting currentcolor in relative color syntax r=emilio,#layout
Status: NEW → ASSIGNED
Pushed by tlouw@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b0ef844bc744 Tests for supporting currentcolor in relative color syntax r=emilio,layout-reviewers
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 133 Branch
No longer depends on: 1921766
No longer depends on: 1894263
No longer depends on: 1851292
Depends on: 1885912
Depends on: 1914907
Blocks: 1897837
Blocks: 1918060
Regressions: 1986324
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: