helper_zoomToFocusedInput_touch-action.html (2393B)
1 <!DOCTYPE> 2 <html> 3 <head> 4 <title>Checking zoomToFocusedInput zooms if touch-action allows it</title> 5 <meta name="viewport" content="width=device-width, height=device-height, initial-scale=0.5 minimum-scale=0.5, maximum-scale=1" /> 6 <script type="application/javascript" src="apz_test_utils.js"></script> 7 <script type="application/javascript" src="apz_test_native_event_utils.js"></script> 8 <script src="/tests/SimpleTest/paint_listener.js"></script> 9 </head> 10 <style type="text/css"> 11 .touch-none { 12 touch-action: none; 13 } 14 .touch-auto { 15 touch-action: auto; 16 } 17 </style> 18 <body> 19 <div class="touch-none"> 20 <input id="input1" type="text" style="border: 5px solid black"> 21 </div> 22 <br> 23 <div class="touch-auto"> 24 <input id="input2" type="text" style="border: 5px solid black"> 25 </div> 26 <script type="application/javascript"> 27 async function test() { 28 let utils = SpecialPowers.getDOMWindowUtils(window); 29 30 let resolution = await getResolution(); 31 ok(resolution > 0, 32 "The initial_resolution is " + resolution + ", which is some sane value"); 33 34 document.getElementById('input1').focus(); 35 await waitToClearOutAnyPotentialScrolls(window); 36 await promiseApzFlushedRepaints(); 37 let prev_resolution = resolution; 38 resolution = await getResolution(); 39 ok(resolution == prev_resolution, "focusing input1 did not change resolution " + resolution); 40 41 utils.zoomToFocusedInput(); 42 await waitToClearOutAnyPotentialScrolls(window); 43 await promiseApzFlushedRepaints(); 44 await promiseApzFlushedRepaints(); 45 resolution = await getResolution(); 46 ok(resolution == prev_resolution, "zoomToFocusedInput input1 did not change resolution " + resolution); 47 48 document.getElementById('input2').focus(); 49 await waitToClearOutAnyPotentialScrolls(window); 50 await promiseApzFlushedRepaints(); 51 resolution = await getResolution(); 52 ok(resolution == prev_resolution, "focusing input2 did not change resolution " + resolution); 53 54 let transformEndPromise = promiseTransformEnd(); 55 utils.zoomToFocusedInput(); 56 await waitToClearOutAnyPotentialScrolls(window); 57 await transformEndPromise; 58 await promiseApzFlushedRepaints(); 59 resolution = await getResolution(); 60 ok(resolution != prev_resolution, "zoomToFocusedInput input2 changed resolution " + resolution); 61 } 62 63 waitUntilApzStable().then(test).then(subtestDone, subtestFailed); 64 </script> 65 </body> 66 </html>