OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <script> |
| 4 if (window.testRunner) |
| 5 testRunner.overridePreference("WebKitCSSGridLayoutEnabled", 1); |
| 6 </script> |
| 7 <link href="resources/grid.css" rel="stylesheet"> |
| 8 <script src="../../resources/check-layout.js"></script> |
| 9 <style> |
| 10 .grid { |
| 11 grid-auto-flow: row; |
| 12 } |
| 13 #firstGridItem { |
| 14 grid-row: auto; |
| 15 grid-column: 1; |
| 16 } |
| 17 |
| 18 #secondGridItem { |
| 19 grid-row: 1; |
| 20 grid-column: auto; |
| 21 } |
| 22 |
| 23 #thirdGridItem { |
| 24 grid-row: auto; |
| 25 grid-column: auto; |
| 26 } |
| 27 </style> |
| 28 <script> |
| 29 function testGridDefinitions(gridDefinitionRows, gridDefinitionColumns, firstGri
dItemData, secondGridItemData, thirdGridItemData) |
| 30 { |
| 31 var gridElement = document.getElementsByClassName("grid")[0]; |
| 32 gridElement.style.gridDefinitionRows = gridDefinitionRows; |
| 33 gridElement.style.gridDefinitionColumns = gridDefinitionColumns; |
| 34 |
| 35 var firstGridItem = document.getElementById("firstGridItem"); |
| 36 firstGridItem.setAttribute("data-expected-width", firstGridItemData.width); |
| 37 firstGridItem.setAttribute("data-expected-height", firstGridItemData.height)
; |
| 38 firstGridItem.setAttribute("data-offset-x", firstGridItemData.x); |
| 39 firstGridItem.setAttribute("data-offset-y", firstGridItemData.y); |
| 40 |
| 41 var secondGridItem = document.getElementById("secondGridItem"); |
| 42 secondGridItem.setAttribute("data-expected-width", secondGridItemData.width)
; |
| 43 secondGridItem.setAttribute("data-expected-height", secondGridItemData.heigh
t); |
| 44 secondGridItem.setAttribute("data-offset-x", secondGridItemData.x); |
| 45 secondGridItem.setAttribute("data-offset-y", secondGridItemData.y); |
| 46 |
| 47 var thirdGridItem = document.getElementById("thirdGridItem"); |
| 48 thirdGridItem.setAttribute("data-expected-width", thirdGridItemData.width); |
| 49 thirdGridItem.setAttribute("data-expected-height", thirdGridItemData.height)
; |
| 50 thirdGridItem.setAttribute("data-offset-x", thirdGridItemData.x); |
| 51 thirdGridItem.setAttribute("data-offset-y", thirdGridItemData.y); |
| 52 |
| 53 checkLayout(".grid"); |
| 54 } |
| 55 |
| 56 function testChangingGridDefinitions() |
| 57 { |
| 58 testGridDefinitions('10px 20px', '10px', { 'width': '10', 'height': '20', 'x
': '0', 'y': '10' }, { 'width': '10', 'height': '10', 'x': '0', 'y': '0' }, { 'w
idth': '10', 'height': '0', 'x': '0', 'y': '30' }); |
| 59 testGridDefinitions('50px', '30px 40px', { 'width': '30', 'height': '0', 'x'
: '0', 'y': '50' }, { 'width': '30', 'height': '50', 'x': '0', 'y': '0' }, { 'wi
dth': '40', 'height': '50', 'x': '30', 'y': '0' }); |
| 60 testGridDefinitions('50px', '60px', { 'width': '60', 'height': '0', 'x': '0'
, 'y': '50' }, { 'width': '60', 'height': '50', 'x': '0', 'y': '0' }, { 'width':
'60', 'height': '0', 'x': '0', 'y': '50' }); |
| 61 testGridDefinitions('50px 100px 150px', '60px', { 'width': '60', 'height': '
100', 'x': '0', 'y': '50' }, { 'width': '60', 'height': '50', 'x': '0', 'y': '0'
}, { 'width': '60', 'height': '150', 'x': '0', 'y': '150' }); |
| 62 } |
| 63 |
| 64 window.addEventListener("load", testChangingGridDefinitions, false); |
| 65 </script> |
| 66 <body> |
| 67 <div>This test checks that grid-definition-{rows|columns} dynamic updates recomp
utes the positions of automatically placed grid items.</div> |
| 68 |
| 69 <div style="position: relative"> |
| 70 <div class="grid"> |
| 71 <div class="sizedToGridArea" id="firstGridItem"></div> |
| 72 <div class="sizedToGridArea" id="secondGridItem"></div> |
| 73 <div class="sizedToGridArea" id="thirdGridItem"></div> |
| 74 </div> |
| 75 </div> |
| 76 |
| 77 </body> |
| 78 </html> |
OLD | NEW |