Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2ec549a69c98eba54620bc172e122b953bd2f845
      
https://github.com/WebKit/WebKit/commit/2ec549a69c98eba54620bc172e122b953bd2f845
  Author: Antti Koivisto <[email protected]>
  Date:   2026-05-06 (Wed, 06 May 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-css-wide-keywords-after-substitution-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-css-wide-keywords-after-substitution.html
    M Source/WebCore/css/parser/CSSPropertyParser.cpp
    M Source/WebCore/css/parser/CSSPropertyParser.h
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Ident.cpp
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Ident.h
    M Source/WebCore/style/StyleBuilder.cpp

  Log Message:
  -----------
  revert-layer doesn't compute correctly if there is a leading empty/space 
substitution
https://bugs.webkit.org/show_bug.cgi?id=312853
rdar://175729680

Reviewed by Alan Baradlay.

Given `--on: var(--space) revert-layer;` with `--space` empty,
https://drafts.csswg.org/css-values-5/#substitute-arbitrary-substitution-function
produces the token stream `[whitespace, ident(revert-layer)]`. Per
https://drafts.csswg.org/css-variables-2/#defining-variables this should take
effect as `revert-layer`. The post-substitution keyword check in
Builder::resolveCustomPropertyValue did not skip leading whitespace, so the
literal tokens were stored instead. `var(--on)` then expanded to
" revert-layer", producing an invalid declaration. All six CSS-wide keywords
were affected.

Test: 
imported/w3c/web-platform-tests/css/css-variables/variable-css-wide-keywords-after-substitution.html
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-css-wide-keywords-after-substitution-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-css-wide-keywords-after-substitution.html:
 Added.
* Source/WebCore/css/parser/CSSPropertyParser.cpp:
(WebCore::consumeCSSWideKeyword): Deleted.
(WebCore::CSSPropertyParser::parseCSSWideKeyword): Deleted.

Also move consumeCSSWideKeyword to CSSPropertyParserHelpers and remove static 
CSSPropertyParser::parseCSSWideKeyword.

* Source/WebCore/css/parser/CSSPropertyParser.h:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Ident.cpp:
(WebCore::CSSPropertyParserHelpers::consumeCSSWideKeyword):
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Ident.h:
* Source/WebCore/style/StyleBuilder.cpp:
(WebCore::Style::Builder::resolveCustomPropertyValue):

Consume any whitespace before trying to consume CSS-wide keyword. Usually there 
can't be any but var()
substitution might have inserted one.

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



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

Reply via email to