-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
As per: https://drafts.csswg.org/css-contain/#example-6932a400 and w3c/csswg-drafts#9116 counter() and counters() can cross the style containment boundary, so the result should be 13 from the body's counter-reset. Bug: 990657 Change-Id: Iee313a5ed6f487865b1b7c754aa45b736f6b8f15 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4836162 Reviewed-by: Rune Lillesveen <futhark@chromium.org> Commit-Queue: Daniil Sakhapov <sakhapov@chromium.org> Cr-Commit-Position: refs/heads/main@{#1204571}
- Loading branch information
1 parent
e9faf2c
commit dcb79ca
Showing
2 changed files
with
32 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,32 @@ | ||
<!DOCTYPE html> | ||
|
||
<meta charset="UTF-8"> | ||
|
||
<title>CSS Containment Test: 'contain: style' for counters (span descendants of <body>)</title> | ||
|
||
<link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/"> | ||
<link rel="help" href="https://www.w3.org/TR/css-contain-1/#containment-style"> | ||
<link rel="match" href="reference/contain-style-counters-004-ref.html"> | ||
|
||
|
||
<style> | ||
body | ||
{ | ||
counter-reset: counter-of-span 13; | ||
} | ||
|
||
/* | ||
This creates a new counter identified as "counter-of-span" | ||
and initially sets such counter to 13 (an entirely | ||
arbitrary number) | ||
*/ | ||
|
||
body | ||
{ | ||
contain: style; | ||
} | ||
|
||
/* | ||
This will reset the counter to 0. | ||
*/ | ||
|
||
body span | ||
{ | ||
counter-increment: counter-of-span 5; | ||
} | ||
|
||
/* | ||
This increments the counter identified as "counter-of-span" | ||
of the step value of 5 (an entirely arbitrary number) each | ||
and every time there is a <span> descendant within the subtree | ||
of body | ||
*/ | ||
|
||
div | ||
{ | ||
font-size: 3em; | ||
} | ||
|
||
div::after | ||
{ | ||
content: counter(counter-of-span); | ||
} | ||
|
||
/* | ||
Now, the generated content after the span is set to the | ||
current value of the counter identified as "counter-of-span" | ||
*/ | ||
</style> | ||
|
||
<body> | ||
|
||
<p> <span></span> <span></span> <span></span> <span></span> | ||
|
||
<!-- 4 span inside the <p>. However, since div isn't a sibling of spans, | ||
it creates a new counter. | ||
--> | ||
|
||
<p>Test passes if there is the number 0. | ||
|
||
<meta charset="UTF-8"> | ||
<title>CSS Containment Test: 'contain: style' for counters (span descendants of <body>)</title> | ||
<link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/"> | ||
<link rel="help" href="https://www.w3.org/TR/css-contain-1/#containment-style"> | ||
<link rel="match" href="reference/contain-style-counters-004-ref.html"> | ||
<style> | ||
body { | ||
counter-reset: counter-of-span 13; | ||
contain: style; | ||
} | ||
body span { | ||
counter-increment: counter-of-span 5; | ||
} | ||
div { | ||
font-size: 3em; | ||
} | ||
div::after { | ||
content: counter(counter-of-span); | ||
} | ||
</style> | ||
<body> | ||
<p><span></span> <span></span> <span></span> <span></span></p> | ||
|
||
<!-- The <span>s aren't allowed to modify the counter instantiated on the <body>, | ||
so a new instance of the counter is created. | ||
Since the <div> isn't a sibling of the <span>, it will not inherit this new instance, | ||
and instead it will read the original counter from the <body>, with value 13. | ||
This is per example at: https://drafts.csswg.org/css-contain/#containment-style --> | ||
<p>Test passes if there is the number 13.</p> | ||
<div></div> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters