canvas-drawImage-width-with-no-height.html (658B)
1 <!DOCTYPE HTML> 2 <html class="reftest-wait"> 3 <script src="svg-image-util.js"></script> 4 <style> 5 canvas { 6 background: blue; 7 } 8 </style> 9 <body> 10 <script> 11 let viewBoxes = [null, "0 0 50 50", "0 0 50 20"]; 12 let promises = []; 13 for (viewBox of viewBoxes) { 14 // Without a given height the viewBox should be used to determine an aspect 15 // ratio and that applied to the width gives the height. 16 promises.push(generateCanvasDrawImageSVG("350", "200", "200px", null, viewBox)); 17 } 18 Promise.all(promises).then(() => { document.documentElement.className = "" }); 19 </script> 20 <!-- Body gets populated by script --> 21 </body> 22 </html>