Skip to content

Commit 03c98d6

Browse files
Fix counters instantiating
As per https://drafts.csswg.org/css-lists/#instantiating-counters: If innermost counter’s originating element is element or a previous sibling of element, remove innermost counter from counters. Fixed: 346974104 Change-Id: I938a13937cd629a9a4758483c0e118501629e302 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5630408 Reviewed-by: Vladimir Levin <[email protected]> Commit-Queue: Daniil Sakhapov <[email protected]> Cr-Commit-Position: refs/heads/main@{#1315384}
1 parent a4d4567 commit 03c98d6

6 files changed

+70
-15
lines changed

css/css-lists/counter-set-001-ref.html

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@
2121
<span>6</span><!-- "6" -->
2222
<span>0</span><!-- "0" -->
2323
<x>
24-
<span>0.2</span><!-- "0.2" -->
24+
<span>2</span><!-- "2" -->
2525
</x>
26-
<span>0.3</span><!-- "0.3" -->
26+
<span>3</span><!-- "3" -->
2727
<x>
28-
<span>0.3.0</span><!-- "0.3.0" -->
29-
<span>0.3.2</span><!-- "0.3.2" -->
28+
<span>0</span><!-- "0" -->
29+
<span>2</span><!-- "2" -->
3030
<x>
31-
<span>0.3.2.5</span><!-- "0.3.2.5" -->
31+
<span>2.5</span><!-- "2.5" -->
3232
</x>
3333
</x>
34-
<span>0.3.3</span><!-- "0.3.3" -->
34+
<span>3</span><!-- "3" -->
3535

3636
</body>
3737
</html>

css/css-lists/counter-set-001.html

+6-6
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@
2424
<span style="counter-set: n 6; counter-increment: n 2"></span><!-- "6" -->
2525
<span style="counter-set: n; counter-increment: n 2"></span><!-- "0" -->
2626
<x style="counter-reset: n 9">
27-
<span style="counter-set: n 2"></span><!-- "0.2" -->
27+
<span style="counter-set: n 2"></span><!-- "2" -->
2828
</x>
29-
<span style="counter-increment: n"></span><!-- "0.3" -->
29+
<span style="counter-increment: n"></span><!-- "3" -->
3030
<x style="counter-reset: n 9">
31-
<span style="counter-set: n"></span><!-- "0.3.0" -->
32-
<span style="counter-set: n 2"></span><!-- "0.3.2" -->
31+
<span style="counter-set: n"></span><!-- "0" -->
32+
<span style="counter-set: n 2"></span><!-- "2" -->
3333
<x style="counter-reset: n 1">
34-
<span style="counter-set: n 5"></span><!-- "0.3.2.5" -->
34+
<span style="counter-set: n 5"></span><!-- "2.5" -->
3535
</x>
3636
</x>
37-
<span style="counter-increment: n"></span><!-- "0.3.3" -->
37+
<span style="counter-increment: n"></span><!-- "3" -->
3838

3939
</body>
4040
</html>

css/css-lists/counters-005-ref.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
<p>The following two lines should be identical:</p>
1414

15-
<div>B 1 1.0 1 1.0</div>
16-
<div>B 1 1.0 1 1.0</div>
15+
<div>B 1 0 1 1.0</div>
16+
<div>B 1 0 1 1.0</div>
1717

1818
</body>
1919
</html>

css/css-lists/counters-005.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
</span>
3333
</div>
3434

35-
<div>B 1 1.0 1 1.0</div>
35+
<div>B 1 0 1 1.0</div>
3636

3737
</body>
3838
</html>

css/css-lists/counters-006-ref.html

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<title>CSS Lists Ref Test: counters instantiating</title>
3+
<link rel="author" title="Daniil Sakhapov" href="mailto:[email protected]">
4+
<link rel="help" href="https://www.w3.org/TR/css-lists-3/#instantiating-counters">
5+
<style type="text/css">
6+
* {
7+
padding: 0;
8+
margin: 0;
9+
}
10+
</style>
11+
12+
<div>1.1.1.1</div>
13+
<div>1.2.1.2</div>
14+
<div>1.3.1.3</div>
15+
<div>2.1.2.1</div>
16+
<div>2.2.2.2</div>
17+
<div>2.3.2.3</div>

css/css-lists/counters-006.html

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<!doctype html>
2+
<title>CSS Lists: counters instantiating</title>
3+
<link rel="author" title="Daniil Sakhapov" href="mailto:[email protected]">
4+
<link rel="help" href="https://www.w3.org/TR/css-lists-3/#instantiating-counters">
5+
<link rel="match" href="counters-006-ref.html">
6+
<style type="text/css">
7+
* {
8+
padding: 0;
9+
margin: 0;
10+
}
11+
12+
.test {
13+
counter-increment: section;
14+
counter-reset: multilevel;
15+
}
16+
17+
ol[multilevel] > li::before {
18+
content: counter(section) "." counters(multilevel, ".") ".";
19+
counter-increment: multilevel;
20+
}
21+
22+
ol[multilevel] {
23+
list-style: none !important;
24+
clear: both;
25+
}
26+
</style>
27+
<div class="test"></div>
28+
<ol multilevel="multilevel">
29+
<li>1.1</li>
30+
<li>1.2</li>
31+
<li>1.3</li>
32+
</ol>
33+
<div class="test"></div>
34+
<ol multilevel="multilevel">
35+
<li>2.1</li>
36+
<li>2.2</li>
37+
<li>2.3</li>
38+
</ol>

0 commit comments

Comments
 (0)