Bug 1692121 [wpt PR 27585] - Implement CSSOM CSSCounterStyleRule API name setter, a=testonly

Automatic update from web-platform-tests
Implement CSSOM CSSCounterStyleRule API name setter

This is the last patch implementing setters on CSSCounterStyleRule.

The name setter is different from the other setters that, changing name
may affect cascade result. As a result, we need to re-collect all the
@counter-style rules and rebuild the CounterStyleMap.

This patch implements it with CSSStyleSheet::RuleMutationScope.

Bug: 687225
Change-Id: I369ab9f0e61d5ea3afbbfdd367ff84cc05ebbf58
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2689682
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#853209}

--

wpt-commits: 9975e93294777abc828d6564c59b28e9757adc44
wpt-pr: 27585
This commit is contained in:
Xiaocheng Hu 2021-02-12 16:26:53 +00:00 коммит произвёл moz-wptsync-bot
Родитель 69eea3b7f8
Коммит 30c3563b72
3 изменённых файлов: 103 добавлений и 0 удалений

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

@ -0,0 +1,46 @@
<!DOCTYPE html>
<title>CSSCounterStyleRule name setter with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-counter-styles-3/#the-csscounterstylerule-interface">
<link rel="author" href="mailto:xiaochengh@chromium.org">
<link rel="match" href="cssom-name-setter-ref.html">
<style id="sheet">
@counter-style foo {
system: fixed;
symbols: A B C;
}
@counter-style bar {
system: fixed;
symbols: X Y Z;
}
</style>
<ol style="list-style-type: foo; list-style-position: inside">
<li></li>
<li></li>
<li></li>
</ol>
<ol style="list-style-type: bar; list-style-position: inside">
<li></li>
<li></li>
<li></li>
</ol>
<script>
// Force layout update before changing the rule
document.body.offsetWidth;
const sheet = document.getElementById('sheet');
const rule = sheet.sheet.rules[0];
// Invalid values should be ignored
rule.name = '';
rule.name = '123';
rule.name = 'initial';
rule.name = 'inherit';
rule.name = 'unset';
rule.name = 'none';
rule.name = 'disc';
rule.name = 'decimal';
</script>

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

@ -0,0 +1,14 @@
<!DOCTYPE html>
<title>CSSCounterStyleRule name setter</title>
<ol>
<div>A.</div>
<div>B.</div>
<div>C.</div>
</ol>
<ol>
<div>X.</div>
<div>Y.</div>
<div>Z.</div>
</ol>

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

@ -0,0 +1,43 @@
<!DOCTYPE html>
<title>CSSCounterStyleRule name setter</title>
<link rel="help" href="https://www.w3.org/TR/css-counter-styles-3/#the-csscounterstylerule-interface">
<link rel="author" href="mailto:xiaochengh@chromium.org">
<link rel="match" href="cssom-name-setter-ref.html">
<style id="sheet">
@counter-style foo {
system: fixed;
symbols: A B C;
}
@counter-style bar {
system: fixed;
symbols: '1' '2' '3';
}
@counter-style foo {
system: fixed;
symbols: X Y Z;
}
</style>
<ol style="list-style-type: foo; list-style-position: inside">
<li></li>
<li></li>
<li></li>
</ol>
<ol style="list-style-type: bar; list-style-position: inside">
<li></li>
<li></li>
<li></li>
</ol>
<script>
// Force layout update before changing the rule
document.body.offsetWidth;
// Change the last counter style name from 'foo' to 'bar'
const sheet = document.getElementById('sheet');
const rule = sheet.sheet.rules[2];
rule.name = 'bar';
</script>