helper_bug1806400-2.html (1464B)
1 <!DOCTYPE html> 2 <html> 3 <meta name="viewport" content="width=device-width; initial-scale=0.4"> 4 <title>Tests that double-tap-to-zoom never activates elements inside a scrollable container</title> 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <script src="/tests/SimpleTest/paint_listener.js"></script> 7 <script src="apz_test_utils.js"></script> 8 <script src="apz_test_native_event_utils.js"></script> 9 <style> 10 #scrollable { 11 height: 50vh; 12 width: 50vw; 13 background: yellow; 14 overflow: scroll; 15 } 16 17 #scrollabletarget { 18 height: 200vh; 19 width: 200vh; 20 background: green; 21 } 22 23 #scrollabletarget:active { 24 background: red; 25 } 26 27 </style> 28 <div id="scrollable"> 29 <div id="scrollabletarget"> 30 </div> 31 </div> 32 <script> 33 async function test() { 34 ok(!scrollabletarget.matches(":active"), "should not be active initially"); 35 36 let rAFID = requestAnimationFrame(function ensureInactive() { 37 let isActive = scrollabletarget.matches(":active"); 38 ok(!isActive, "Element activation should never happen!"); 39 if (!isActive) { 40 rAFID = requestAnimationFrame(ensureInactive); 41 } 42 }); 43 44 await doubleTapOn(scrollabletarget, 50, 50, false /* useTouchpad */); 45 46 cancelAnimationFrame(rAFID); 47 } 48 49 if (getPlatform() != "mac" && getPlatform() != "android") { 50 ok(true, "Skipping test because double-tap-zoom isn't allowed on " + getPlatform()); 51 subtestDone(); 52 } else { 53 waitUntilApzStable() 54 .then(test) 55 .then(subtestDone, subtestFailed); 56 } 57 </script> 58 </html>