Bug 243665

Summary: CSS `color-scheme` can't be assigned via CSS variable
Product: WebKit Reporter: Thomas Steiner <tomac>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED CONFIGURATION CHANGED    
Severity: Normal CC: akeerthi, ntim
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Correct behavior in Chrome
none
Incorrect behavior in Safari none

Description Thomas Steiner 2022-08-08 05:45:32 PDT
Created attachment 461482 [details]
Correct behavior in Chrome

It's impossible in Safari to make the following CSS work:

```css
:root {
  --color-scheme: dark light;
  color-scheme: var(--color-scheme);
}
```

Go to https://aboard-bustling-bit.glitch.me/ in Safari and inspect the `<input>` with the value "Just a test". Note how the computed style for the `color-scheme` is always `auto`. Run the same test in Chrome and see how it reflects what is set via `var(--color-scheme)`.
Comment 1 Thomas Steiner 2022-08-08 05:46:05 PDT
Created attachment 461483 [details]
Incorrect behavior in Safari
Comment 2 Tim Nguyen (:ntim) 2022-08-08 21:25:39 PDT
This seems fixed in tip of trunk.
Comment 3 Tim Nguyen (:ntim) 2022-08-08 21:28:14 PDT
I wonder if https://github.com/WebKit/WebKit/commit/5cd7506926c2b38de056ec7dec5c62d1a049c052 fixed it by avoiding applying the property twice.