[webkit-changes] [WebKit/WebKit] 77b199: color() function parsing incorrectly parses missin...

Tim Nguyen noreply at github.com
Fri Mar 24 14:34:56 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 77b199a5f0447aa578394389d7c83eba85c98595
      https://github.com/WebKit/WebKit/commit/77b199a5f0447aa578394389d7c83eba85c98595
  Author: Tim Nguyen <ntim at apple.com>
  Date:   2023-03-24 (Fri, 24 Mar 2023)

  Changed paths:
    M LayoutTests/css3/color/color-function-computed-style-expected.txt
    M LayoutTests/css3/color/color-function-computed-style.html
    M LayoutTests/css3/color/color-function-parsing-expected.txt
    M LayoutTests/css3/color/color-function-parsing.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-color/parsing/color-invalid-color-function-expected.txt
    M Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp

  Log Message:
  -----------
  color() function parsing incorrectly parses missing components
https://bugs.webkit.org/show_bug.cgi?id=251152
rdar://104679823

Reviewed by Darin Adler and Sam Weinig.

Start rejecting missing components in color() function.

Context:

>From Emilio:
color(srgb / 0.5) seems to parse on safari with the components zeroed out, but that seems wrong per spec. https://w3c.github.io/csswg-drafts/css-color-4/#funcdef-color only says the alpha is optional.

>From Chris Lilley:
This used to be correct per spec, long ago when color() also did custom color spaces and it was reasonable to omit some components and have them auto-filled with zero.

Now custom color spaces are in CSS Color 5, and clearly distinguished with a dashed-ident; while predefined color spaces are in CSS Color 4 and are wither an RGB space or an XYZ space. Both take 3 components, as the grammar makes clear.

There was some leftover prose about variable number of components, not up to date with the grammar change, which I just corrected.

* LayoutTests/css3/color/color-function-computed-style-expected.txt:
* LayoutTests/css3/color/color-function-computed-style.html:
* LayoutTests/css3/color/color-function-parsing-expected.txt:
* LayoutTests/css3/color/color-function-parsing.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-color/parsing/color-invalid-color-function-expected.txt:
* Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::parseColorFunctionForRGBTypesRaw):
(WebCore::CSSPropertyParserHelpers::parseColorFunctionForXYZTypesRaw):

Canonical link: https://commits.webkit.org/262098@main




More information about the webkit-changes mailing list