Bug 231052

Summary: Stop parsing context-sensitive colors in override-color
Product: WebKit Reporter: Myles C. Maxfield <mmaxfield>
Component: TextAssignee: Myles C. Maxfield <mmaxfield>
Status: RESOLVED FIXED    
Severity: Normal CC: clopez, esprehn+autocc, ews-watchlist, glenn, gyuyoung.kim, macpherson, menard, mmaxfield, simon.fraser, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 230446    
Attachments:
Description Flags
Patch simon.fraser: review+

Comment 1 Radar WebKit Bug Importer 2021-09-30 17:45:34 PDT
<rdar://problem/83746258>
Comment 2 Myles C. Maxfield 2021-10-01 22:53:30 PDT
Created attachment 439954 [details]
Patch
Comment 3 EWS Watchlist 2021-10-01 22:54:55 PDT
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess
Comment 4 Simon Fraser (smfr) 2021-10-04 20:52:14 PDT
Comment on attachment 439954 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=439954&action=review

> Source/WebCore/css/StyleColor.cpp:54
> +    return (id >= CSSValueAqua && id <= CSSValueYellow) || (id >= CSSValueAliceblue && id <= CSSValueYellowgreen) || id == CSSValueGrey || id == CSSValueAlpha || id == CSSValueTransparent;

We should make some helpers to contain these color range tests

> Source/WebCore/css/parser/CSSPropertyParserHelpers.h:118
> +enum class AcceptableColorSyntax : uint8_t {

Not sure I like "Acceptable" here. Might be nicer to just have:

enum class CSSColorType {
  Absolute = 1 << 0,
  Current = 1 << 1,
  System = 1 << 2,
};

consumeColor(CSSParserTokenRange&, const CSSParserContext&, bool acceptQuirkyColors = false, OptionSet<CSSColorTypes> allowedColorTypes)
Comment 5 Myles C. Maxfield 2021-10-04 22:11:06 PDT
Committed r283537 (242502@main): <https://commits.webkit.org/242502@main>