Skip to content

Commit 85af44f

Browse files
dandclarkmoz-wptsync-bot
authored andcommitted
Bug 1753551 [wpt PR 32688] - Highlight API: Ignore CSS contain when painting, a=testonly
Automatic update from web-platform-tests Highlight API: Ignore CSS contain when painting Per the CSSWG resolution [1], ignore CSS contain boundaries when painting. Update tests, and remove some tests that are no longer interesting now that StaticRange painting no longer needs to take contain boundaries into account. [1] w3c/csswg-drafts#4598 Bug: 1164461 Change-Id: Iad9249867ea704f924827db810816935069363c4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3437210 Reviewed-by: Rune Lillesveen Reviewed-by: Fernando Fiori Commit-Queue: Dan Clark Cr-Commit-Position: refs/heads/main@{#967368} -- wpt-commits: d6608a62788dd7c1595b73135d12fc6fb15f2b13 wpt-pr: 32688
1 parent b6292c1 commit 85af44f

7 files changed

+28
-129
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
>
2+
<meta charset="UTF-8">
3+
<title>CSS Highlight API Test: Range across contain boundary is paintedtitle>
4+
<link rel="help" href="https://drafts.csswg.org/css-highlight-api-1/">
5+
<link rel="match" href="custom-highlight-painting-001-ref.html">
6+
<meta name="assert" value="Highlight should be painted even though a Range that crosses a css-contain boundary is a part of it">
7+
<style>
8+
::highlight(example-highlight) {
9+
background-color: yellow;
10+
color: blue;
11+
}
12+
#target {
13+
contain: paint;
14+
}
15+
style>
16+
<body><span>One span><span id="target"><span>two span><span>three…span>span>
17+
<script>
18+
let r = new Range();
19+
r.setStart(document.body, 0);
20+
r.setEnd(document.querySelector("#target"), 1);
21+
CSS.highlights.set("example-highlight", new Highlight(r));
22+
script>
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
>
22
<meta charset="UTF-8">
3-
<title>CSS Highlight API Test: title>
3+
<title>CSS Highlight API Test: Invalid StaticRanges are not paintedtitle>
44
<link rel="help" href="https://drafts.csswg.org/css-highlight-api-1/">
55
<link rel="match" href="custom-highlight-painting-staticrange-001-ref.html">
6-
<meta name="assert" value="StaticRanges that are invalid, collapsed or that cross only one boundary of a css-contain node should not be painted when they're in a Highlight">
6+
<meta name="assert" value="StaticRanges that are invalid or collapsed should not be painted when they're in a Highlight">
77
<style>
88
::highlight(example-highlight) {
99
background-color: yellow;
1010
color: blue;
1111
}
12-
#second {
13-
contain: style;
14-
}
1512
style>
1613
<body><span id="first">One span><span id="second">two span><span id="third">three…span>
1714
<script>
@@ -21,7 +18,5 @@
2118
h.add(new StaticRange({startContainer: document.body, startOffset: 1, endContainer: document.body, endOffset: 100}));
2219
h.add(new StaticRange({startContainer: document, startOffset: 0, endContainer: document, endOffset: 1}));
2320
h.add(new StaticRange({startContainer: document.querySelector("#third").firstChild, startOffset: 1, endContainer: document.querySelector("#first").firstChild, endOffset: 2}));
24-
h.add(new StaticRange({startContainer: document.querySelector("#first").firstChild, startOffset: 1, endContainer: document.querySelector("#second").firstChild, endOffset: 2}));
25-
h.add(new StaticRange({startContainer: document.querySelector("#second").firstChild, startOffset: 1, endContainer: document.querySelector("#third").firstChild, endOffset: 2}));
2621
CSS.highlights.set("example-highlight", h);
2722
script>
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
>
22
<meta charset="UTF-8">
3-
<title>CSS Highlight API Test: title>
3+
<title>CSS Highlight API Test: StaticRange across contain boundary is paintedtitle>
44
<link rel="help" href="https://drafts.csswg.org/css-highlight-api-1/">
55
<link rel="match" href="custom-highlight-painting-001-ref.html">
6-
<meta name="assert" value="StaticRanges crossing both boundaries of a css-contain (i.e. containing it entirely) should be painted">
6+
<meta name="assert" value="A StaticRange crossing a contain boundary should be painted">
77
<style>
88
::highlight(example-highlight) {
99
background-color: yellow;
1010
color: blue;
1111
}
1212
#contained {
13-
contain: style;
13+
contain: paint;
1414
}
1515
style>
1616
<body><span>One <span id="contained">two span>three…span>
1717
<script>
1818
let h = new Highlight();
19-
h.add(new StaticRange({startContainer: document.body.firstChild.childNodes[0], startOffset: 0, endContainer: document.body.firstChild.childNodes[2], endOffset: 0}));
19+
h.add(new StaticRange({startContainer: document.body.firstChild.childNodes[0], startOffset: 0, endContainer: document.body.firstChild.childNodes[1], endOffset: 1}));
2020
CSS.highlights.set("example-highlight", h);
2121
script>

testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-painting-staticrange-004.html

Lines changed: 0 additions & 30 deletions
This file was deleted.

testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-painting-staticrange-005.html

Lines changed: 0 additions & 30 deletions
This file was deleted.

testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-painting-staticrange-006.html

Lines changed: 0 additions & 29 deletions
This file was deleted.

testing/web-platform/tests/css/css-highlight-api/painting/custom-highlight-painting-staticrange-007.html

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)