Closed Bug 1899272 Opened 4 months ago Closed 4 months ago

color from registered property set with light-dark() have different values in Firefox and Chrome in dark mode

Categories

(Core :: CSS Parsing and Computation, defect)

defect

Tracking

()

VERIFIED FIXED
128 Branch
Tracking Status
firefox128 --- verified
firefox129 --- verified

People

(Reporter: nchevobbe, Assigned: emilio)

References

Details

Attachments

(2 files)

Steps to reproduce

  1. Set your OS appearance setting to "dark"
  2. Open the attached HTML file in both Chrome and Firefox

Expected results

I'm seeing the same result in both browsers

Actual results

In Firefox, the square is red, in Chrome, it's blue.


Here's the CSS:

      @property --x {
        inherits: true;
        initial-value: black;
        syntax: "<color>";
      }

      body {
        color-scheme: light dark;
        --x: light-dark(red, blue);
      }

      .swatch {
        background-color: var(--x);
      }

in Chrome, while in dark mode, the value of --x does seem to get its value from the second argument of light-dark().

Not sure if this is a bug in Firefox or in Chrome, and whether the issue is in @property or in light-dark

Note that if I'm setting --x in .swatch directly, I do get a blue square in Firefox

      @property --x {
        inherits: true;
        initial-value: black;
        syntax: "<color>";
      }

      body {
        color-scheme: light dark;
      }

      .swatch {
        --x: light-dark(red, blue);
        background-color: var(--x);
      }

So I guess something's might be off with how we deal with inherits ?

We're not getting the application order right between color-scheme and --x in your first example. We should apply color-scheme first, then --x.

This is a bit less complicated than lengths because there's no cycle
possible which could turn the color-scheme declaration invalid afaict.

So it's just that we need to defer the colors when color-scheme is
specified, which is slightly annoying, but maybe not too bad.

Better naming for the flags appreciated, if you have any suggestion...

Assignee: nobody → emilio
Status: NEW → ASSIGNED
Blocks: 1864818
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/acfd5e328aa9 Defer computation of registered custom color properties if needed. r=dshin,firefox-style-system-reviewers,zrhoffman
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/46536 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 128 Branch
Upstream PR merged by moz-wptsync-bot
Regressions: 1900623
QA Whiteboard: [qa-128b-p2]

Issue is reproducible on a 2024-05-28 Nightly build on Windows 10.
Verified as fixed on Firefox 128.0b4 and Firefox Nightly 129.0a1 on Windows 10, Ubuntu 22, macOS 14.

Status: RESOLVED → VERIFIED
QA Whiteboard: [qa-128b-p2]
Regressions: 1905604
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: