Bug 224810

Summary: Support <custom-ident> in color-scheme
Product: WebKit Reporter: Tim Nguyen (:ntim) <ntim>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: changseok, darin, esprehn+autocc, ews-watchlist, glenn, gyuyoung.kim, kondapallykalyan, macpherson, menard, pdr, rune.lillesveen, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Tim Nguyen (:ntim) 2021-04-20 04:12:18 PDT
There are a couple of failures from the color-scheme WPT: https://wpt.fyi/results/css/css-color-adjust/parsing/color-scheme-computed.html?label=experimental&label=master&aligned, this is because WebKit implements an older spec.

Latest spec (implemented by Chromium): https://drafts.csswg.org/css-color-adjust-1/#color-scheme-prop

Here are differences from the spec that WebKit should implement:

* `auto` keyword is now `normal` (and `auto` becomes a `<custom-ident>` value)
* `only` keyword has been removed, and is just considered as a `<custom-ident>` value
* `<custom-ident>` values should be kept in the serialized CSS value (not sure that's part of the spec, but the WPT seems to reflect that)

Things where the WPT could be more flexible or wrong:

* Ordering of the color-schemes
* `only only` being serialized as it is? Since specifying a color-scheme multiple times is the same as specifying it once, maybe `only` is an acceptable serialization too?
Comment 1 Radar WebKit Bug Importer 2021-04-20 04:12:47 PDT
<rdar://problem/76892358>
Comment 2 Tim Nguyen (:ntim) 2021-04-20 08:32:51 PDT
Created attachment 426549 [details]
Patch
Comment 3 Tim Nguyen (:ntim) 2021-04-22 00:50:12 PDT
Created attachment 426784 [details]
Patch
Comment 4 Tim Nguyen (:ntim) 2021-04-25 15:36:19 PDT
Created attachment 427012 [details]
Patch
Comment 5 Timothy Hatcher 2021-04-26 18:26:48 PDT
This needs work to make sure it does not regress Mail and the auto-dark mode transformations it does (specifically the rename of auto to normal, and handling only).

I think it is a mistake to remove the internally handling of "only" in WebKit. I don't think us supporting it conflicts with the spec's wording of custom identifiers. We would just need to handle other custom identifiers for sterilization in addition to our handling of "only".
Comment 6 Tim Nguyen (:ntim) 2021-04-26 21:01:33 PDT
> This needs work to make sure it does not regress Mail and the auto-dark mode transformations it does (specifically the rename of auto to normal, and handling only).

> I think it is a mistake to remove the internally handling of "only" in WebKit. I don't think us supporting it conflicts with the spec's wording of custom identifiers. We would just need to handle other custom identifiers for sterilization in addition to our handling of "only".

Yeah, hence why I didn't land it yet. I was planning on either fixing Mail, or handling <custom-ident> properly in a separate bug.
Comment 7 Tim Nguyen (:ntim) 2021-05-24 01:27:33 PDT
*** Bug 225779 has been marked as a duplicate of this bug. ***
Comment 8 Tim Nguyen (:ntim) 2021-05-24 01:28:53 PDT
Update: I have a local WIP covering <custom-ident> too, though it seems like the spec might change again, so I'll wait for that to happen.
Comment 9 Joonghun Park 2021-09-23 17:26:42 PDT
*** Bug 205799 has been marked as a duplicate of this bug. ***
Comment 10 Tim Nguyen (:ntim) 2022-08-18 21:03:07 PDT
Probably easier to do this in parts:

1. renaming `auto` to `normal`
2. support <custom-ident> and return schemes in specified order

I'll split 1. to a different bug.

(Also `only` was re-added to the spec)