blob: 36475d4c826c11807e9c0a7fbf4457c33c92c2c0 [file] [log] [blame]
Steve Kobes1a092472019-11-25 15:54:131<!DOCTYPE html>
2<title>Layout Instability: multi clip visual rect</title>
3<link rel="help" href="https://wicg.github.io/layout-instability/" />
4<style>
5
6body { margin: 0; }
7#outer { width: 200px; height: 600px; overflow: hidden; }
8#inner { width: 300px; height: 150px; overflow: hidden; }
9#j { position: relative; width: 300px; height: 600px; }
10
11</style>
12<div id='outer'><div id='inner'><div id='j'></div></div></div>
13<script src="/resources/testharness.js"></script>
14<script src="/resources/testharnessreport.js"></script>
15<script src="resources/util.js"></script>
16<script>
17
18promise_test(async () => {
19 const watcher = new ScoreWatcher;
20
21 // Wait for the initial render to complete.
22 await waitForAnimationFrames(2);
23
24 document.querySelector("#j").style.top = "-200px";
25
26 // Note that, while the element moves up 200px, its visibility is
27 // clipped at 0px,150px height, so the additional 200px of vertical
28 // move distance is not included in the score.
29 // (clip width 200) * (clip height 150)
30 const expectedScore = computeExpectedScore(200 * 150, 200);
31
32 await watcher.promise;
33 assert_equals(watcher.score, expectedScore);
34}, "Multi clip visual rect.");
35
36</script>