<!DOCTYPE html>
<html>
<link href="resources/grid.css" rel="stylesheet">
<style>
.gridMinMinContent {
    grid-template-columns: 30px;
    grid-template-rows: minmax(min-content, 40px);
}

.gridMaxMinContent {
    grid-template-columns: 30px;
    grid-template-rows: minmax(30px, min-content);
}

.firstRowFirstColumn {
    font: 10px/1 Ahem;
    /* Make us fit our grid area. */
    width: 100%;
    height: 100%;
}
</style>
<script src="../../resources/check-layout.js"></script>
<body onload="checkLayout('.gridMinMinContent'); checkLayout('.gridMaxMinContent')">

<p>Test that resolving minmax function with min-content on grid items works properly.</p>

<div class="constrainedContainer">
    <div class="grid gridMinMinContent" style="height: 100%">
        <div class="firstRowFirstColumn" data-expected-width="30" data-expected-height="20">XXX XXX</div>
    </div>
</div>

<div class="constrainedContainer">
    <div class="grid gridMinMinContent">
        <div class="firstRowFirstColumn" data-expected-width="30" data-expected-height="40">XXX XXX</div>
    </div>
</div>

<div class="constrainedContainer">
    <div class="grid gridMinMinContent">
        <div class="firstRowFirstColumn" data-expected-width="30" data-expected-height="40">XXX XXX XXX XXX</div>
    </div>
</div>

<div class="constrainedContainer">
    <div class="grid gridMinMinContent" style="height: 100%">
        <div class="firstRowFirstColumn" data-expected-width="30" data-expected-height="60">XX XX XX XX XX XX</div>
    </div>
</div>

<div class="constrainedContainer">
    <div class="grid gridMinMinContent">
        <div class="firstRowFirstColumn" data-expected-width="30" data-expected-height="60">XX XX XX XX XX XX</div>
    </div>
</div>

<!-- Allow the extra logical space distribution to occur. -->
<div style="width: 30px; height: 100px">
    <div class="grid gridMinMinContent">
        <div class="firstRowFirstColumn" data-expected-width="30" data-expected-height="40">XXX XXX</div>
    </div>
</div>

<div style="width: 30px; height: 100px">
    <div class="grid gridMinMinContent" style="height: 100%">
        <div class="firstRowFirstColumn" data-expected-width="30" data-expected-height="60">XX XX XX XX XX XX</div>
    </div>
</div>

<div style="width: 30px; height: 100px">
    <div class="grid gridMinMinContent">
        <div class="firstRowFirstColumn" data-expected-width="30" data-expected-height="60">XX XX XX XX XX XX</div>
    </div>
</div>

<div class="constrainedContainer">
    <div class="grid gridMaxMinContent">
        <!-- The 'max' logical width ends up being smaller than the 'min' so per the spec we ignore the 'max'. -->
        <div class="firstRowFirstColumn" data-expected-width="30" data-expected-height="30">XXX XXX</div>
    </div>
</div>

<div class="constrainedContainer">
    <div class="grid gridMaxMinContent">
        <div class="firstRowFirstColumn" data-expected-width="30" data-expected-height="30">XXX XXX XXX</div>
    </div>
</div>

<!-- Allow the extra logical space distribution to occur. -->

<div style="width: 30px; height: 100px">
    <div class="grid gridMaxMinContent">
        <div class="firstRowFirstColumn" data-expected-width="30" data-expected-height="60">XX XX XX XX XX XX</div>
    </div>
</div>

<div style="width: 30px; height: 100px">
    <div class="grid gridMaxMinContent">
        <!-- The 'max' logical width ends up being smaller than the 'min' so per the spec we ignore the 'max'. -->
        <div class="firstRowFirstColumn" data-expected-width="30" data-expected-height="30">XXX XXX</div>
    </div>
</div>

</body>
</html>
