Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 2f8d1192d466f5a687fd01e50bfa428ebe9bf37a
https://github.com/WebKit/WebKit/commit/2f8d1192d466f5a687fd01e50bfa428ebe9bf37a
Author: Ahmad Saleem <[email protected]>
Date: 2026-05-27 (Wed, 27 May 2026)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/css/css-conditional/container-queries/custom-property-style-query-multiline-var-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/css/css-conditional/container-queries/custom-property-style-query-multiline-var.html
M Source/WebCore/style/StyleSubstitutionResolver.cpp
Log Message:
-----------
@container style() does not match custom property whose var() fallback spans
multiple lines
https://bugs.webkit.org/show_bug.cgi?id=303059
rdar://165627262
Reviewed by Antti Koivisto.
This patch aligns WebKit with Blink / Chromium.
When a declaration such as:
--my-container-var: var(--my-undefined-var, "my-default-value");
is reformatted across multiple lines (for example by Prettier),
--my-container-var: var(
--my-undefined-var,
"my-default-value"
);
the var() fallback no longer matched a style container query of
@container style(--my-container-var: "my-default-value"). Whitespace
introduced after the comma was correctly skipped (consumeIncludingWhitespace
already handled that), but whitespace before the closing parenthesis was
folded into the substituted token stream, leaving a trailing newline /
space token on the resolved custom-property value. Style container query
evaluation compares CSSVariableData token-by-token in valueEquals(), so
the otherwise-equivalent value failed to match.
Trim trailing whitespace from the var() fallback range before substitution,
mirroring the leading-whitespace handling already done by
consumeIncludingWhitespace().
Test:
imported/w3c/web-platform-tests/css/css-conditional/container-queries/custom-property-style-query-multiline-var.html
*
LayoutTests/imported/w3c/web-platform-tests/css/css-conditional/container-queries/custom-property-style-query-multiline-var-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-conditional/container-queries/custom-property-style-query-multiline-var.html:
Added.
* Source/WebCore/style/StyleSubstitutionResolver.cpp:
(WebCore::Style::SubstitutionResolver::substituteVariableFallback):
Canonical link: https://commits.webkit.org/313957@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications