layout/reftests/svg/as-image/canvas-drawImage-scale-1a.html

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

     1 <html class="reftest-wait">
     2   <head>
     3     <script type="text/javascript">
     4       function go() {
     5         var canvas = document.getElementById("canvas");
     6         var ctx = canvas.getContext("2d");
     8         // Draw some orange
     9         ctx.fillStyle = "orange";
    10         ctx.fillRect(0, 0, 100, 100);
    12         // Instantiate an image. Once it has loaded, draw it & take snapshot.
    13         var image = new Image();
    14         image.onload = function() {
    15           // Note that our canvas is 100x100, so our scaled 200x200 image will
    16           // get cropped to 100x100.
    17           ctx.drawImage(image, 0, 0, 200, 200);
    18           document.documentElement.removeAttribute("class");
    19         }
    20         image.src ="lime100x100.svg";
    21       }
    22     </script>
    23   </head>
    24   <body onload="go()">
    25     <canvas id="canvas" width="100" height="100"></canvas>
    26 </body>
    27 </html>

mercurial