| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Viewport 'width' descriptor has 'extend-to-zoom' value</title> | 4 <title>Viewport 'width' descriptor has 'extend-to-zoom' value</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, body { width: 100%; height: 100%; margin: 0 } | 8 html, body { width: 100%; height: 100%; margin: 0 } |
| 9 @viewport { width: -internal-extend-to-zoom; zoom: 0.5; } | 9 @viewport { width: -internal-extend-to-zoom; zoom: 0.5; } |
| 10 </style> | 10 </style> |
| 11 <script> | |
| 12 test(function(){ | |
| 13 assert_own_property(window, "testRunner"); | |
| 14 }, "Check that window.testRunner is present. Required to add a user styl
esheet."); | |
| 15 | |
| 16 if (window.testRunner) { | |
| 17 testRunner.injectStyleSheet("@viewport { width: -internal-extend-to-
zoom 980px; min-zoom: 0.25; max-zoom: 5; height: auto; zoom: auto; user-zoom: zo
om; orientation: auto }", true); | |
| 18 } | |
| 19 </script> | |
| 20 </head> | 11 </head> |
| 21 <body> | 12 <body> |
| 22 <div id="log"></div> | 13 <div id="log"></div> |
| 23 <script> | 14 <script> |
| 24 test(function(){ | 15 test(function(){ |
| 25 assert_own_property(window, "internals"); | 16 assert_own_property(window, "internals"); |
| 26 }, "Check that window.internals is present. Required to call viewportAsT
ext."); | 17 }, "Check that window.internals is present. Required to call viewportAsT
ext."); |
| 27 | 18 |
| 28 var actualWidth; | 19 var actualWidth; |
| 29 var actualHeight; | 20 var actualHeight; |
| 30 | 21 |
| 31 var vpString = internals.viewportAsText(document, 1, 320, 352); | 22 var vpString = internals.viewportAsText(document, 1, 320, 352); |
| 32 var match = /viewport size (.+)x(.+) scale (.+ )/.exec(vpString); | 23 var match = /viewport size (.+)x(.+) scale (.+ )/.exec(vpString); |
| 33 | 24 |
| 34 if (match) { | 25 if (match) { |
| 35 actualWidth = parseFloat(match[1]); | 26 actualWidth = parseFloat(match[1]); |
| 36 } | 27 } |
| 37 | 28 |
| 38 test(function(){ | 29 test(function(){ |
| 39 assert_equals(actualWidth, 640); | 30 assert_equals(actualWidth, 640); |
| 40 }, "Check viewport width."); | 31 }, "Check viewport width."); |
| 41 </script> | 32 </script> |
| 42 </body> | 33 </body> |
| 43 </html> | 34 </html> |
| OLD | NEW |