blob: 6b5f268f5548b3e6db472d4939f7076bed09a64d (
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
56
57
58
59
60
61
|
<!DOCTYPE html>
<html class="reftest-wait">
<title>Tests anchor-scroll element paint order in composited scrolling</title>
<link rel="help" href="https://drafts4.csswg.org/css-anchor-position-1/#scroll">
<link rel="author" href="mailto:xiaochengh@chromium.org">
<link rel="match" href="reference/anchor-scroll-composited-scrolling-006-ref.html">
<style>
body {
margin: 0;
}
#scroller {
width: 200px;
height: 100px;
overflow: scroll;
will-change: scroll-position;
}
#spacer {
height: 400px;
}
#anchor {
width: 100px;
height: 100px;
anchor-name: --a;
}
#target {
position: absolute;
width: 100px;
height: 100px;
background: red;
left: 0;
bottom: anchor(--a top);
anchor-scroll: --a;
}
#overlap {
position: absolute;
width: 100px;
height: 100px;
top: 150px;
left: 0;
z-index: 100;
background: green;
}
</style>
<div id="overlap"></div>
<div id="scroller">
<div id="spacer"></div>
<div id="anchor"></div>
</div>
<div id="target"></div>
<script type="module">
function raf() { return new Promise(resolve => requestAnimationFrame(resolve)); }
await raf();
await raf();
scroller.scrollTop = 150;
document.documentElement.classList.remove('reftest-wait');
</script>
</html>
|