Source code

Revision control

Copy as Markdown

Other Tools

<!DOCTYPE HTML>
<html class="reftest-wait">
<script src="svg-image-util.js"></script>
<style>
canvas {
background: blue;
}
</style>
<body>
<script>
let viewBoxesAndHeights = [{viewBox: null, height: "150px"}, {viewBox: "0 0 50 50", height: "200px"}, {viewBox: "0 0 50 20", height: "80px"}];
let promises = [];
for (viewBoxAndHeight of viewBoxesAndHeights) {
// Without a given height the viewBox should be used to determine an aspect
// ratio and that applied to the width gives the height.
promises.push(generateCanvasDrawImageSVG("350", "200", "200px", viewBoxAndHeight.height, viewBoxAndHeight.viewBox));
}
Promise.all(promises).then(() => { document.documentElement.className = "" });
</script>
<!-- Body gets populated by script -->
</body>
</html>