blob: bb71bfeec1154afa87ebc988de49909c7a209732 [file] [log] [blame]
<!DOCTYPE html>
<html>
<script>
if (window.testRunner)
testRunner.overridePreference("WebKitCSSGridLayoutEnabled", 1);
</script>
<link href="resources/grid.css" rel="stylesheet">
<style>
.gridMaxMaxContent {
grid-columns: minmax(10px, -webkit-max-content) minmax(10px, 1fr);
grid-rows: 50px;
}
.gridMinMinContent {
grid-columns: minmax(10px, 1fr) minmax(-webkit-min-content, 50px);
grid-rows: 50px;
}
.gridWithIntrinsicSizeBiggerThanFlex {
grid-columns: minmax(-webkit-min-content, 0.5fr) minmax(18px, 2fr);
grid-rows: 50px;
}
.gridShrinkBelowItemsIntrinsicSize {
grid-columns: minmax(0px, 1fr) minmax(0px, 2fr);
grid-rows: 50px;
}
.gridWithNonFlexingItems {
grid-columns: 40px minmax(-webkit-min-content, 1fr) auto minmax(20px, 2fr);
grid-rows: 50px;
}
.firstRowThirdColumn {
grid-column: 3;
grid-row: 1;
}
.firstRowFourthColumn {
grid-column: 4;
grid-row: 1;
}
</style>
<script src="../../resources/check-layout.js"></script>
<body onload="checkLayout('.grid');">
<p>Test that resolving auto tracks on grid items works properly.</p>
<div class="constrainedContainer">
<div class="grid gridMaxMaxContent">
<div class="sizedToGridArea firstRowFirstColumn" data-expected-width="10" data-expected-height="50">XXXXX</div>
<div class="sizedToGridArea firstRowSecondColumn" data-expected-width="10" data-expected-height="50"></div>
</div>
</div>
<!-- Allow the extra logical space distribution to occur. -->
<div style="width: 40px; height: 10px">
<div class="grid gridMaxMaxContent">
<div class="sizedToGridArea firstRowFirstColumn" data-expected-width="30" data-expected-height="50">XXXXX</div>
<div class="sizedToGridArea firstRowSecondColumn" data-expected-width="10" data-expected-height="50"></div>
</div>
</div>
<div style="width: 110px; height: 10px;">
<div class="grid gridMaxMaxContent">
<div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="50">XXXXX</div>
<div class="sizedToGridArea firstRowSecondColumn" data-expected-width="60" data-expected-height="50"></div>
</div>
</div>
<div class="constrainedContainer">
<div class="grid gridMinMinContent">
<div class="sizedToGridArea firstRowFirstColumn" data-expected-width="10" data-expected-height="50">XX XX</div>
<div class="sizedToGridArea firstRowSecondColumn" data-expected-width="20" data-expected-height="50">XX XX</div>
</div>
</div>
<!-- Allow the extra logical space distribution to occur. -->
<div style="width: 40px; height: 10px">
<div class="grid gridMinMinContent">
<div class="sizedToGridArea firstRowFirstColumn" data-expected-width="10" data-expected-height="50">XX XX</div>
<div class="sizedToGridArea firstRowSecondColumn" data-expected-width="30" data-expected-height="50">XX XX</div>
</div>
</div>
<div style="width: 110px; height: 10px;">
<div class="grid gridMinMinContent">
<div class="sizedToGridArea firstRowFirstColumn" data-expected-width="60" data-expected-height="50">XX XX</div>
<div class="sizedToGridArea firstRowSecondColumn" data-expected-width="50" data-expected-height="50">XX XX</div>
</div>
</div>
<div style="width: 220px; height: 10px;">
<div class="grid gridWithIntrinsicSizeBiggerThanFlex">
<div class="sizedToGridArea firstRowFirstColumn" data-expected-width="200" data-expected-height="50">
<div style="display: inline-block; width: 200px;"></div>
</div>
<div class="sizedToGridArea firstRowSecondColumn" data-expected-width="20" data-expected-height="50"></div>
</div>
</div>
<div style="width: 120px; height: 10px;">
<div class="grid gridShrinkBelowItemsIntrinsicSize">
<div class="sizedToGridArea firstRowFirstColumn" data-expected-width="40" data-expected-height="50">
<div style="display: inline-block; width: 200px;"></div>
</div>
<div class="sizedToGridArea firstRowSecondColumn" data-expected-width="80" data-expected-height="50">XXXXXXXXXX</div>
</div>
</div>
<!-- No space available for the <flex> -->
<div style="width: 220px; height: 10px;">
<div class="grid gridWithNonFlexingItems">
<div class="sizedToGridArea firstRowFirstColumn" data-expected-width="40" data-expected-height="50"></div>
<div class="sizedToGridArea firstRowSecondColumn" data-expected-width="100" data-expected-height="50">
<div style="display: inline-block; width: 100px;"></div>
</div>
<div class="sizedToGridArea firstRowThirdColumn" data-expected-width="100" data-expected-height="50">XXXXXXXXXX XXXXXXXXX</div>
<div class="sizedToGridArea firstRowFourthColumn" data-expected-width="20" data-expected-height="50"></div>
</div>
</div>
<!-- The second track should be sized after the min-content as the <flex> value should be too small. -->
<div style="width: 380px; height: 10px;">
<div class="grid gridWithNonFlexingItems">
<div class="sizedToGridArea firstRowFirstColumn" data-expected-width="40" data-expected-height="50"></div>
<div class="sizedToGridArea firstRowSecondColumn" data-expected-width="100" data-expected-height="50">
<div style="display: inline-block; width: 100px;"></div>
</div>
<div class="sizedToGridArea firstRowThirdColumn" data-expected-width="200" data-expected-height="50">XXXXXXXXXX XXXXXXXXX</div>
<div class="sizedToGridArea firstRowFourthColumn" data-expected-width="40" data-expected-height="50"></div>
</div>
</div>
<div style="width: 400px; height: 10px;">
<div class="grid gridWithNonFlexingItems">
<div class="sizedToGridArea firstRowFirstColumn" data-expected-width="40" data-expected-height="50"></div>
<div class="sizedToGridArea firstRowSecondColumn" data-expected-width="100" data-expected-height="50">
<div style="display: inline-block; width: 100px;"></div>
</div>
<div class="sizedToGridArea firstRowThirdColumn" data-expected-width="200" data-expected-height="50">XXXXXXXXXX XXXXXXXXX</div>
<div class="sizedToGridArea firstRowFourthColumn" data-expected-width="60" data-expected-height="50"></div>
</div>
</div>
</body>
</html>