tor-browser

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

object-fit-dyn-aspect-ratio-001.html (2392B)


      1 <!DOCTYPE html>
      2 <!--
      3     Any copyright is dedicated to the Public Domain.
      4     http://creativecommons.org/publicdomain/zero/1.0/
      5 -->
      6 <html>
      7  <head>
      8    <meta charset="utf-8">
      9    <title>CSS Test: 'object-fit: contain' and 'cover' on object element whose aspect ratio dynamically changes</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="match" href="object-fit-dyn-aspect-ratio-001-ref.html">
     14    <style>
     15      object {
     16        margin: 1px;
     17        float: left;
     18        /* I'm just using 'object-position' for cosmetic reasons, so that the
     19           painted areas are all snapped to top-left which makes reference case
     20           more trivial. */
     21        object-position: top left;
     22      }
     23      .cov { object-fit: cover;   }
     24      .con { object-fit: contain; }
     25 
     26      .square {
     27        width: 24px;
     28        height: 24px;
     29      }
     30      .bigWide {
     31        width: 48px;
     32        height: 32px;
     33      }
     34      .bigTall {
     35        width: 32px;
     36        height: 48px;
     37      }
     38      .small {
     39        width: 8px;
     40        height: 8px;
     41      }
     42 
     43      br { clear: both; }
     44 
     45    </style>
     46    <script>
     47      function go() {
     48        for (let elem of document.getElementsByTagName("object")) {
     49          var doc = elem.contentDocument;
     50          /* These should all should select out a piece of the
     51             bottom-right quadrant (the lime chunk): */
     52          doc.documentElement.setAttribute("viewBox", "8 4 8 4");
     53        }
     54      }
     55    </script>
     56  </head>
     57  <body onload="go()">
     58    <object data="support/colors-16x8-parDefault.svg" class="square cov"></object>
     59    <object data="support/colors-16x8-parDefault.svg" class="square con"></object>
     60    <br>
     61    <object data="support/colors-16x8-parDefault.svg" class="bigWide cov"></object>
     62    <object data="support/colors-16x8-parDefault.svg" class="bigWide con"></object>
     63    <br>
     64    <object data="support/colors-16x8-parDefault.svg" class="bigTall cov"></object>
     65    <object data="support/colors-16x8-parDefault.svg" class="bigTall con"></object>
     66    <br>
     67    <object data="support/colors-16x8-parDefault.svg" class="small cov"></object>
     68    <object data="support/colors-16x8-parDefault.svg" class="small con"></object>
     69    <br>
     70  </body>
     71 </html>