| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Insert and delete @viewport rule</title> | 4 <title>Insert and delete @viewport rule</title> |
| 5 <script src="../../resources/testharness.js"></script> | 5 <script src="../../resources/testharness.js"></script> |
| 6 <script src="../../resources/testharnessreport.js"></script> | 6 <script src="../../resources/testharnessreport.js"></script> |
| 7 <style> | 7 <style> |
| 8 html { width: 100%; height: 100%; } | 8 html { width: 100%; height: 100%; } |
| 9 </style> | 9 </style> |
| 10 <script> | 10 <script> |
| 11 if (window.testRunner) { | 11 if (window.testRunner) { |
| 12 testRunner.enableFixedLayoutMode(true); | |
| 13 internals.settings.setViewportEnabled(true); | 12 internals.settings.setViewportEnabled(true); |
| 14 } | 13 } |
| 15 | 14 |
| 16 var t1 = async_test("Check that added @viewport rule is applied."); | 15 var t1 = async_test("Check that added @viewport rule is applied."); |
| 17 var t2 = async_test("Check that @viewport rule is not applied after remo
val."); | 16 var t2 = async_test("Check that @viewport rule is not applied after remo
val."); |
| 18 | 17 |
| 19 onload = function(){ | 18 onload = function(){ |
| 20 | 19 |
| 21 var origWidth = document.documentElement.offsetWidth; | 20 var origWidth = document.documentElement.offsetWidth; |
| 22 var origHeight = document.documentElement.offsetHeight; | 21 var origHeight = document.documentElement.offsetHeight; |
| 23 | 22 |
| 24 document.styleSheets[0].insertRule("@viewport { width: 400px; height
: 400px; }", 0); | 23 document.styleSheets[0].insertRule("@viewport { width: 400px; height
: 400px; }", 0); |
| 25 | 24 |
| 26 t1.step(function(){ | 25 t1.step(function(){ |
| 27 assert_equals(document.documentElement.offsetWidth, 400, "Width i
s 400px."); | 26 assert_equals(document.documentElement.offsetWidth, 400, "Width i
s 400px."); |
| 28 assert_equals(document.documentElement.offsetHeight, 400, "Height
is 400px."); | 27 assert_equals(document.documentElement.offsetHeight, 400, "Height
is 400px."); |
| 29 }); | 28 }); |
| 30 t1.done(); | 29 t1.done(); |
| 31 | 30 |
| 32 document.styleSheets[0].deleteRule(0); | 31 document.styleSheets[0].deleteRule(0); |
| 33 | 32 |
| 34 t2.step(function(){ | 33 t2.step(function(){ |
| 35 assert_equals(document.documentElement.offsetWidth, origWidth, "W
idth is default width."); | 34 assert_equals(document.documentElement.offsetWidth, origWidth, "W
idth is default width."); |
| 36 assert_equals(document.documentElement.offsetHeight, origHeight,
"Height is default height."); | 35 assert_equals(document.documentElement.offsetHeight, origHeight,
"Height is default height."); |
| 37 }); | 36 }); |
| 38 t2.done(); | 37 t2.done(); |
| 39 }; | 38 }; |
| 40 </script> | 39 </script> |
| 41 </head> | 40 </head> |
| 42 <body> | 41 <body style="overflow: hidden"> |
| 43 <div id="log"></div> | 42 <div id="log"></div> |
| 44 </body> | 43 </body> |
| 45 </html> | 44 </html> |
| OLD | NEW |