tor-browser

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

baseline-alignment-affects-intrinsic-size-001.html (5894B)


      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   height: 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 .extraLeftPadding { padding-left: 50px; }
     35 .extraRightPadding { padding-right: 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>Horizontal 4x1 grid with parallel and orthogonal items.</p>
     47 <div id="grid1" class="grid contentStart itemsBaseline" data-expected-width="112">
     48    <div class="item"                             data-offset-x="36" data-offset-y="10"  data-expected-width="40" data-expected-height="38">É</div>
     49    <div class="item verticalLR"                  data-offset-x="18" data-offset-y="62"  data-expected-width="50" data-expected-height="48">É</div>
     50    <div class="item"                             data-offset-x="36" data-offset-y="124" data-expected-width="70" data-expected-height="68">É</div>
     51    <div class="item verticalLR"                  data-offset-x="12" data-offset-y="206" data-expected-width="80" data-expected-height="78">É</div>
     52 </div>
     53 <div id="grid2" class="grid contentStart itemsBaseline" data-expected-width="165">
     54    <div class="item extraRightPadding"           data-offset-x="72" data-offset-y="10"  data-expected-width="87" data-expected-height="38">É</div>
     55    <div class="item verticalLR extraLeftPadding" data-offset-x="12" data-offset-y="62"  data-expected-width="92" data-expected-height="48">É</div>
     56    <div class="item"                             data-offset-x="72" data-offset-y="124" data-expected-width="70" data-expected-height="68">É</div>
     57    <div class="item verticalLR"                  data-offset-x="48" data-offset-y="206" data-expected-width="80" data-expected-height="78">É</div>
     58 </div>
     59 <div id="grid3" class="grid contentStart itemsBaseline" data-expected-width="98">
     60    <div class="item"                             data-offset-x="12" data-offset-y="10"  data-expected-width="40" data-expected-height="38">É</div>
     61    <div class="item verticalRL"                  data-offset-x="18" data-offset-y="62"  data-expected-width="50" data-expected-height="48">É</div>
     62    <div class="item"                             data-offset-x="12" data-offset-y="124" data-expected-width="70" data-expected-height="68">É</div>
     63    <div class="item verticalRL"                  data-offset-x="12" data-offset-y="206" data-expected-width="80" data-expected-height="78">É</div>
     64 </div>
     65 <div id="grid4" class="grid contentStart itemsBaseline" data-expected-width="134">
     66    <div class="item extraRightPadding"           data-offset-x="12" data-offset-y="10"  data-expected-width="87" data-expected-height="38">É</div>
     67    <div class="item verticalRL extraLeftPadding" data-offset-x="12" data-offset-y="62"  data-expected-width="92" data-expected-height="48">É</div>
     68    <div class="item"                             data-offset-x="12" data-offset-y="124" data-expected-width="70" data-expected-height="68">É</div>
     69    <div class="item verticalRL"                  data-offset-x="48" data-offset-y="206" data-expected-width="80" data-expected-height="78">É</div>
     70 </div>
     71 
     72 <br clear="all">
     73 
     74 <script>
     75    "use strict";
     76    function runTests() {
     77 
     78        let values = [ "auto", "min-content", "max-content" ];
     79        let minValues = values.concat([ "0px" ]);
     80 
     81        var grid1 = document.getElementById("grid1");
     82        var grid2 = document.getElementById("grid2");
     83        var grid3 = document.getElementById("grid3");
     84        var grid4 = document.getElementById("grid4");
     85 
     86        minValues.forEach(function (minValue) {
     87            values.forEach(function (maxValue) {
     88 
     89                grid1.id = "grid1-" + minValue + "-" + maxValue
     90                grid2.id = "grid2-" + minValue + "-" + maxValue
     91                grid3.id = "grid3-" + minValue + "-" + maxValue
     92                grid4.id = "grid4-" + minValue + "-" + maxValue
     93 
     94                grid1.style.gridTemplateColumns = "minmax(" + minValue + ", " + maxValue + ")";
     95                grid2.style.gridTemplateColumns = "minmax(" + minValue + ", " + maxValue + ")";
     96                grid3.style.gridTemplateColumns = "minmax(" + minValue + ", " + maxValue + ")";
     97                grid4.style.gridTemplateColumns = "minmax(" + minValue + ", " + maxValue + ")";
     98 
     99                checkLayout("#" + grid1.id, false);
    100                checkLayout("#" + grid2.id, false);
    101                checkLayout("#" + grid3.id, false);
    102                checkLayout("#" + grid4.id, false);
    103            });
    104        });
    105 
    106        done();
    107    }
    108 </script>
    109 
    110 </body>