summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-grid/layout-algorithm/baseline-alignment-affects-intrinsic-size-005.html
blob: 19404aa022aaebe5c4137cf2e27930b693bf5e68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Grid Layout Test: evaluate how the baseline affects the grid intrinsic size</title>
<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-grid/#alignment">
<link rel="help" href="https://drafts.csswg.org/css-align-3/#baseline-align-self">
<link rel="help" href="https://drafts.csswg.org/css-align-3/#align-by-baseline">
<link rel="stylesheet" href="/fonts/ahem.css">
<link rel="stylesheet" href="/css/support/alignment.css">
<link rel="stylesheet" href="/css/support/grid.css">
<meta name="assert" content="The grid intrinsic size is comptuted correctly, considering the effect of baseline alignment in the size of the column tracks"/>
<style>
.grid {
   position: relative;
   background: grey;
   float: left;
   margin: 5px;
   text-orientation: sideways;
   width: 350px;
   font-family: Ahem;
   line-height: 1;
   grid-auto-flow: row;
}
.grid > :nth-child(1) { font-size:20px; }
.grid > :nth-child(2) { font-size:30px; }
.grid > :nth-child(3) { font-size:50px; }
.grid > :nth-child(4) { font-size:60px; }
.item {
   border-width: 2px 5px 3px 4px;
   border-style: solid;
   padding: 6px 3px 7px 8px;
   margin: 10px 6px 4px 12px;
}
.extraTopPadding { padding-top: 50px; }
.extraBottomPadding { padding-bottom: 50px; }
</style>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/check-layout-th.js"></script>
<script type="text/javascript">
  setup({ explicit_done: true });
</script>

<body onload="document.fonts.ready.then(() => { runTests(); })">

<p>Vertical LR 4x1 grid with orthogonal items.</p>
<div id="grid1" class="grid verticalLR contentStart itemsBaseline" data-expected-height="92">
    <div class="item horizontalTB"                    data-offset-x="12"  data-offset-y="42" data-expected-width="40" data-expected-height="38">É</div>
    <div class="item horizontalTB"                    data-offset-x="70"  data-offset-y="34" data-expected-width="50" data-expected-height="48">É</div>
    <div class="item horizontalTB"                    data-offset-x="138" data-offset-y="18" data-expected-width="70" data-expected-height="68">É</div>
    <div class="item horizontalTB"                    data-offset-x="226" data-offset-y="10" data-expected-width="80" data-expected-height="78">É</div>
</div>
<div id="grid2" class="grid verticalLR contentStart itemsBaseline" data-expected-height="141">
    <div class="item horizontalTB extraTopPadding"    data-offset-x="12"  data-offset-y="10" data-expected-width="40" data-expected-height="82">É</div>
    <div class="item horizontalTB extraBottomPadding" data-offset-x="70"  data-offset-y="46" data-expected-width="50" data-expected-height="91">É</div>
    <div class="item horizontalTB"                    data-offset-x="138" data-offset-y="30" data-expected-width="70" data-expected-height="68">É</div>
    <div class="item horizontalTB"                    data-offset-x="226" data-offset-y="22" data-expected-width="80" data-expected-height="78">É</div>
</div>

<br clear="all">

<script>
    "use strict";
    function runTests() {

        let values = [ "auto", "min-content", "max-content" ];
        let minValues = values.concat([ "0px" ]);

        var grid1 = document.getElementById("grid1");
        var grid2 = document.getElementById("grid2");

        minValues.forEach(function (minValue) {
            values.forEach(function (maxValue) {

                grid1.id = "grid1-" + minValue + "-" + maxValue
                grid2.id = "grid2-" + minValue + "-" + maxValue

                grid1.style.gridTemplateColumns = "minmax(" + minValue + ", " + maxValue + ")";
                grid2.style.gridTemplateColumns = "minmax(" + minValue + ", " + maxValue + ")";

                checkLayout("#" + grid1.id, false);
                checkLayout("#" + grid2.id, false);
            });
        });

        done();
    }
</script>

</body>