Bug 224810 - Support <custom-ident> in color-scheme
Summary: Support <custom-ident> in color-scheme
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
: 225779 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-04-20 04:12 PDT by Tim Nguyen (:ntim)
Modified: 2022-08-18 21:03 PDT (History)
13 users (show)

See Also:


Attachments
Patch (27.83 KB, patch)
2021-04-20 08:32 PDT, Tim Nguyen (:ntim)
no flags Details | Formatted Diff | Diff
Patch (71.76 KB, patch)
2021-04-22 00:50 PDT, Tim Nguyen (:ntim)
no flags Details | Formatted Diff | Diff
Patch (112.23 KB, patch)
2021-04-25 15:36 PDT, Tim Nguyen (:ntim)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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)