|
1 <!DOCTYPE html> |
|
2 <html> |
|
3 <head> |
|
4 <meta name="viewport" content="width=320,height=320" /> |
|
5 <title>Bug 602580 - Test getting and setting innerWidth and Height after using setCSSViewport</title> |
|
6 <script class="testbody" type="text/javascript"> |
|
7 function runSubTest() |
|
8 { |
|
9 // Firefox doesn't support the metaviewport tag on desktop, so we force |
|
10 // css viewport here using nsIDomWindowUtils |
|
11 var cwu = SpecialPowers.getDOMWindowUtils(window); |
|
12 cwu.setCSSViewport(320, 320); |
|
13 |
|
14 var oldWidth = window.innerWidth; |
|
15 var oldHeight = window.innerHeight; |
|
16 |
|
17 /* Test that return values are now from viewport */ |
|
18 window.opener.is(window.innerWidth, 320, "innerWidth is css viewport width"); |
|
19 window.opener.is(window.innerHeight, 320, "innerHeight is css viewport height"); |
|
20 |
|
21 window.innerWidth = 300; |
|
22 window.opener.is(window.innerWidth, 300, "innerWidth returns value that was set"); |
|
23 window.innerWidth = oldWidth; |
|
24 |
|
25 window.innerHeight = 300; |
|
26 window.opener.is(window.innerHeight, 300, "innerHeight returns value that was set"); |
|
27 window.innerHeight = oldHeight; |
|
28 |
|
29 window.opener.finish(); |
|
30 } |
|
31 </script> |
|
32 </head> |
|
33 <body onload="runSubTest()"> |
|
34 </body> |
|
35 </html> |