svg-image-intrinsic-size-with-cssstyle-auto-dynamic-image-change.html (1122B)
1 <!DOCTYPE html> 2 <title>Test <svg:image>'s sizing with css size as auto, with dynamic image change</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <link rel="help" href="https://svgwg.org/svg2-draft/single-page.html#geometry-Sizing"/> 6 <link rel="help" href="https://svgwg.org/svg2-draft/single-page.html#embedded-Placement"/> 7 <svg height="0"> 8 <image width="128" height="128" xlink:href="/images/green-256x256.png" style="width:auto; height:auto"/> 9 </svg> 10 <script> 11 async_test(function(t) { 12 var image = document.querySelector('image'); 13 window.onload = t.step_func(function() { 14 var rectBBox = image.getBBox(); 15 assert_equals(rectBBox.width, 256); 16 assert_equals(rectBBox.height, 256); 17 image.setAttributeNS("http://www.w3.org/1999/xlink","href","data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='64' height='64'></svg>"); 18 image.onload = t.step_func_done(function() { 19 var rectBBox = image.getBBox(); 20 assert_equals(rectBBox.width, 64); 21 assert_equals(rectBBox.height, 64); 22 }); 23 }); 24 }); 25 </script>