Skip to content

Commit be7a9aa

Browse files
committed
Bug 1679895 [wpt PR 26680] - [CLS] Don't let content-visibility:auto affect CLS, a=testonly
Automatic update from web-platform-tests [CLS] Don't let content-visibility:auto affect CLS A previous CL (*) already did this up to the first observation. Now we enforce it for all times content skips and unskips. The rationale for this change is that content-visibility is a UA-controlled best practice, and it is mostly up to the UA to avoid layout shifts when using this feature. Note that there will still be layout shifts reported for elements adjacent to (but not descendants of) content-visibility:auto elements if the content-visibility:auto element resizes and causes a shift. The change in this CL applies only to the content-visibility:auto element itself. Bug: 1151526 Change-Id: Ie3aed71b2f2500ea799c7bf77dbdd28e60a9175a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2566270 Reviewed-by: vmpstr <vmpstrchromium.org> Commit-Queue: Chris Harrelson <chrishtrchromium.org> Cr-Commit-Position: refs/heads/master{#832142} -- wpt-commits: 1d50fc221b0cdcc57df77b5011d05763c9c213f5 wpt-pr: 26680 UltraBlame original commit: 3f7a732467199f4ad28f640b267540ffdc5f206a
1 parent 1544f22 commit be7a9aa

File tree

2 files changed

+40
-3
lines changed

2 files changed

+40
-3
lines changed

testing/web-platform/tests/layout-instability/content-visibility-auto-offscreen.html

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22
<title>Layout Instability: off-screen content-visibility:auto content</title>
33
<link rel="help" href="https://wicg.github.io/layout-instability/" />
44
<style>
5-
#target {
5+
#auto {
66
content-visibility: auto;
77
contain-intrinsic-size: 1px;
88
width: 100px;
99
}
1010
</style>
11-
<div id=target style="position: relative; top: 100000px">
11+
<div class=auto>
12+
<div style="width: 100px; height: 100px"></div>
13+
</div>
14+
<div class=auto style="position: relative; top: 100000px">
1215
<div style="width: 100px; height: 100px"></div>
1316
</div>
1417
<script src="/resources/testharness.js"></script>
@@ -21,7 +24,12 @@
2124
// Wait for the initial render to complete.
2225
await waitForAnimationFrames(2);
2326

24-
window.scrollTo(0, 100000);
27+
window.scrollTo(0, 100000 + 100);
28+
await waitForAnimationFrames(2);
29+
30+
assert_equals(watcher.score, 0);
31+
32+
window.scrollTo(0, 0);
2533
await waitForAnimationFrames(2);
2634

2735
assert_equals(watcher.score, 0);
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!DOCTYPE html>
2+
<title>Layout Instability: resizing content-visibility:auto content</title>
3+
<link rel="help" href="https://wicg.github.io/layout-instability/" />
4+
<style>
5+
.auto {
6+
content-visibility: auto;
7+
contain-intrinsic-size: 10px 3000px;
8+
width: 100px;
9+
}
10+
.contained {
11+
height: 100px;
12+
}
13+
</style>
14+
<div class=a><div class=contained></div></div>
15+
<div class=a ><div class=contained></div></div>
16+
<script src="/resources/testharness.js"></script>
17+
<script src="/resources/testharnessreport.js"></script>
18+
<script src="resources/util.js"></script>
19+
<script>
20+
promise_test(async () => {
21+
const watcher = new ScoreWatcher;
22+
23+
// Wait for the initial render to complete.
24+
await waitForAnimationFrames(2);
25+
26+
assert_equals(watcher.score, 0);
27+
}, 'off-screen content-visibility:auto');
28+
29+
</script>

0 commit comments

Comments
 (0)