OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../../resources/testharness.js"></script> | 2 <script src="../../../resources/testharness.js"></script> |
3 <script src="../../../resources/testharnessreport.js"></script> | 3 <script src="../../../resources/testharnessreport.js"></script> |
4 | 4 |
5 <style> | 5 <style> |
6 html { | 6 html { |
7 height: 100%; | 7 height: 100%; |
8 } | 8 } |
9 </style> | 9 </style> |
10 | 10 |
11 <h4>This test checks that requesting the viewport size causes any pending layout
to occur.</h4> | 11 <h4>This test checks that requesting the viewport size causes any pending layout
to occur.</h4> |
12 <script> | 12 <script> |
13 async_test(function(t) { | 13 async_test(function(t) { |
14 window.onload = t.step_func(function() { | 14 window.onload = t.step_func(function() { |
15 assert_equals(visualViewport.clientWidth, document.documentElement.clientW
idth, | 15 assert_equals(view.width, document.documentElement.clientWidth, |
16 "window.visualViewport.width should match the window width."); | 16 "window.view.width should match the window width."); |
17 assert_equals(visualViewport.clientHeight, document.documentElement.client
Height, | 17 assert_equals(view.height, document.documentElement.clientHeight, |
18 "window.visualViewport.height should match the window height."); | 18 "window.view.height should match the window height."); |
19 | 19 |
20 // Add overflow so scrollbars appear. | 20 // Add overflow so scrollbars appear. |
21 document.body.style.width = "2000px"; | 21 document.body.style.width = "2000px"; |
22 document.body.style.height = "2000px"; | 22 document.body.style.height = "2000px"; |
23 | 23 |
24 var viewportWidth = window.visualViewport.clientWidth; | 24 var viewportWidth = window.view.width; |
25 var viewportHeight = window.visualViewport.clientHeight; | 25 var viewportHeight = window.view.height; |
26 | 26 |
27 assert_equals(viewportWidth, document.documentElement.clientWidth, | 27 assert_equals(viewportWidth, document.documentElement.clientWidth, |
28 "Reading viewport width should cause a layout and exclude the new scro
llbar."); | 28 "Reading viewport width should cause a layout and exclude the new scro
llbar."); |
29 assert_equals(viewportHeight, document.documentElement.clientHeight, | 29 assert_equals(viewportHeight, document.documentElement.clientHeight, |
30 "Reading viewport height should cause a layout and exclude the new scr
ollbar."); | 30 "Reading viewport height should cause a layout and exclude the new scr
ollbar."); |
31 t.done(); | 31 t.done(); |
32 }); | 32 }); |
33 }); | 33 }); |
34 </script> | 34 </script> |
OLD | NEW |