[webkit-changes] [WebKit/WebKit] f52fdf: [image-set] `type()` function should only take one...

Ryan Reno noreply at github.com
Sun May 21 19:13:55 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f52fdf6f4c9f397c3805f840728e05a644727733
      https://github.com/WebKit/WebKit/commit/f52fdf6f4c9f397c3805f840728e05a644727733
  Author: Ryan Reno <rreno at apple.com>
  Date:   2023-05-21 (Sun, 21 May 2023)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/css/css-images/image-set/image-set-parsing-expected.txt
    M Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp

  Log Message:
  -----------
  [image-set] `type()` function should only take one string
https://bugs.webkit.org/show_bug.cgi?id=256323
rdar://108909363

Reviewed by Tim Nguyen.

Parsing for the image-set type() function is both too restricted and not
strict enough. On the one hand, type( "image/png") (note the leading
space) would be rejected while type("image/png" "image/png") would be
accepted.

This change fixes both issues by being a little more smart about
handling the parser tokens passed to it and leaning on consumeString
being able to handle leading and trailing whitespace tokens.

We also need to be careful about not modifying the passed-in
CSSParserTokenRange until after we've validated that the argument to
type() was a single string. Otherwise we will hit an assert in the
resolution calc() consumer.

* LayoutTests/imported/w3c/web-platform-tests/css/css-images/image-set/image-set-parsing-expected.txt:
* Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::ImageSetTypeCSSPrimitiveValueKnownTokenTypeFunctionConsumer::consume):

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




More information about the webkit-changes mailing list