helper_zoomToFocusedInput_dynamic_toolbar_bug1828235.html (1966B)
1 <!DOCTYPE> 2 <html> 3 4 <head> 5 <title>Bug 1828235 - Dynamic toolbar causes errant zoom on input focus for certain page heights</title> 6 <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1" /> 7 <script type="application/javascript" src="apz_test_utils.js"></script> 8 <script type="application/javascript" src="apz_test_native_event_utils.js"></script> 9 <script src="/tests/SimpleTest/paint_listener.js"></script> 10 </head> 11 <style type="text/css"> 12 .touch-none { 13 /* This size ensures the page height is taller than the viewport height without the dynamic toolbar 14 * but shorter than the viewport height with the dyanmic toolbar, which we need to trigger the bug. */ 15 height: 98lvh; 16 margin: 0; 17 touch-action: none; 18 } 19 </style> 20 21 <body> 22 <div class="touch-none"> 23 <input id="input1"> 24 </div> 25 <script type="application/javascript"> 26 async function test() { 27 let utils = SpecialPowers.getDOMWindowUtils(window); 28 29 let resolution = await getResolution(); 30 ok(resolution > 0, 31 "The initial_resolution is " + resolution + ", which is some sane value"); 32 33 document.getElementById('input1').focus(); 34 await waitToClearOutAnyPotentialScrolls(window); 35 await promiseApzFlushedRepaints(); 36 let prev_resolution = resolution; 37 resolution = await getResolution(); 38 ok(resolution == prev_resolution, "focusing input1 did not change resolution " + resolution); 39 40 utils.zoomToFocusedInput(); 41 await waitToClearOutAnyPotentialScrolls(window); 42 await promiseApzFlushedRepaints(); 43 await promiseApzFlushedRepaints(); 44 resolution = await getResolution(); 45 ok(resolution == prev_resolution, "zoomToFocusedInput input1 did not change resolution " + resolution); 46 } 47 48 SpecialPowers.getDOMWindowUtils(window).setDynamicToolbarMaxHeight(100); 49 waitUntilApzStable().then(test).then(subtestDone, subtestFailed); 50 </script> 51 </body> 52 53 </html>