[webkit-changes] [WebKit/WebKit] 8c8cfb: Clean up code for internal CSS values

Tim Nguyen noreply at github.com
Tue Jan 16 08:51:50 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8c8cfbf1f0f0640439a7a9d5d2972c972b7063a7
      https://github.com/WebKit/WebKit/commit/8c8cfbf1f0f0640439a7a9d5d2972c972b7063a7
  Author: Tim Nguyen <ntim at apple.com>
  Date:   2024-01-16 (Tue, 16 Jan 2024)

  Changed paths:
    M Source/WebCore/css/parser/CSSParserContext.cpp
    M Source/WebCore/css/parser/CSSParserFastPaths.cpp
    M Source/WebCore/css/parser/CSSParserIdioms.cpp
    M Source/WebCore/css/parser/CSSParserIdioms.h
    M Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp
    M Source/WebCore/css/parser/CSSSelectorParser.cpp
    M Source/WebCore/css/process-css-properties.py
    M Source/WebCore/css/process-css-pseudo-selectors.py

  Log Message:
  -----------
  Clean up code for internal CSS values
https://bugs.webkit.org/show_bug.cgi?id=267520
rdar://121019340

Reviewed by Darin Adler.

Right now, if you want to make a certain value internal, you have to do 2 changes:
1) Add "status": "internal" to CSSProperties.json
2) Change isValueAllowedInMode() to include your value

This is error prone, as it's easy to think that the first step is sufficient.

With this change:
- the first step will be sufficient to make a value UA-sheet only
- isValueAllowedInMode is now named isColorKeywordAllowedInMode as it's now only used for color parsing.
- we now validate that all values starting with "-internal-" have "status": "internal" in CSSProperties.json

Also use isUASheetBehavior whenever possible.

* Source/WebCore/css/parser/CSSParserContext.cpp:
(WebCore::CSSParserContext::CSSParserContext):
* Source/WebCore/css/parser/CSSParserFastPaths.cpp:
(WebCore::parseColor):
* Source/WebCore/css/parser/CSSParserIdioms.cpp:
(WebCore::isColorKeywordAllowedInMode):
(WebCore::isValueAllowedInMode): Deleted.
* Source/WebCore/css/parser/CSSParserIdioms.h:
* Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::LengthRawKnownTokenTypeDimensionConsumer::consume):
(WebCore::CSSPropertyParserHelpers::consumeColorWorkerSafe):
(WebCore::CSSPropertyParserHelpers::consumeColor):
(WebCore::CSSPropertyParserHelpers::consumeCounterStyleNameInPrelude):
(WebCore::CSSPropertyParserHelpers::consumeDisplay):
* Source/WebCore/css/parser/CSSSelectorParser.cpp:
(WebCore::extractCompoundFlags):
(WebCore::CSSSelectorParser::consumeSimpleSelector):
(WebCore::CSSSelectorParser::splitCompoundAtImplicitShadowCrossingCombinator):
* Source/WebCore/css/process-css-properties.py:
Directly check for UASheetMode and add validation for `-internal-` values that they use correct "status" field.

* Source/WebCore/css/process-css-pseudo-selectors.py:
The .join() case also works fine for when there's only one condition.

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




More information about the webkit-changes mailing list