RESOLVED FIXED 220940
Support percentages when parsing color(srgb ...) and color(display-p3 ...) per-spec
https://bugs.webkit.org/show_bug.cgi?id=220940
Summary Support percentages when parsing color(srgb ...) and color(display-p3 ...) pe...
Sam Weinig
Reported 2021-01-25 11:53:05 PST
Per-spec, we should support percentages when parsing color(srgb ...) and color(display-p3 ...) - https://www.w3.org/TR/css-color-4/#predefined.
Attachments
Patch (9.41 KB, patch)
2021-01-25 12:59 PST, Sam Weinig
no flags
Patch (9.41 KB, patch)
2021-01-25 13:01 PST, Sam Weinig
no flags
Patch (10.40 KB, patch)
2021-01-25 14:13 PST, Sam Weinig
no flags
Sam Weinig
Comment 1 2021-01-25 12:59:26 PST Comment hidden (obsolete)
Sam Weinig
Comment 2 2021-01-25 13:01:01 PST
Darin Adler
Comment 3 2021-01-25 13:24:47 PST
Comment on attachment 418326 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=418326&action=review > Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:886 > if (consumeNumberRaw(args, value)) Seems like it’s time to change consumeNumberRaw to return Optional<double>. I’m tempted to put that patch together. > Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:906 > + double colorChannels[3] = { 0, 0, 0 }; IN a short function like this that is all about color, why not just name this "channels"? > Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:911 > + colorChannels[0] = static_cast<float>(*lightness); Don’t think we need a cast here. > LayoutTests/TestExpectations:4590 > +webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-003.html [ Failure ] # Invalid test, no colorspace specified > +webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-004.html [ Failure ] # Invalid test, no colorspace specified > +webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-007.html [ Failure ] # Requires a98-rgb support > +webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-008.html [ Failure ] # Requires a98-rgb support > +webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-009.html [ Failure ] # Requires prophoto-rgb support > +webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-010.html [ Failure ] # Requires prophoto-rgb support > +webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-011.html [ Failure ] # Requires rec2020 support > +webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-012.html [ Failure ] # Requires rec2020 support > +webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-014.html [ Failure ] # Requires fallback (at parse time) support > +webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-015.html [ Failure ] # Requires fallback (at parse time) support (unclear if this makes sense) > +webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-016.html [ Failure ] # Requires xyz support > +webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-017.html [ Failure ] # Requires xyz support Love these comments!
Sam Weinig
Comment 4 2021-01-25 14:09:49 PST
(In reply to Darin Adler from comment #3) > Comment on attachment 418326 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=418326&action=review > > > Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:886 > > if (consumeNumberRaw(args, value)) > > Seems like it’s time to change consumeNumberRaw to return Optional<double>. > I’m tempted to put that patch together. If you don't I will! > > > Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:906 > > + double colorChannels[3] = { 0, 0, 0 }; > > IN a short function like this that is all about color, why not just name > this "channels"? Yeah, that's better. > > > Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:911 > > + colorChannels[0] = static_cast<float>(*lightness); > > Don’t think we need a cast here. Cool. > > > LayoutTests/TestExpectations:4590 > > +webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-003.html [ Failure ] # Invalid test, no colorspace specified > > +webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-004.html [ Failure ] # Invalid test, no colorspace specified > > +webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-007.html [ Failure ] # Requires a98-rgb support > > +webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-008.html [ Failure ] # Requires a98-rgb support > > +webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-009.html [ Failure ] # Requires prophoto-rgb support > > +webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-010.html [ Failure ] # Requires prophoto-rgb support > > +webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-011.html [ Failure ] # Requires rec2020 support > > +webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-012.html [ Failure ] # Requires rec2020 support > > +webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-014.html [ Failure ] # Requires fallback (at parse time) support > > +webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-015.html [ Failure ] # Requires fallback (at parse time) support (unclear if this makes sense) > > +webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-016.html [ Failure ] # Requires xyz support > > +webkit.org/b/220928 imported/w3c/web-platform-tests/css/css-color/predefined-017.html [ Failure ] # Requires xyz support > > Love these comments! Yeah, meant to land these the first time.
Sam Weinig
Comment 5 2021-01-25 14:13:41 PST
EWS
Comment 6 2021-01-25 15:32:21 PST
Committed r271866: <https://trac.webkit.org/changeset/271866> All reviewed patches have been landed. Closing bug and clearing flags on attachment 418335 [details].
Radar WebKit Bug Importer
Comment 7 2021-01-25 15:33:30 PST
Note You need to log in before you can comment on or make changes to this bug.