summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-grid/layout-algorithm/grid-item-margin-auto-columns-rows-001.html
blob: 6ae1c50c220cdd07c5fb1fb266e2e2bd11bf2a4e (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
<!DOCTYPE html>
<title>CSS Grid: 'auto' sizes with item's margins</title>
<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-grid">
<link rel="help" href="https://drafts.csswg.org/css-grid/#layout-algorithm">
<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=357419">
<meta name="assert" content="Check that the grid's rows and columns 'auto' sizes are updated accordingly to its grid-item's before and start margins."/>
<link href="/css/support/grid.css" rel="stylesheet">
<link href="/css/support/width-keyword-classes.css" rel="stylesheet">

<style>
.grid {
    grid-template-rows: auto auto;
    grid-template-columns: auto auto;
}

.gridItem {
    width: 20px;
    height: 40px;
}

.marginTop {
    margin-top: 20px;
}

.marginBottom {
    margin-bottom: 20px;
}

.borderTop {
    border-top: 5px solid;
}

.borderBottom {
    border-bottom: 5px solid;
}

.paddingTop {
    padding-top: 10px;
}

.paddingBottom {
    padding-bottom: 10px;
}
</style>

<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/check-layout-th.js"></script>

<body onload="checkLayout('.grid')">
<div>
    <div class="grid fit-content" data-expected-width="40" data-expected-height="120">
        <div class="gridItem marginTop firstRowFirstColumn"></div>
        <div class="gridItem firstRowSecondColumn"></div>
        <div class="gridItem marginBottom secondRowFirstColumn"></div>
        <div class="gridItem secondRowSecondColumn"></div>
    </div>
</div>

<div>
    <div class="grid fit-content" data-expected-width="40" data-expected-height="120">
        <div class="gridItem marginTop paddingTop firstRowFirstColumn"></div>
        <div class="gridItem firstRowSecondColumn"></div>
        <div class="gridItem borderTop borderBottom secondRowFirstColumn"></div>
        <div class="gridItem secondRowSecondColumn"></div>
    </div>
</div>

<div>
    <div class="grid fit-content" data-expected-width="40" data-expected-height="120">
        <div class="gridItem marginTop paddingTop firstRowFirstColumn"></div>
        <div class="gridItem firstRowSecondColumn"></div>
        <div class="gridItem borderTop borderBottom secondRowFirstColumn"></div>
        <div class="gridItem secondRowSecondColumn"></div>
    </div>
</div>

<div>
    <div class="grid fit-content" data-expected-width="40" data-expected-height="120">
        <div class="gridItem marginTop paddingTop firstRowFirstColumn"></div>
        <div class="gridItem firstRowSecondColumn"></div>
        <div class="gridItem paddingBottom secondRowFirstColumn"></div>
        <div class="gridItem secondRowSecondColumn"></div>
    </div>
</div>
</body>