summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-grid/grid-model/grid-gutters-and-flex-content-001.html
blob: 99b04e062f90a5d0c67fafdf09b48993adbe1bb8 (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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<!DOCTYPE html>
<title>CSS Grid: grid gutters and flex content.</title>
<link rel="author" title="Sergio Villar" href="mailto:svillar@igalia.com"/>
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#gutters"/>
<meta name="assert" content="Check that gutters do not interfere with flex content resolution for columns or with content sized tracks."/>
<link rel="stylesheet" href="/css/support/grid.css"/>
<link rel="stylesheet" href="/css/support/width-keyword-classes.css"/>
<link rel="stylesheet" href="/css/support/alignment.css">
<link rel="stylesheet" href="/fonts/ahem.css" type="text/css"/>
<style>
.gridPercentAndFlexContent { grid-template: 50px / 50% minmax(30px, 2fr); }
.gridTwoDoubleMaxFlexContent { grid-template: 50px / minmax(10px, 0.5fr) minmax(10px, 2fr); }
.gridIgnoreSecondGridItem { grid-template: 50px / minmax(300px, 3fr) minmax(150px, 1fr); }

.gridRowsPercentAndFlexContent { grid-template: minmax(30px, 2fr) 50% / 50px; }
.gridRowsTwoMaxFlexContent { grid-template: minmax(10px, 1fr) minmax(10px, 2fr) / 50px; }
.gridRowsTwoDoubleMaxFlexContent { grid-template: minmax(10px, 0.5fr) minmax(10px, 2fr) / 50px; }

.gridMinContentAndMinMaxFixedMinContentAndFlex { grid-template-columns: min-content minmax(20px, min-content) 2fr; }
.gridMaxContentAndMinMaxFixedMaxContentAndFlex { grid-template-columns: max-content minmax(20px, max-content) 1fr; }

div.grid > div { font: 10px/1 Ahem; }

.gridRowColumnGaps {
    grid-row-gap: 33px;
    grid-column-gap: 19px;
}
</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(() => { checkLayout('.grid'); })">

<!-- Check that gutters do not interfere with flex content resolution for columns -->

<div style="width: 120px; height: 10px;">
    <div class="grid gridTwoDoubleMaxFlexContent gridRowColumnGaps" data-expected-width="120" data-expected-height="50">
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="20" data-expected-height="50"></div>
        <div class="sizedToGridArea firstRowSecondColumn" data-expected-width="81" data-expected-height="50"></div>
    </div>
</div>

<div style="width: 570px; height: 10px;">
    <div class="grid gridIgnoreSecondGridItem gridRowColumnGaps" data-expected-width="570" data-expected-height="50">
        <div class="firstRowFirstColumn" data-expected-width="401" data-expected-height="50"></div>
        <div class="firstRowSecondColumn" data-expected-width="150" data-expected-height="50"></div>
    </div>
</div>

<div style="width: 120px; height: 10px;">
    <div class="grid gridPercentAndFlexContent gridRowColumnGaps" data-expected-width="120" data-expected-height="50">
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="60" data-expected-height="50"></div>
        <div class="firstRowSecondColumn" data-expected-width="41" data-expected-height="50"></div>
    </div>
</div>

<!-- Check that gutters do not interfere with flex content resolution for rows -->

<div style="width: 10px; height: 60px">
    <div class="grid gridRowsTwoMaxFlexContent gridRowColumnGaps" style="height: 100%" data-expected-width="10" data-expected-height="60">
        <div class="firstRowFirstColumn" data-expected-width="50" data-expected-height="10"></div>
        <div class="secondRowFirstColumn" data-expected-width="50" data-expected-height="17"></div>
    </div>
</div>

<div style="width: 10px; height: 60px">
    <div class="grid gridRowsTwoDoubleMaxFlexContent gridRowColumnGaps" data-expected-width="10" data-expected-height="63">
        <div class="firstRowFirstColumn" data-expected-width="50" data-expected-height="10"></div>
        <div class="secondRowFirstColumn" data-expected-width="50" data-expected-height="20"></div>
    </div>
</div>

<div style="width: 10px;">
    <div class="grid gridRowsPercentAndFlexContent gridRowColumnGaps" style="height: 150px" data-expected-width="10" data-expected-height="150">
        <div class="firstRowFirstColumn" data-expected-width="50" data-expected-height="42"></div>
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="75"></div>
    </div>
</div>

<!-- Check that gutters do not interfere with flex content resolution with content sized tracks -->

<div style="position: relative; width: 100px;">
    <div class="grid gridMinContentAndMinMaxFixedMinContentAndFlex gridRowColumnGaps" data-expected-width="100" data-expected-height="149">
    <div style="grid-column: 2 / span 2;" data-expected-width="80">XXXXX</div>
    <div style="grid-column: 1 / -1; grid-row: 2;" data-expected-width="100">XXX XXX XXX</div>
    <div style="grid-column: 1 / span 2; grid-row: 3;" data-expected-width="40">XXXX XXXX</div>
        <div style="grid-column: 1; grid-row: 4;" data-expected-width="1" data-expected-height="0"></div>
    </div>
</div>

<div style="position: relative; width: 100px;">
    <div class="grid gridMaxContentAndMinMaxFixedMaxContentAndFlex gridRowColumnGaps" data-expected-width="100" data-expected-height="139">
    <div style="grid-column: 2 / span 2;" data-expected-width="39">XX</div>
    <div style="grid-column: 1 / -1; grid-row: 2;" data-expected-width="109">XXX XXX XXX</div>
    <div style="grid-column: 1 / span 2; grid-row: 3;" data-expected-width="90">XXXX XXXX</div>
        <div style="grid-column: 1; grid-row: 4;" data-expected-width="51" data-expected-height="0"></div>
    </div>
</div>

</body>