Files
UXP-Fixed/layout/reftests/css-grid/grid-max-sizing-flex-007.html
T
wolfbeast b3a4b8361e Issue #1485 - Fix incorrect grid cell sizing to min/max space.
There were actually two separate logical errors in this method:

The first part is that "origSizes.isSome()" is simply a bogus
requirement for applying min/max-sizes here. I'm still keeping
the optimization of not needlessly copying the mSizes array
(as originally intended) since it's a quite common case.

The second bug is that min/max-sizes were only applied under
the "if (fr != 0.0f)" block. This is bogus since the calculated
'fr' value depends on 'aAvailableSize' which might change by
applying min/max-sizes and thus 'fr' could become non-zero in
the second round.
To fix, this patch just moves "applyMinMax" block out one level.
2020-03-13 11:28:54 +01:00

133 lines
4.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html><head>
<meta charset="utf-8">
<title>CSS Grid Test: Testing track flex max-sizing with min/max</title>
<link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1309407">
<link rel="help" href="http://dev.w3.org/csswg/css-grid/#algo-flex-tracks">
<link rel="match" href="grid-max-sizing-flex-007-ref.html">
<style type="text/css">
.grid {
display: grid;
border:1px dashed;
margin: 3px;
}
.rows {
float: left;
grid: minmax(10px, 1fr) minmax(10px, 4fr) / 50px;
grid-row-gap: 33px;
}
.cols {
display: inline-grid;
grid: 50px / minmax(10px, 1fr) minmax(10px, 4fr);
grid-column-gap: 33px;
}
.item:nth-child(1) { background-color: purple; }
.item:nth-child(2) { background-color: blue; }
</style>
</head><body>
<!--
NOTE: The resulting size (in the relevant axis) is 83px for all tests below
in the "If the free space is an indefinite length" algo here:
https://drafts.csswg.org/css-grid/#algo-flex-tracks
These tests verifies that we then also apply min/max sizes per the spec:
"If using this flex fraction would cause the grid to be smaller than the grid
containers min-width/height (or larger than the grid containers max-width/
height), then redo this step, treating the free space as definite and the
available grid space as equal to the grid containers content box size when
its sized to its min-width/height (max-width/height)."
-->
<pre>These grids should look the same:</pre>
<div class="grid rows" style="max-height:70px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid rows" style="min-height:70px; max-height:60px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid rows" style="height:70px">
<div class="item"></div>
<div class="item"></div>
</div>
<br clear="all">
<pre>These grids should look the same:</pre>
<div class="grid rows" style="min-height:90px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid rows" style="min-height:90px; max-height:60px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid rows" style="height:90px">
<div class="item"></div>
<div class="item"></div>
</div>
<br clear="all">
<pre>These grids should look the same:</pre>
<div class="grid cols" style="max-width:70px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid cols" style="min-width:70px; max-width:60px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid cols" style="width:70px">
<div class="item"></div>
<div class="item"></div>
</div>
<pre>These grids should look the same:</pre>
<div class="grid cols" style="min-width:90px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid cols" style="min-width:90px; max-width:60px">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="grid cols" style="width:90px">
<div class="item"></div>
<div class="item"></div>
</div>
<pre>The first 6 grids should look the same:</pre>
<div class="grid rows" style="grid: 1fr / 30px; min-height:83px">
<div class="item"></div>
</div>
<div class="grid rows" style="grid: 10px 1fr / 30px; min-height:83px">
<div class="item" style="grid-row:span 2"></div>
</div>
<div class="grid rows" style="grid: 1fr / 30px; max-height:30px; min-height:83px">
<div class="item"></div>
</div>
<div class="grid rows" style="grid: 1fr 1fr / 30px; max-height:83px">
<div class="item" style="grid-row:span 2"><div style="height:90px"></div></div>
</div>
<div class="grid rows" style="grid: 1fr auto / 30px; max-height:83px">
<div class="item" style="grid-row:span 2"><div style="height:90px"></div></div>
</div>
<div class="grid rows" style="grid: 10px 1fr / 30px; max-height:83px">
<div class="item" style="grid-row:span 2"><div style="height:90px"></div></div>
</div>
<div class="grid rows" style="grid: 1fr 1fr / 30px; grid-row-gap:10px; max-height:83px">
<div class="item" style="grid-row:span 2"><div style="height:40px"></div></div>
<div class="item"><div style="height:40px"></div></div>
</div>
</body></html>