tor-browser

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

baseline-alignment-affects-intrinsic-size-005.html (4033B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>CSS Grid Layout Test: evaluate how the baseline affects the grid intrinsic size</title>
      4 <link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com">
      5 <link rel="help" href="https://drafts.csswg.org/css-grid/#alignment">
      6 <link rel="help" href="https://drafts.csswg.org/css-align-3/#baseline-align-self">
      7 <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-by-baseline">
      8 <link rel="stylesheet" href="/fonts/ahem.css">
      9 <link rel="stylesheet" href="/css/support/alignment.css">
     10 <link rel="stylesheet" href="/css/support/grid.css">
     11 <meta name="assert" content="The grid intrinsic size is comptuted correctly, considering the effect of baseline alignment in the size of the column tracks"/>
     12 <style>
     13 .grid {
     14   position: relative;
     15   background: grey;
     16   float: left;
     17   margin: 5px;
     18   text-orientation: sideways;
     19   width: 350px;
     20   font-family: Ahem;
     21   line-height: 1;
     22   grid-auto-flow: row;
     23 }
     24 .grid > :nth-child(1) { font-size:20px; }
     25 .grid > :nth-child(2) { font-size:30px; }
     26 .grid > :nth-child(3) { font-size:50px; }
     27 .grid > :nth-child(4) { font-size:60px; }
     28 .item {
     29   border-width: 2px 5px 3px 4px;
     30   border-style: solid;
     31   padding: 6px 3px 7px 8px;
     32   margin: 10px 6px 4px 12px;
     33 }
     34 .extraTopPadding { padding-top: 50px; }
     35 .extraBottomPadding { padding-bottom: 50px; }
     36 </style>
     37 <script src="/resources/testharness.js"></script>
     38 <script src="/resources/testharnessreport.js"></script>
     39 <script src="/resources/check-layout-th.js"></script>
     40 <script type="text/javascript">
     41  setup({ explicit_done: true });
     42 </script>
     43 
     44 <body onload="document.fonts.ready.then(() => { runTests(); })">
     45 
     46 <p>Vertical LR 4x1 grid with orthogonal items.</p>
     47 <div id="grid1" class="grid verticalLR contentStart itemsBaseline" data-expected-height="92">
     48    <div class="item horizontalTB"                    data-offset-x="12"  data-offset-y="42" data-expected-width="40" data-expected-height="38">É</div>
     49    <div class="item horizontalTB"                    data-offset-x="70"  data-offset-y="34" data-expected-width="50" data-expected-height="48">É</div>
     50    <div class="item horizontalTB"                    data-offset-x="138" data-offset-y="18" data-expected-width="70" data-expected-height="68">É</div>
     51    <div class="item horizontalTB"                    data-offset-x="226" data-offset-y="10" data-expected-width="80" data-expected-height="78">É</div>
     52 </div>
     53 <div id="grid2" class="grid verticalLR contentStart itemsBaseline" data-expected-height="141">
     54    <div class="item horizontalTB extraTopPadding"    data-offset-x="12"  data-offset-y="10" data-expected-width="40" data-expected-height="82">É</div>
     55    <div class="item horizontalTB extraBottomPadding" data-offset-x="70"  data-offset-y="46" data-expected-width="50" data-expected-height="91">É</div>
     56    <div class="item horizontalTB"                    data-offset-x="138" data-offset-y="30" data-expected-width="70" data-expected-height="68">É</div>
     57    <div class="item horizontalTB"                    data-offset-x="226" data-offset-y="22" data-expected-width="80" data-expected-height="78">É</div>
     58 </div>
     59 
     60 <br clear="all">
     61 
     62 <script>
     63    "use strict";
     64    function runTests() {
     65 
     66        let values = [ "auto", "min-content", "max-content" ];
     67        let minValues = values.concat([ "0px" ]);
     68 
     69        var grid1 = document.getElementById("grid1");
     70        var grid2 = document.getElementById("grid2");
     71 
     72        minValues.forEach(function (minValue) {
     73            values.forEach(function (maxValue) {
     74 
     75                grid1.id = "grid1-" + minValue + "-" + maxValue
     76                grid2.id = "grid2-" + minValue + "-" + maxValue
     77 
     78                grid1.style.gridTemplateColumns = "minmax(" + minValue + ", " + maxValue + ")";
     79                grid2.style.gridTemplateColumns = "minmax(" + minValue + ", " + maxValue + ")";
     80 
     81                checkLayout("#" + grid1.id, false);
     82                checkLayout("#" + grid2.id, false);
     83            });
     84        });
     85 
     86        done();
     87    }
     88 </script>
     89 
     90 </body>