mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-16 05:51:55 +00:00
LibWeb/CSS: Allow empty trailing group when parsing comma-separated list
Some checks are pending
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Some checks are pending
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
There's discussion in the linked spec issue, but the short version is, this algorithm will see "foo,bar," as a list of two groups, with "foo" in the first group and "bar" in the second. However, users of this want to get a list of three groups, with the last one being empty. So, do that!
This commit is contained in:
parent
338282f74d
commit
233022c473
Notes:
github-actions[bot]
2025-05-17 06:54:29 +00:00
Author: https://github.com/AtkinsSJ
Commit: 233022c473
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4783
Reviewed-by: https://github.com/tcl3 ✅
3 changed files with 13 additions and 8 deletions
|
@ -1309,15 +1309,21 @@ Vector<Vector<ComponentValue>> Parser::parse_a_comma_separated_list_of_component
|
|||
Vector<Vector<ComponentValue>> groups;
|
||||
|
||||
// 3. While input is not empty:
|
||||
bool just_consumed_comma = false;
|
||||
while (!input.is_empty()) {
|
||||
|
||||
// 1. Consume a list of component values from input, with <comma-token> as the stop token, and append the result to groups.
|
||||
groups.append(consume_a_list_of_component_values(input, Token::Type::Comma));
|
||||
|
||||
// 2. Discard a token from input.
|
||||
input.discard_a_token();
|
||||
just_consumed_comma = input.consume_a_token().is(Token::Type::Comma);
|
||||
}
|
||||
|
||||
// AD-HOC: Also append an empty group if there was a trailing comma.
|
||||
// Some related spec discussion: https://github.com/w3c/csswg-drafts/issues/11254
|
||||
if (just_consumed_comma)
|
||||
groups.append({});
|
||||
|
||||
// 4. Return groups.
|
||||
return groups;
|
||||
}
|
||||
|
|
|
@ -2,8 +2,7 @@ Harness status: OK
|
|||
|
||||
Found 18 tests
|
||||
|
||||
17 Pass
|
||||
1 Fail
|
||||
18 Pass
|
||||
Pass e.style['font-variation-settings'] = "700" should not set the property value
|
||||
Pass e.style['font-variation-settings'] = "\"XHGT\"" should not set the property value
|
||||
Pass e.style['font-variation-settings'] = "wght 700" should not set the property value
|
||||
|
@ -16,7 +15,7 @@ Pass e.style['font-variation-settings'] = "\"abcA9\" 0.5" should not set the pro
|
|||
Pass e.style['font-variation-settings'] = "'wght' 200 'abcd' 400" should not set the property value
|
||||
Pass e.style['font-variation-settings'] = "'a' 1234" should not set the property value
|
||||
Pass e.style['font-variation-settings'] = "'abcde' 1234" should not set the property value
|
||||
Fail e.style['font-variation-settings'] = "'wght' 200, " should not set the property value
|
||||
Pass e.style['font-variation-settings'] = "'wght' 200, " should not set the property value
|
||||
Pass e.style['font-variation-settings'] = "'abcd\" 123" should not set the property value
|
||||
Pass e.style['font-variation-settings'] = "'wght' 100px" should not set the property value
|
||||
Pass e.style['font-variation-settings'] = "'wght' calc(100px + 200px)" should not set the property value
|
||||
|
|
|
@ -2,8 +2,8 @@ Harness status: OK
|
|||
|
||||
Found 34 tests
|
||||
|
||||
30 Pass
|
||||
4 Fail
|
||||
32 Pass
|
||||
2 Fail
|
||||
Pass Test parsing '' with matchMedia
|
||||
Pass Test parsing ' ' with matchMedia
|
||||
Pass Test parsing 'all' with matchMedia
|
||||
|
@ -20,9 +20,9 @@ Pass Test parsing 'color)' with matchMedia
|
|||
Pass Test parsing ' color)' with matchMedia
|
||||
Pass Test parsing ' color ), ( color' with matchMedia
|
||||
Fail Test parsing ' foo ' with matchMedia
|
||||
Fail Test parsing ',' with matchMedia
|
||||
Pass Test parsing ',' with matchMedia
|
||||
Fail Test parsing ',,' with matchMedia
|
||||
Pass Test parsing ' , ' with matchMedia
|
||||
Pass Test parsing ',,' with matchMedia
|
||||
Pass Test parsing ' , , ' with matchMedia
|
||||
Fail Test parsing ' foo,' with matchMedia
|
||||
Pass Test parsing '(min-resolution: 1x)' with matchMedia
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue