canvas-drawImage-width-with-no-height-ref.html (806B)
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 viewBoxesAndHeights = [{viewBox: null, height: "150px"}, {viewBox: "0 0 50 50", height: "200px"}, {viewBox: "0 0 50 20", height: "80px"}]; 12 let promises = []; 13 for (viewBoxAndHeight of viewBoxesAndHeights) { 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", viewBoxAndHeight.height, viewBoxAndHeight.viewBox)); 17 } 18 Promise.all(promises).then(() => { document.documentElement.className = "" }); 19 </script> 20 <!-- Body gets populated by script --> 21 </body> 22 </html>