Bug 1855181 [wpt PR 42159] - [css-properties-values-api] Make empty universal custom props valid, a=testonly

Automatic update from web-platform-tests
[css-properties-values-api] Make empty universal custom props valid

In CustomProperty::ApplyValue, we parse the specified token sequence
(in this case an empty sequence), against the registered grammar
(in this case the universal syntax), and ultimately we call
CSSVariableParser::ParseVariableReferenceValue, to "parse" this
empty token sequence. ParseVariableReferenceValue had an incorrect
check on empty ranges - likely a remnant of the old spec, which did
not allow empty values.

Fixed: 1485804
Change-Id: I13ba8d9196c50a5a74c5991e2fec4c961b6a0c28
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4890262
Reviewed-by: Steinar H Gunderson <sesse@chromium.org>
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1201429}

--

wpt-commits: b956706efa6bc6a637b4de8bbc001da4fe9fef9c
wpt-pr: 42159
This commit is contained in:
Anders Hartvoll Ruud 2023-09-27 12:19:37 +00:00 коммит произвёл moz-wptsync-bot
Родитель 069b783ef5
Коммит 45d90f5c72
1 изменённых файлов: 17 добавлений и 0 удалений

Просмотреть файл

@ -221,4 +221,21 @@ test_using_invalid_fallback('<length>', 'red');
test_using_invalid_fallback('<length> | none', 'nolength');
test_using_invalid_fallback('<color>', 'var(--length-1)');
test(function(t){
CSS.registerProperty({
name: '--registered-universal-no-initial',
syntax: '*',
inherits: false
});
t.add_cleanup(() => {
element.style = '';
});
element.style = [
'--registered-universal-no-initial:;',
'background-color: var(--registered-universal-no-initial) green',
].join(';');
let computedStyle = getComputedStyle(element);
assert_equals(computedStyle.getPropertyValue('background-color'), 'rgb(0, 128, 0)');
}, 'Empty universal custom property can be substituted with var()');
</script>