Limit user-agent interactions based on the touch-action property on iOS
[WebKit-https.git] / LayoutTests / pointerevents / ios / touch-action-none-on-iframe.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset=utf-8>
5 <meta name="viewport" content="width=device-width, initial-scale=1">
6 <style>
7
8 iframe {
9     position: absolute;
10     left: 0;
11     top: 0;
12     width: 400px;
13     height: 400px;
14     touch-action: none;
15 }
16
17 </style>
18 </head>
19 <body>
20 <iframe></iframe>
21 <script src="../../resources/testharness.js"></script>
22 <script src="../../resources/testharnessreport.js"></script>
23 <script src="../utils.js"></script>
24 <script>
25
26 'use strict';
27
28 async_test(test => {
29     const iframe = document.body.firstElementChild;
30     const target = iframe.contentDocument.body.appendChild(document.createElement("div"));
31     target.setAttribute("style", `
32         position: absolute;
33         left: 0;
34         top: 0;
35         width: 200%;
36         height: 200%;
37     `);
38
39     ui.swipe({ x: 150, y: 150 }, { x: 50, y: 50 }).then(() => {
40         assert_equals(window.pageXOffset, 0, "The page was not scrolled in the x-axis.");
41         assert_equals(window.pageYOffset, 0, "The page was not scrolled in the y-axis.");
42         test.done();
43     });
44 }, "Testing that setting touch-action: none on an iframe and interacting with its content prevents page scrolling.");
45
46 </script>
47 </body>
48 </html>