helper-resize-event-on-load-overflowing-page.html (1477B)
1 <!doctype html> 2 <html> 3 <head> 4 <title>Viewport: Resize Event On Load Overflowing Page</title> 5 <meta charset="utf-8"> 6 <meta name="viewport" content="width=device-width, minimum-scale=1"> 7 <script> 8 var opener = window.opener; 9 var numViewResizes = 0; 10 window.visualViewport.addEventListener('resize', function() { 11 numViewResizes++; 12 }); 13 14 window.addEventListener('load', function() { 15 requestAnimationFrame(function() { 16 requestAnimationFrame( 17 opener.t.step_func_done(function() { 18 var isOverlay = opener.calculateScrollbarThickness() == 0; 19 opener.assert_equals(numViewResizes, isOverlay ? 0 : 1); 20 })); 21 }); 22 }); 23 </script> 24 <style> 25 html { 26 height: 100%; 27 } 28 body { 29 /* Ensure overflow */ 30 height: 200%; 31 } 32 #log { 33 overflow: auto; 34 } 35 </style> 36 </head> 37 <body> 38 <h1>Viewport: Resize Event On Load Overflowing Page</h1> 39 <h4> 40 Test Description: This test ensures that we fire a resize event against 41 window.visualViewport if the page has overflow (since this creates a scrollbar 42 and thus changes the viewport size). 43 </h4> 44 <div id="log"></div> 45 </body> 46 </html>