[webkit-changes] [WebKit/WebKit] 959902: Support parsing hsl() colors on the fast path

Simon Fraser noreply at github.com
Fri Jul 19 19:55:13 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9599027820b8f3dce4f1d40182cb32021563202e
      https://github.com/WebKit/WebKit/commit/9599027820b8f3dce4f1d40182cb32021563202e
  Author: Simon Fraser <simon.fraser at apple.com>
  Date:   2024-07-19 (Fri, 19 Jul 2024)

  Changed paths:
    A LayoutTests/fast/css/invalid-color-parsing-hsl-expected.txt
    A LayoutTests/fast/css/invalid-color-parsing-hsl.html
    A LayoutTests/fast/css/invalid-color-parsing-rgb-expected.txt
    A LayoutTests/fast/css/invalid-color-parsing-rgb.html
    M Source/WebCore/css/parser/CSSParserFastPaths.cpp

  Log Message:
  -----------
  Support parsing hsl() colors on the fast path
https://bugs.webkit.org/show_bug.cgi?id=276836
rdar://132110971

Reviewed by Tim Nguyen.

Add support to CSSParserFastPaths for parsing `hsl()` and `hsla()` colors.

`parseSimpleAngle()` is enhanced to allow for optional units, which these colors allow.
Fix `checkForValidDouble()` to disallow a value with a trailing decimal point, since
CSS doesn't allow this.

Add some tests for invalid color parsing, to ensure we don't hit any of the `span<>` bounds
checks.

* LayoutTests/fast/css/invalid-color-parsing-hsl-expected.txt: Added.
* LayoutTests/fast/css/invalid-color-parsing-hsl.html: Added.
* LayoutTests/fast/css/invalid-color-parsing-rgb-expected.txt: Added.
* LayoutTests/fast/css/invalid-color-parsing-rgb.html: Added.
* Source/WebCore/css/parser/CSSParserFastPaths.cpp:
(WebCore::parseSimpleAngle):
(WebCore::checkForValidDouble):
(WebCore::parseRGBAlphaValue):
(WebCore::mightBeHSLA):
(WebCore::mightBeHSL):
(WebCore::parseLegacyHSL):
(WebCore::parseNumericColor):
(WebCore::parseTransformAngleArgument):
(WebCore::parseAlphaValue): Deleted.

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list