 Chromium Code Reviews
 Chromium Code Reviews Issue 23185008:
  Reset viewport to implicit when @viewport is removed.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master
    
  
    Issue 23185008:
  Reset viewport to implicit when @viewport is removed.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master| OLD | NEW | 
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <title>Insert and delete @viewport rule</title> | |
| 5 <script src="../../resources/testharness.js"></script> | |
| 6 <script src="../../resources/testharnessreport.js"></script> | |
| 7 <style> | |
| 8 html { width: 100%; height: 100%; } | |
| 9 </style> | |
| 10 <script> | |
| 11 if (window.testRunner) { | |
| 12 testRunner.enableFixedLayoutMode(true); | |
| 13 internals.settings.setViewportEnabled(true); | |
| 14 } | |
| 15 | |
| 16 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."); | |
| 
kenneth.r.christiansen
2013/08/21 08:28:35
Great to have this tested
 | |
| 18 | |
| 19 onload = function(){ | |
| 20 | |
| 21 var origWidth = document.documentElement.offsetWidth; | |
| 22 var origHeight = document.documentElement.offsetHeight; | |
| 23 | |
| 24 document.styleSheets[0].insertRule("@viewport { width: 400px; height : 400px; }", 0); | |
| 25 | |
| 26 t1.step(function(){ | |
| 27 assert_equals(document.documentElement.offsetWidth, 400, "Width i s 400px."); | |
| 28 assert_equals(document.documentElement.offsetHeight, 400, "Height is 400px."); | |
| 29 }); | |
| 30 t1.done(); | |
| 31 | |
| 32 document.styleSheets[0].deleteRule(0); | |
| 33 | |
| 34 t2.step(function(){ | |
| 35 assert_equals(document.documentElement.offsetWidth, origWidth, "W idth is default width."); | |
| 36 assert_equals(document.documentElement.offsetHeight, origHeight, "Height is default height."); | |
| 37 }); | |
| 38 t2.done(); | |
| 39 }; | |
| 40 </script> | |
| 41 </head> | |
| 42 <body> | |
| 43 <div id="log"></div> | |
| 44 </body> | |
| 45 </html> | |
| OLD | NEW |