summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-anchor-position/anchor-scroll-composited-scrolling-002-crash.html
blob: 80dabbb6661e56aa9450574d3c545668946bda09 (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
<!DOCTYPE html>
<html class="test-wait">
<title>Tests that scrolling doesn't crash renderer when scroller's content no longer overflows</title>
<link rel="author" href="mailto:xiaochengh@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-anchor-1/">

<style>
#scroller {
  margin-top: 200px;
  height: 200px;
  overflow-y: scroll;
}

#anchor {
  anchor-name: --a;
}

#spacer {
  height: 400px;
}

#target {
  position: fixed;
  top: anchor(--a bottom);
  left: anchor(--a left);
  position-anchor: --a;
}
</style>

<div id="scroller">
  <div id="spacer"></div>
  <div id="anchor">anchor</div>
</div>
<div id="target">target</div>

<script type="module">
const raf = () => new Promise(resolve => requestAnimationFrame(resolve));

await raf();
await raf();

spacer.style.height = '0';

// Force paint property update on target in the same frame
target.style.transform = 'scale(1)';

document.documentElement.classList.remove('test-wait');
</script>
</html>