1<!DOCTYPE html>
2<html>
3 <head>
4 <title>Scrolling of iframe</title>
5 <meta name="viewport" content="width=device-width, initial-scale=1">
6 <script src="../../../resources/basic-gestures.js"></script>
7 <script type="text/javascript">
8 if (window.testRunner)
9 testRunner.waitUntilDone();
10 if (window.internals)
11 internals.settings.setAsyncFrameScrollingEnabled(true);
12
13 function centerOf(id)
14 {
15 var frameBox = document.getElementById(id).getBoundingClientRect();
16 return { x: frameBox.left + frameBox.width / 2, y: frameBox.top + frameBox.height / 2 };
17 }
18
19 async function runTest() {
20 if (!window.testRunner || !testRunner.runUIScript)
21 return;
22
23 // This checks scrolling to the location of the green square
24 var c = centerOf("positionSticky");
25 await touchAndDragFromPointToPoint(c.x, c.y, c.x, c.y - 150);
26 await liftUpAtPoint(c.x, c.y - 150);
27
28 // Wait for scrolling to stabilize and for scrollbars to disappear.
29 setTimeout(() => {testRunner.notifyDone(); }, 1000);
30 }
31 </script>
32 <style>
33 iframe {
34 float: left;
35 background: linear-gradient(135deg, red, orange);
36 border: 0;
37 height: 100px;
38 width: 100px;
39 }
40 </style>
41 </head>
42 <body>
43 <p>This test passes if you see a green square.</p>
44 <iframe id="positionSticky" scrolling="yes" srcdoc="
45 <body style='position: relative; margin: 0; width: 300px; height: 300px'>
46 <div style='height: 100px'></div>
47 <div style='position: -webkit-sticky; position: sticky; left: 0px; top: 0px; width: 100px; height: 50px; background: green;'></div>
48 <div style='position: absolute; bottom: 0px; width: 100px; height: 50px; background: green;'></div>
49 </body>" onload="runTest()">
50 </iframe>
51 </body>
52</html>