canvas-drawImage-height-with-no-width-ref.html (796B)
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 viewBoxesAndWidths = [{viewBox: null, width: "300px"}, {viewBox: "0 0 50 50",width: "200px"}, {viewBox: "0 0 50 20", width: "500px"}]; 12 let promises = []; 13 for (viewBoxAndWidth of viewBoxesAndWidths) { 14 // Without a given width the viewBox should be used to determine an aspect 15 // ratio and that applied to the height gives the width. 16 promises.push(generateCanvasDrawImageSVG("350", "200", viewBoxAndWidth.width, "200px", viewBoxAndWidth.viewBox)); 17 } 18 Promise.all(promises).then(() => { document.documentElement.className = "" }); 19 </script> 20 <!-- Body gets populated by script --> 21 </body> 22 </html>