| <!DOCTYPE html> |
| <html> |
| <script> |
| if (window.testRunner) |
| testRunner.overridePreference("WebKitCSSGridLayoutEnabled", 1); |
| </script> |
| <link href="resources/grid.css" rel="stylesheet"> |
| <style> |
| .gridAutoContent { |
| -webkit-grid-definition-columns: auto; |
| -webkit-grid-definition-rows: auto; |
| } |
| |
| .gridMinContentFixed { |
| -webkit-grid-definition-columns: minmax(-webkit-min-content, 100px); |
| -webkit-grid-definition-rows: minmax(-webkit-min-content, 40px); |
| } |
| |
| .gridMaxContentFixed { |
| -webkit-grid-definition-columns: minmax(-webkit-max-content, 150px); |
| -webkit-grid-definition-rows: minmax(-webkit-max-content, 40px); |
| } |
| |
| .gridFixedMinContent { |
| -webkit-grid-definition-columns: minmax(100px, -webkit-min-content); |
| -webkit-grid-definition-rows: minmax(40px, -webkit-min-content); |
| } |
| |
| .gridFixedMaxContent { |
| -webkit-grid-definition-columns: minmax(100px, -webkit-max-content); |
| -webkit-grid-definition-rows: minmax(40px, -webkit-max-content); |
| } |
| |
| .lessConstrainedContainer { |
| width: 60px; |
| height: 20px; |
| } |
| |
| .firstRowFirstColumn { |
| font: 10px/1 Ahem; |
| /* Make us fit our grid area. */ |
| width: 100%; |
| height: 100%; |
| } |
| </style> |
| <script src="../../resources/check-layout.js"></script> |
| <script> |
| function testRemoval(gridElementID, size1, size2, size3) |
| { |
| var gridElement = document.getElementById(gridElementID); |
| var gridItem1 = gridElement.firstChild.nextSibling; |
| var gridItem2 = gridItem1.nextSibling.nextSibling; |
| var gridItem3 = gridItem2.nextSibling.nextSibling; |
| gridItem1.setAttribute("data-expected-width", size1.width); |
| gridItem1.setAttribute("data-expected-height", size1.height); |
| gridItem2.setAttribute("data-expected-width", size1.width); |
| gridItem2.setAttribute("data-expected-height", size1.height); |
| gridItem3.setAttribute("data-expected-width", size1.width); |
| gridItem3.setAttribute("data-expected-height", size1.height); |
| checkLayout("#" + gridElementID); |
| |
| gridElement.removeChild(gridItem1); |
| gridItem2.setAttribute("data-expected-width", size2.width); |
| gridItem2.setAttribute("data-expected-height", size2.height); |
| gridItem3.setAttribute("data-expected-width", size2.width); |
| gridItem3.setAttribute("data-expected-height", size2.height); |
| checkLayout("#" + gridElementID); |
| |
| gridElement.removeChild(gridItem2); |
| gridItem3.setAttribute("data-expected-width", size3.width); |
| gridItem3.setAttribute("data-expected-height", size3.height); |
| checkLayout("#" + gridElementID); |
| } |
| |
| function testRemovals() |
| { |
| testRemoval("constrainedAutoGrid", { 'width': '50', 'height': '40' }, { 'width': '40', 'height': '40' }, { 'width': '30', 'height': '30' }); |
| testRemoval("constrainedMinContentFixedGrid", { 'width': '50', 'height': '40' }, { 'width': '40', 'height': '40' }, { 'width': '30', 'height': '30' }); |
| testRemoval("constrainedMaxContentFixedGrid", { 'width': '190', 'height': '10' }, { 'width': '190', 'height': '10' }, { 'width': '110', 'height': '10' }); |
| testRemoval("constrainedFixedMinContentGrid", { 'width': '100', 'height': '40' }, { 'width': '100', 'height': '40' }, { 'width': '100', 'height': '40' }); |
| testRemoval("constrainedFixedMaxContentGrid", { 'width': '100', 'height': '40' }, { 'width': '100', 'height': '40' }, { 'width': '100', 'height': '40' }); |
| |
| testRemoval("unconstrainedAutoGrid", { 'width': '390', 'height': '10' }, { 'width': '350', 'height': '10' }, { 'width': '170', 'height': '10' }); |
| testRemoval("unconstrainedMinContentFixedGrid", { 'width': '100', 'height': '60' }, { 'width': '100', 'height': '60' }, { 'width': '100', 'height': '40' }); |
| testRemoval("unconstrainedMaxContentFixedGrid", { 'width': '390', 'height': '40' }, { 'width': '350', 'height': '40' }, { 'width': '170', 'height': '40' }); |
| testRemoval("unconstrainedFixedMinContentGrid", { 'width': '100', 'height': '60' }, { 'width': '100', 'height': '60' }, { 'width': '100', 'height': '40' }); |
| testRemoval("unconstrainedFixedMaxContentGrid", { 'width': '390', 'height': '40' }, { 'width': '350', 'height': '40' }, { 'width': '170', 'height': '40' }); |
| |
| testRemoval("lessConstrainedAutoGrid", { 'width': '60', 'height': '90' }, { 'width': '60', 'height': '60' }, { 'width': '60', 'height': '30' }); |
| testRemoval("lessConstrainedMinContentFixedGrid", { 'width': '60', 'height': '90' }, { 'width': '60', 'height': '60' }, { 'width': '60', 'height': '30' }); |
| testRemoval("lessConstrainedMaxContentFixedGrid", { 'width': '350', 'height': '20' }, { 'width': '350', 'height': '20' }, { 'width': '170', 'height': '20' }); |
| testRemoval("lessConstrainedFixedMinContentGrid", { 'width': '100', 'height': '40' }, { 'width': '100', 'height': '40' }, { 'width': '100', 'height': '40' }); |
| testRemoval("lessConstrainedFixedMaxContentGrid", { 'width': '100', 'height': '40' }, { 'width': '100', 'height': '40' }, { 'width': '100', 'height': '40' }); |
| } |
| window.addEventListener("load", testRemovals, false); |
| </script> |
| <body> |
| |
| <p>This test checks that the tracks' breadth are recomputed after removing a grid item.</p> |
| |
| <div class="constrainedContainer"> |
| <div class="grid gridAutoContent" id="constrainedAutoGrid"> |
| <div class="firstRowFirstColumn">XXXXX XXXXX XXXXX</div> |
| <div class="firstRowFirstColumn">XXXX XXXX XXXX XXXX</div> |
| <div class="firstRowFirstColumn">XXX XXX XXX</div> |
| </div> |
| </div> |
| |
| <div class="constrainedContainer"> |
| <div class="grid gridMinContentFixed" id="constrainedMinContentFixedGrid"> |
| <div class="firstRowFirstColumn">XXXXX XXXXX XXXXX</div> |
| <div class="firstRowFirstColumn">XXXX XXXX XXXX XXXX</div> |
| <div class="firstRowFirstColumn">XXX XXX XXX</div> |
| </div> |
| </div> |
| |
| <div class="constrainedContainer"> |
| <div class="grid gridMaxContentFixed" id="constrainedMaxContentFixedGrid"> |
| <div class="firstRowFirstColumn">XXXXX XXXXX XXXXX</div> |
| <div class="firstRowFirstColumn">XXXX XXXX XXXX XXXX</div> |
| <div class="firstRowFirstColumn">XXX XXX XXX</div> |
| </div> |
| </div> |
| |
| <div class="constrainedContainer"> |
| <div class="grid gridFixedMinContent" id="constrainedFixedMinContentGrid"> |
| <div class="firstRowFirstColumn">XXXXX XXXXX XXXXX</div> |
| <div class="firstRowFirstColumn">XXXX XXXX XXXX XXXX</div> |
| <div class="firstRowFirstColumn">XXX XXX XXX</div> |
| </div> |
| </div> |
| |
| <div class="constrainedContainer"> |
| <div class="grid gridFixedMaxContent" id="constrainedFixedMaxContentGrid"> |
| <div class="firstRowFirstColumn">XXXXX XXXXX XXXXX</div> |
| <div class="firstRowFirstColumn">XXXX XXXX XXXX XXXX</div> |
| <div class="firstRowFirstColumn">XXX XXX XXX</div> |
| </div> |
| </div> |
| |
| <!-- The container is big enough to allow all the extra space distribution we want. --> |
| <div class="unconstrainedContainer"> |
| <div class="grid gridAutoContent" id="unconstrainedAutoGrid"> |
| <div class="firstRowFirstColumn">XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX</div> |
| <div class="firstRowFirstColumn">XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX</div> |
| <div class="firstRowFirstColumn">XX XX XX XX XX XX</div> |
| </div> |
| </div> |
| |
| <div class="unconstrainedContainer"> |
| <div class="grid gridMinContentFixed" id="unconstrainedMinContentFixedGrid"> |
| <div class="firstRowFirstColumn">XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX</div> |
| <div class="firstRowFirstColumn">XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX</div> |
| <div class="firstRowFirstColumn">XX XX XX XX XX XX</div> |
| </div> |
| </div> |
| |
| <div class="unconstrainedContainer"> |
| <div class="grid gridMaxContentFixed" id="unconstrainedMaxContentFixedGrid"> |
| <div class="firstRowFirstColumn">XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX</div> |
| <div class="firstRowFirstColumn">XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX</div> |
| <div class="firstRowFirstColumn">XX XX XX XX XX XX</div> |
| </div> |
| </div> |
| |
| <div class="unconstrainedContainer"> |
| <div class="grid gridFixedMinContent" id="unconstrainedFixedMinContentGrid"> |
| <div class="firstRowFirstColumn">XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX</div> |
| <div class="firstRowFirstColumn">XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX</div> |
| <div class="firstRowFirstColumn">XX XX XX XX XX XX</div> |
| </div> |
| </div> |
| |
| <div class="unconstrainedContainer"> |
| <div class="grid gridFixedMaxContent" id="unconstrainedFixedMaxContentGrid"> |
| <div class="firstRowFirstColumn">XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX</div> |
| <div class="firstRowFirstColumn">XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX</div> |
| <div class="firstRowFirstColumn">XX XX XX XX XX XX</div> |
| </div> |
| </div> |
| |
| <!-- The container allows some expansion but also constrain the growth. --> |
| <div class="lessConstrainedContainer"> |
| <div class="grid gridAutoContent" id="lessConstrainedAutoGrid"> |
| <div class="firstRowFirstColumn">XXX XXX XXX XXX XXX XXX XXX XXX XXX</div> |
| <div class="firstRowFirstColumn">XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX</div> |
| <div class="firstRowFirstColumn">XX XX XX XX XX XX</div> |
| </div> |
| </div> |
| |
| <div class="lessConstrainedContainer"> |
| <div class="grid gridMinContentFixed" id="lessConstrainedMinContentFixedGrid"> |
| <div class="firstRowFirstColumn">XXX XXX XXX XXX XXX XXX XXX XXX XXX</div> |
| <div class="firstRowFirstColumn">XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX</div> |
| <div class="firstRowFirstColumn">XX XX XX XX XX XX</div> |
| </div> |
| </div> |
| |
| <div class="lessConstrainedContainer"> |
| <div class="grid gridMaxContentFixed" id="lessConstrainedMaxContentFixedGrid"> |
| <div class="firstRowFirstColumn">XXX XXX XXX XXX XXX XXX XXX XXX XXX</div> |
| <div class="firstRowFirstColumn">XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX</div> |
| <div class="firstRowFirstColumn">XX XX XX XX XX XX</div> |
| </div> |
| </div> |
| |
| <div class="lessConstrainedContainer"> |
| <div class="grid gridFixedMinContent" id="lessConstrainedFixedMinContentGrid"> |
| <div class="firstRowFirstColumn">XXX XXX XXX XXX XXX XXX XXX XXX XXX</div> |
| <div class="firstRowFirstColumn">XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX</div> |
| <div class="firstRowFirstColumn">XX XX XX XX XX XX</div> |
| </div> |
| </div> |
| |
| <div class="lessConstrainedContainer"> |
| <div class="grid gridFixedMaxContent" id="lessConstrainedFixedMaxContentGrid"> |
| <div class="firstRowFirstColumn">XXX XXX XXX XXX XXX XXX XXX XXX XXX</div> |
| <div class="firstRowFirstColumn">XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX</div> |
| <div class="firstRowFirstColumn">XX XX XX XX XX XX</div> |
| </div> |
| </div> |
| |
| </body> |
| </html> |