file_pointercapture_xorigin_iframe_touch.html (2173B)
1 <!DOCTYPE HTML> 2 <html> 3 <!--https://bugzilla.mozilla.org/show_bug.cgi?id=1662587--> 4 <head> 5 <title>Bug 1671849 - Touch</title> 6 <script src="/tests/SimpleTest/EventUtils.js"></script> 7 <script src="/tests/SimpleTest/SimpleTest.js"></script> 8 <script src="/tests/SimpleTest/paint_listener.js"></script> 9 <script src="/tests/gfx/layers/apz/test/mochitest/apz_test_utils.js"></script> 10 <script src="pointerevent_utils.js"></script> 11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 12 <style> 13 #target { 14 width: 100px; 15 height: 100px; 16 background-color: green; 17 } 18 iframe { 19 width: 400px; 20 height: 300px; 21 border: 1px solid blue; 22 } 23 </style> 24 </head> 25 <body> 26 <a target="_blank"href="https://bugzilla.mozilla.org/show_bug.cgi?id=1671849">Mozilla Bug 1671849</a> 27 <div id="target"></div> 28 <iframe src="https://example.com/tests/dom/events/test/pointerevents/iframe.html"></iframe> 29 30 <pre id="test"> 31 <script type="text/javascript"> 32 /** 33 * Test for Bug 1671849 34 */ 35 add_setup(async function() { 36 await SpecialPowers.pushPrefEnv({ 37 set: [["dom.w3c_pointer_events.implicit_capture", true]], 38 }); 39 await waitUntilApzStable(); 40 }); 41 42 add_task(async function test_pointer_capture_xorigin_iframe_touch() { 43 let iframe = document.querySelector("iframe"); 44 await SpecialPowers.spawn(iframe.contentWindow, [], () => { 45 let unexpected = function(e) { 46 ok(false, `iframe shoule not get any ${e.type} event`); 47 }; 48 content.document.body.addEventListener("pointermove", unexpected); 49 content.document.body.addEventListener("pointerup", unexpected); 50 }); 51 52 let target = document.getElementById("target"); 53 synthesizeTouch(target, 10, 10, { type: "touchstart" }); 54 await waitForEvent(target, "touchstart", async function(e) { 55 e.preventDefault(); 56 }); 57 58 synthesizeTouch(iframe, 10, 10, { type: "touchmove" }); 59 await Promise.all([waitForEvent(target, "gotpointercapture"), 60 waitForEvent(target, "pointermove")]); 61 62 synthesizeTouch(iframe, 10, 10, { type: "touchend" }); 63 await Promise.all([waitForEvent(target, "lostpointercapture"), 64 waitForEvent(target, "pointerup")]); 65 }); 66 </script> 67 </pre> 68 </body> 69 </html>