tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

object-fit-none-png-001c.html (3467B)


      1 <!DOCTYPE html>
      2 <!--
      3     Any copyright is dedicated to the Public Domain.
      4     http://creativecommons.org/publicdomain/zero/1.0/
      5 -->
      6 <html class="reftest-wait">
      7  <head>
      8    <meta charset="utf-8">
      9    <title>CSS Test: 'object-fit: none' on canvas element, with a PNG image and with various 'object-position' values</title>
     10    <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
     11    <link rel="help" href="http://www.w3.org/TR/css3-images/#sizing">
     12    <link rel="help" href="http://www.w3.org/TR/css3-images/#the-object-fit">
     13    <link rel="help" href="http://www.w3.org/TR/css3-images/#the-object-position">
     14    <link rel="match" href="object-fit-none-png-001-ref.html">
     15    <style type="text/css">
     16      canvas {
     17        border: 1px dashed gray;
     18        padding: 1px;
     19        object-fit: none;
     20        image-rendering: pixelated; /* for UAs that don't support crisp-edges */
     21        image-rendering: crisp-edges;
     22        float: left;
     23      }
     24 
     25      .bigWide {
     26        width: 48px;
     27        height: 32px;
     28      }
     29      .bigTall {
     30        width: 32px;
     31        height: 48px;
     32      }
     33      .small {
     34        width: 8px;
     35        height: 8px;
     36      }
     37 
     38      br { clear: both; }
     39 
     40      .tr { object-position: top right }
     41      .bl { object-position: bottom left }
     42      .tl { object-position: top 25% left 25% }
     43      .br { object-position: bottom 1px right 2px }
     44 
     45      .tc { object-position: top 3px left 50% }
     46      .cr { object-position: top 50% right 25% }
     47    </style>
     48    <script>
     49      function drawImageToCanvases(imageURI) {
     50        var image = new Image();
     51        image.onload = function() {
     52          var canvasElems = document.getElementsByTagName("canvas");
     53          for (var i = 0; i < canvasElems.length; i++) {
     54            var ctx = canvasElems[i].getContext("2d");
     55            ctx.drawImage(image, 0, 0);
     56          }
     57          document.documentElement.removeAttribute("class");
     58        }
     59        image.src = imageURI;
     60      }
     61    </script>
     62  </head>
     63  <body onload="drawImageToCanvases('support/colors-16x8.png')">
     64    <!-- big/wide: -->
     65    <canvas width="16" height="8" class="bigWide tr"></canvas>
     66    <canvas width="16" height="8" class="bigWide bl"></canvas>
     67    <canvas width="16" height="8" class="bigWide tl"></canvas>
     68    <canvas width="16" height="8" class="bigWide br"></canvas>
     69    <canvas width="16" height="8" class="bigWide tc"></canvas>
     70    <canvas width="16" height="8" class="bigWide cr"></canvas>
     71    <canvas width="16" height="8" class="bigWide"></canvas>
     72    <br>
     73    <!-- big/tall: -->
     74    <canvas width="16" height="8" class="bigTall tr"></canvas>
     75    <canvas width="16" height="8" class="bigTall bl"></canvas>
     76    <canvas width="16" height="8" class="bigTall tl"></canvas>
     77    <canvas width="16" height="8" class="bigTall br"></canvas>
     78    <canvas width="16" height="8" class="bigTall tc"></canvas>
     79    <canvas width="16" height="8" class="bigTall cr"></canvas>
     80    <canvas width="16" height="8" class="bigTall"></canvas>
     81    <br>
     82    <!-- small: -->
     83    <canvas width="16" height="8" class="small tr"></canvas>
     84    <canvas width="16" height="8" class="small bl"></canvas>
     85    <canvas width="16" height="8" class="small tl"></canvas>
     86    <canvas width="16" height="8" class="small br"></canvas>
     87    <canvas width="16" height="8" class="small tc"></canvas>
     88    <canvas width="16" height="8" class="small cr"></canvas>
     89    <canvas width="16" height="8" class="small"></canvas>
     90    <br>
     91  </body>
     92 </html>