OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <style>iframe { border:none }</style> | 2 <style>iframe { border:none }</style> |
3 <script src="../../resources/testharness.js"></script> | 3 <script src="../../resources/testharness.js"></script> |
4 <script src="../../resources/testharnessreport.js"></script> | 4 <script src="../../resources/testharnessreport.js"></script> |
5 <iframe src="../as-image/resources/200x200-blue-rect.svg"> | 5 <iframe src="../as-image/resources/200x200-blue-rect.svg"> |
6 </iframe> | 6 </iframe> |
7 <script> | 7 <script> |
8 t = async_test("Test <iframe> and <svg> size"); | 8 t = async_test("Test <iframe> and <svg> size"); |
9 function check() { | 9 function check() { |
10 var iframe = document.querySelector('iframe'); | 10 var iframe = document.querySelector('iframe'); |
| 11 var iframeRect = iframe.getBoundingClientRect(); |
11 var svg = iframe.contentDocument.documentElement; | 12 var svg = iframe.contentDocument.documentElement; |
| 13 var svgRect = svg.getBoundingClientRect(); |
12 | 14 |
13 assert_equals(iframe.offsetWidth, 300, "width should be fallback width."
); | 15 assert_equals(iframeRect.width, 300, "width should be fallback width."); |
14 assert_equals(iframe.offsetHeight, 150, "height should be the fallback h
eight 150."); | 16 assert_equals(iframeRect.height, 150, "height should be the fallback hei
ght 150."); |
15 assert_equals(svg.offsetWidth, svg.width.baseVal.value, "width should be
what the <svg> requests."); | 17 assert_equals(svgRect.width, svg.width.baseVal.value, "width should be w
hat the <svg> requests."); |
16 assert_equals(svg.offsetHeight, svg.height.baseVal.value, "height should
be what the <svg> requests."); | 18 assert_equals(svgRect.height, svg.height.baseVal.value, "height should b
e what the <svg> requests."); |
17 | 19 |
18 t.done(); | 20 t.done(); |
19 } | 21 } |
20 t.step(function() { | 22 t.step(function() { |
21 addEventListener('load', t.step_func(check)); | 23 addEventListener('load', t.step_func(check)); |
22 }); | 24 }); |
23 </script> | 25 </script> |
24 <div id="log"></div> | 26 <div id="log"></div> |
OLD | NEW |