OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <style> | 2 <style> |
3 body { | 3 body { |
4 height: 2000px; | 4 height: 2000px; |
5 width: 2000px; | 5 width: 2000px; |
6 } | 6 } |
7 #frame { | 7 #frame { |
8 height: 500px; | 8 height: 500px; |
9 width: 200px; | 9 width: 200px; |
10 } | 10 } |
11 </style> | 11 </style> |
12 <script src="../../../resources/testharness.js"></script> | 12 <script src="../../../resources/testharness.js"></script> |
13 <script src="../../../resources/testharnessreport.js"></script> | 13 <script src="../../../resources/testharnessreport.js"></script> |
14 <script> | 14 <script> |
15 var scrollbarWidth = 15; | 15 var scrollbarWidth = 15; |
16 var scrollbarHeight = 15; | 16 var scrollbarHeight = 15; |
17 | 17 |
18 function frameViewport() { | 18 function frameViewport() { |
19 return frame.contentWindow.visualViewport; | 19 return frame.contentWindow.view; |
20 } | 20 } |
21 | 21 |
22 async_test(function(t) { | 22 async_test(function(t) { |
23 window.onload = t.step_func(function() { | 23 window.onload = t.step_func(function() { |
24 internals.setPageScaleFactor(2); | 24 internals.setPageScaleFactor(2); |
25 | 25 |
26 // The page scale on the root frame shouldn't affect the viewport/scale | 26 // The page scale on the root frame shouldn't affect the viewport/scale |
27 // values in the iframe. | 27 // values in the iframe. |
28 var frame = document.getElementById("frame"); | 28 var frame = document.getElementById("frame"); |
29 frame.contentWindow.scrollTo(10, 15); | 29 frame.contentWindow.scrollTo(10, 15); |
30 assert_equals(frameViewport().clientWidth, 200 - scrollbarWidth); | 30 assert_equals(frameViewport().width, 200 - scrollbarWidth); |
31 assert_equals(frameViewport().clientHeight, 500 - scrollbarHeight); | 31 assert_equals(frameViewport().height, 500 - scrollbarHeight); |
32 assert_equals(frameViewport().pageX, 10); | 32 assert_equals(frameViewport().pageLeft, 10); |
33 assert_equals(frameViewport().pageY, 15); | 33 assert_equals(frameViewport().pageTop, 15); |
34 assert_equals(frameViewport().scrollLeft, 0); | 34 assert_equals(frameViewport().offsetLeft, 0); |
35 assert_equals(frameViewport().scrollTop, 0); | 35 assert_equals(frameViewport().offsetTop, 0); |
36 assert_equals(frameViewport().scale, 1); | 36 assert_equals(frameViewport().scale, 1); |
37 | 37 |
38 t.done(); | 38 t.done(); |
39 }); | 39 }); |
40 }, 'Verify viewport dimensions for iframe.'); | 40 }, 'Verify viewport dimensions for iframe.'); |
41 </script> | 41 </script> |
42 <iframe id="frame" srcdoc=" | 42 <iframe id="frame" srcdoc=" |
43 <style> | 43 <style> |
44 body { | 44 body { |
45 width: 2000px; | 45 width: 2000px; |
46 height: 2000px; | 46 height: 2000px; |
47 } | 47 } |
48 </style> | 48 </style> |
49 "></iframe> | 49 "></iframe> |
OLD | NEW |