[CSS Grid Layout] Modify grid item height doesn't work
[WebKit-https.git] / LayoutTests / fast / css-grid-layout / grid-items-should-not-be-stretched-when-height-or-width-or-margin-change.html
1 <!DOCTYPE HTML>
2 <link href="resources/grid.css" rel="stylesheet">
3 <script src="../../resources/check-layout.js"></script>
4 <style>
5 .grid {
6     width: -webkit-fit-content;
7     position: relative;
8 }
9 .content {
10     width: 200px;
11     height: 200px;
12 }
13 #fromFixedWidth { width: 150px; }
14 #fromFixedHeight { height: 100px; }
15 #fromMarginAuto { margin: auto; }
16 </style>
17 <p>The grids below had initially 'stretched' items, but we have changed 'height', 'width' and 'margin' to values which don't allow stretch. This test verifies that the layout algorithm properly detects such changes and clear the override height and width accordingly.</p>
18 <div class="grid" style="-webkit-grid-template: 200px 200px / 200px 200px;">
19     <div id="toFixedHeight" class="firstRowFirstColumn" data-expected-width="200" data-expected-height="100"></div>
20     <div class="firstRowSecondColumn" data-expected-width="200" data-expected-height="200"></div>
21     <div class="secondRowFirstColumn" data-expected-width="200" data-expected-height="200"></div>
22     <div id="fromFixedHeight" class="secondRowSecondColumn" data-expected-width="200" data-expected-height="200"></div>
23 </div>
24 <div class="grid" style="-webkit-grid-template: 200px 200px / 200px 200px;">
25     <div id="toFixedWidth" class="firstRowFirstColumn" data-expected-width="150" data-expected-height="200"></div>
26     <div class="firstRowSecondColumn" data-expected-width="200" data-expected-height="200"></div>
27     <div class="secondRowFirstColumn" data-expected-width="200" data-expected-height="200"></div>
28     <div id="fromFixedWidth" class="secondRowSecondColumn" data-expected-width="200" data-expected-height="200"></div>
29 </div>
30 <div class="grid" style="-webkit-grid-template: 200px 200px / 200px 200px;">
31     <div id="toMarginAuto" class="firstRowFirstColumn" data-expected-width="150" data-expected-height="100">
32         <div style="width: 150px; height: 100px"></div>
33     </div>
34     <div class="firstRowSecondColumn" data-expected-width="200" data-expected-height="200"></div>
35     <div class="secondRowFirstColumn" data-expected-width="200" data-expected-height="200"></div>
36     <div id="fromMarginAuto" class="secondRowSecondColumn" data-expected-width="200" data-expected-height="200">
37         <div style="width: 150px; height: 100px"></div>
38     </div>
39 </div>
40 <div class="grid">
41     <div id="contentSized-toFixedHeight" class="firstRowFirstColumn" data-expected-width="200" data-expected-height="100"></div>
42     <div class="firstRowSecondColumn" data-expected-width="200" data-expected-height="200"><div class="content"></div></div>
43     <div class="secondRowFirstColumn" data-expected-width="200" data-expected-height="200"><div class="content"></div></div>
44     <div id="contentSized-fromFixedHeight" class="secondRowSecondColumn" data-expected-width="200" data-expected-height="200"></div>
45 </div>
46 <div class="grid">
47     <div id="contentSized-toFixedWidth" class="firstRowFirstColumn" data-expected-width="150" data-expected-height="200"></div>
48     <div class="firstRowSecondColumn" data-expected-width="200" data-expected-height="200"><div class="content"></div></div>
49     <div class="secondRowFirstColumn" data-expected-width="200" data-expected-height="200"><div class="content"></div></div>
50     <div id="contentSized-fromFixedWidth" class="secondRowSecondColumn" data-expected-width="200" data-expected-height="200"></div>
51 </div>
52 <div class="grid">
53     <div id="contentSized-toMarginAuto" class="firstRowFirstColumn" data-expected-width="150" data-expected-height="100">
54         <div style="width: 150px; height: 100px"></div>
55     </div>
56     <div class="firstRowSecondColumn" data-expected-width="200" data-expected-height="200"><div class="content"></div></div>
57     <div class="secondRowFirstColumn" data-expected-width="200" data-expected-height="200"><div class="content"></div></div>
58     <div id="contentSized-fromMarginAuto" class="secondRowSecondColumn" data-expected-width="200" data-expected-height="200">
59         <div style="width: 150px; height: 100px"></div>
60     </div>
61 </div>
62 <script>
63 document.body.offsetLeft;
64 document.getElementById("fromFixedHeight").style.height = "auto";
65 document.getElementById("toFixedHeight").style.height = "100px";
66 document.getElementById("fromFixedWidth").style.width = "auto";
67 document.getElementById("toFixedWidth").style.width = "150px";
68 document.getElementById("fromMarginAuto").style.margin = "0";
69 document.getElementById("toMarginAuto").style.margin = "auto";
70 document.getElementById("contentSized-fromFixedHeight").style.height = "auto";
71 document.getElementById("contentSized-toFixedHeight").style.height = "100px";
72 document.getElementById("contentSized-fromFixedWidth").style.width = "auto";
73 document.getElementById("contentSized-toFixedWidth").style.width = "150px";
74 document.getElementById("contentSized-fromMarginAuto").style.margin = "0";
75 document.getElementById("contentSized-toMarginAuto").style.margin = "auto";
76 checkLayout(".grid");
77 </script>