blob: 1b64e43a1d5af53bca3c07c5ae849325cc562aa5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
<!doctype html>
<meta charset="utf-8">
<title>Content Visibility: stop ticking after relevancy updates</title>
<!--
Adapted from testing/web-platform/tests/css/css-contain/content-visibility/content-visibility-intrinsic-size-001.html
-->
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1880928">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/rendering-utils.js"></script>
<style>
#container {
position: sticky;
}
#container > div {
content-visibility: auto;
contain-intrinsic-size: 1px 5000px;
}
</style>
<div id="container">
<div>X</div>
<div id="target">XX</div>
<div>XXX</div>
<div>XXXX</div>
</div>
<script>
target.scrollIntoView();
</script>
<script>
function hasPendingTick() {
return SpecialPowers.wrap(window).windowUtils.refreshDriverHasPendingTick;
}
// See comment in layout/base/tests/test_bug1756118.html about why the timeouts
// etc.
async function expectTicksToStop() {
for (let i = 0; i < 100; i++) {
await new Promise(r => setTimeout(r, 8));
if(!hasPendingTick()) {
break;
}
}
assert_false(hasPendingTick(), "refresh driver should have eventually stopped ticking");
}
promise_test(async function(t) {
await new Promise(resolve => { window.addEventListener("load", resolve); });
await SpecialPowers.pushPrefEnv({'set':
[['layout.keep_ticking_after_load_ms', 0]]});
await waitForAtLeastOneFrame();
await expectTicksToStop();
});
</script>
|