OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <link href="resources/grid.css" rel="stylesheet"> |
| 3 <style> |
| 4 .grid { |
| 5 width: fit-content; |
| 6 position: relative; |
| 7 justify-content: start; |
| 8 align-content: start; |
| 9 font: 25px/1 Ahem; |
| 10 } |
| 11 |
| 12 .verticalLR { |
| 13 writing-mode: vertical-lr; |
| 14 } |
| 15 </style> |
| 16 <!-- Explicitly not using layout-th because it does not allow multiple checkLayo
ut(). --> |
| 17 <script src="../../resources/check-layout.js"></script> |
| 18 <script> |
| 19 function setGridTemplate(id, gridTemplateRows, gridTemplateColumns) |
| 20 { |
| 21 var gridElement = document.getElementById(id); |
| 22 gridElement.style.gridTemplateRows = gridTemplateRows; |
| 23 gridElement.style.gridTemplateColumns = gridTemplateColumns; |
| 24 } |
| 25 |
| 26 function testGridItemDefinitions(gridItemData) |
| 27 { |
| 28 var item = document.getElementById(gridItemData.id); |
| 29 item.setAttribute("data-expected-width", gridItemData.width); |
| 30 item.setAttribute("data-expected-height", gridItemData.height); |
| 31 item.setAttribute("data-offset-x", gridItemData.x); |
| 32 item.setAttribute("data-offset-y", gridItemData.y); |
| 33 |
| 34 checkLayout(".grid"); |
| 35 } |
| 36 |
| 37 function testChangingGridDefinitions() |
| 38 { |
| 39 // Test changing the argument of fit-content() tracks. |
| 40 setGridTemplate("grid1", "none", "fit-content(100px)"); |
| 41 testGridItemDefinitions({"id": "item1", "width": "100", "height": "100", "x
": "0", "y": "0" }); |
| 42 |
| 43 setGridTemplate("grid1", "none", "fit-content(150px)"); |
| 44 testGridItemDefinitions({"id": "item1", "width": "150", "height": "75", "x"
: "0", "y": "0" }); |
| 45 |
| 46 setGridTemplate("grid2", "fit-content(100px)", "none"); |
| 47 testGridItemDefinitions({"id": "item2", "width": "100", "height": "100", "x
": "0", "y": "0" }); |
| 48 |
| 49 setGridTemplate("grid2", "fit-content(150px)", "none"); |
| 50 testGridItemDefinitions({"id": "item2", "width": "75", "height": "150", "x"
: "0", "y": "0" }); |
| 51 } |
| 52 |
| 53 window.addEventListener("load", testChangingGridDefinitions, false); |
| 54 </script> |
| 55 |
| 56 <div>This test checks that grid-template-{rows|columns} with fit-content() track
s recomputes the tracks when the fit-content() argument is modified.</div> |
| 57 |
| 58 <div id="grid1" class="grid"> |
| 59 <div id="item1" class="autoRowAutoColumn">XXXX XXX XX X X</div> |
| 60 </div> |
| 61 |
| 62 <div id="grid2" class="grid"> |
| 63 <div id="item2" class="autoRowAutoColumn verticalLR">XXXX XXX XX X X</div> |
| 64 </div> |
OLD | NEW |