OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <meta charset="UTF-8"> | 4 <meta charset="UTF-8"> |
5 <title>CSS Test: @viewport constrained - width deduced from height and aspect
ratio</title> | 5 <title>CSS Test: @viewport constrained - width deduced from height and aspect
ratio</title> |
6 <link rel="author" title="Rune Lillesveen" href="mailto:rune@opera.com"> | 6 <link rel="author" title="Rune Lillesveen" href="mailto:rune@opera.com"> |
7 <link rel="help" href="http://www.w3.org/TR/css-device-adapt/#constraining-pro
cedure"> | 7 <link rel="help" href="http://www.w3.org/TR/css-device-adapt/#constraining-pro
cedure"> |
8 <meta name="flags" content="visual scroll dom"> | 8 <meta name="flags" content="visual scroll dom"> |
9 <meta name="assert" content="Setting height and not width will set a width tha
t makes the actual width/height and initial width/height have the same aspect ra
tio."> | 9 <meta name="assert" content="Setting height and not width will set a width tha
t makes the actual width/height and initial width/height have the same aspect ra
tio."> |
10 <script src="../../../resources/testharness.js" type="text/javascript"></scrip
t> | 10 <script src="../../../resources/testharness.js" type="text/javascript"></scrip
t> |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 /* Initialize an object to store viewport values to be used by the test | 43 /* Initialize an object to store viewport values to be used by the test |
44 asserts. */ | 44 asserts. */ |
45 var viewport = new Object(); | 45 var viewport = new Object(); |
46 | 46 |
47 /* An element with the same size as the initial containing block. */ | 47 /* An element with the same size as the initial containing block. */ |
48 var testElm = document.getElementById("test"); | 48 var testElm = document.getElementById("test"); |
49 | 49 |
50 if (window.testRunner) { | 50 if (window.testRunner) { |
51 viewport.fontSize = parseInt(getComputedStyle(testElm, "").fontSize); | 51 viewport.fontSize = parseInt(getComputedStyle(testElm, "").fontSize); |
52 viewport.deviceWidth = 320; | |
53 viewport.deviceHeight = 480; | |
54 viewport.initialWidth = 320; | 52 viewport.initialWidth = 320; |
55 viewport.initialHeight = 352; | 53 viewport.initialHeight = 352; |
56 | 54 |
57 var vpString = internals.configurationForViewport(document, 1, | 55 var vpString = internals.viewportAsText(document, 1, |
58 viewport.deviceWidth, | 56 viewport.initialWidth, |
59 viewport.deviceHeight, | 57 viewport.initialHeight); |
60 viewport.initialWidth, | |
61 viewport.initialHeight
); | |
62 | 58 |
63 var match = /viewport size (.+)x(.+) scale (.+ )/.exec(vpString); | 59 var match = /viewport size (.+)x(.+) scale (.+ )/.exec(vpString); |
64 | 60 |
65 if (match) { | 61 if (match) { |
66 viewport.actualWidth = parseFloat(match[1]); | 62 viewport.actualWidth = parseFloat(match[1]); |
67 viewport.actualHeight = parseFloat(match[2]); | 63 viewport.actualHeight = parseFloat(match[2]); |
68 viewport.zoom = parseFloat(match[3]); | 64 viewport.zoom = parseFloat(match[3]); |
69 } | 65 } |
70 } | 66 } |
71 else { | 67 else { |
(...skipping 26 matching lines...) Expand all Loading... |
98 document.getElementById("log").style.display = "block"; | 94 document.getElementById("log").style.display = "block"; |
99 } | 95 } |
100 </script> | 96 </script> |
101 </head> | 97 </head> |
102 <body> | 98 <body> |
103 <div id="test"> | 99 <div id="test"> |
104 <div id="log"></div> | 100 <div id="log"></div> |
105 </div> | 101 </div> |
106 </body> | 102 </body> |
107 </html> | 103 </html> |
OLD | NEW |