helper_reset_zoom_bug1818967.html (1826B)
1 <!DOCTYPE html> 2 <html lang="en"><head> 3 <meta http-equiv="content-type" content="text/html; charset=UTF-8"> 4 <meta charset="utf-8"> 5 <title>Test that we do not checkerboard after resetting the pinch-zoom scale</title> 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 <style> 10 .scrolled { 11 width: 10000px; 12 height: 10000px; 13 background: linear-gradient(lime, cyan); 14 } 15 </style> 16 </head><body> 17 <div class="scrolled"></div> 18 </body> 19 20 <script type="application/javascript"> 21 async function test() { 22 var utils = SpecialPowers.getDOMWindowUtils(window); 23 var scrollerId = utils.getViewId(document.documentElement); 24 25 // Zoom in to the maximum level 26 utils.setResolutionAndScaleTo(10.0); 27 await promiseApzFlushedRepaints(); 28 29 // Scroll the layout viewport to around middle of the page 30 window.scrollTo(window.scrollMaxX / 2, window.scrollMaxY / 2); 31 await promiseApzFlushedRepaints(); 32 33 // Scroll the visual viewport to the bottom of the layout viewport. 34 // This creates an offset between the visual and layout viewport 35 // offsets which is needed to trigger the bug. 36 utils.scrollToVisual(window.scrollX, 37 window.scrollY + (0.9 * document.documentElement.clientHeight), 38 utils.UPDATE_TYPE_MAIN_THREAD, 39 utils.SCROLL_MODE_INSTANT); 40 await promiseApzFlushedRepaints(); 41 42 // Reset the zoom level to 1.0x 43 utils.setResolutionAndScaleTo(1.0); 44 await promiseApzFlushedRepaints(); 45 46 // Assert that we're not checkerboarded 47 assertNotCheckerboarded(utils, scrollerId, "After resetting zoom level"); 48 } 49 50 waitUntilApzStable() 51 .then(test) 52 .then(subtestDone, subtestFailed); 53 54 </script> 55 </html>