Bug 1316029 - [css-grid] Reftests for Automatic Minimum Size clamping for grid items with an intrinsic size but without an intrinsic ratio.
authorMats Palmgren <mats@mozilla.com>
Fri, 11 Nov 2016 18:28:43 +0100
changeset 348961 410135b3dd561a6d6e7f8664504cc7afee67d142
parent 348960 f250ead28c6975a8822dad4d4cd544d77fcc3a87
child 348962 66639f197fa262ce961a7d018d8f473b63413e5b
push id10298
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:33:03 +0000
treeherdermozilla-aurora@7e29173b1641 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1316029
milestone52.0a1
Bug 1316029 - [css-grid] Reftests for Automatic Minimum Size clamping for grid items with an intrinsic size but without an intrinsic ratio.
layout/reftests/css-grid/grid-item-intrinsic-size-normal-001-ref.html
layout/reftests/css-grid/grid-item-intrinsic-size-normal-001.html
layout/reftests/css-grid/grid-item-intrinsic-size-normal-002-ref.html
layout/reftests/css-grid/grid-item-intrinsic-size-normal-002.html
layout/reftests/css-grid/reftest.list
new file mode 100644
--- /dev/null
+++ b/layout/reftests/css-grid/grid-item-intrinsic-size-normal-001-ref.html
@@ -0,0 +1,237 @@
+<!DOCTYPE HTML>
+<!--
+     Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<html><head>
+  <meta charset="utf-8">
+  <title>Reference: stretching intrinsic size items with 'normal' and/or 'stretch' and min/max-size, with Automatic Minimum Size clamping</title>
+  <link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">
+  <style type="text/css">
+* { vertical-align: bottom; }
+.grid {
+  display: inline-grid;
+  border: 3px solid grey;
+  grid: 32px / 4px;
+  margin-right:20px;
+}
+.r { grid: 4px / 32px; }
+
+button {
+  border: 1px solid;
+  padding: 0;
+  margin: 0;
+  background: lightgrey;
+}
+
+.start {align-self:start; justify-self:start}
+.na {align-self:start; justify-self:start}
+.sa {align-self:start; justify-self:start}
+.an {align-self:start; justify-self:start}
+.as {align-self:start; justify-self:start}
+.w20 { width: 20px min-width: 0px; }
+.mw20 { min-width: 20px }
+.mw0 { min-width: 0px }
+
+.h20 { height: 20px; min-height: 0px; }
+.mh20 { min-height: 20px }
+.mh0 { min-height: 0px }
+
+  </style>
+</head>
+<body>
+
+<div class="grid r"><button></button></div>
+<div class="grid r"><button class="start"></button></div>
+<div class="grid r"><button class="sa"></button></div>
+<div class="grid r"><button class="sa mxw10"></button></div>
+<div class="grid r"><button class="na"></button></div>
+<div class="grid r"><button class="na mxw2"></button></div>
+
+<pre><!--min-height:20px--></pre>
+<div class="grid r"><button class="mh20"></button></div>
+<div class="grid r"><button class="mh20 mxw10"></button></div>
+<div class="grid r"><button class="start mh20"></button></div>
+<div class="grid r"><button class="start mh20 mxw10"></button></div>
+<div class="grid r"><button class="sa mh20"></button></div>
+<div class="grid r"><button class="sa mh20 mxw10"></button></div>
+<div class="grid r"><button class="na mh20"></button></div>
+<div class="grid r"><button class="na mh20 mxw10"></button></div>
+
+<pre><!--min-height:0--></pre>
+<div class="grid r"><button class="mh0"></button></div>
+<div class="grid r"><button class="mh0 mxw10"></button></div>
+<div class="grid r"><button class="start mh0"></button></div>
+<div class="grid r"><button class="start mh0 mxw10"></button></div>
+<div class="grid r"><button class="sa mh0"></button></div>
+<div class="grid r"><button class="sa mh0 mxw10"></button></div>
+<div class="grid r"><button class="na mh0"></button></div>
+<div class="grid r"><button class="na mh0 mxw2"></button></div>
+
+<pre><!----></pre>
+
+<div class="grid"><button></button></div>
+<div class="grid"><button class="mxw2"></button></div>
+<div class="grid"><button class="start"></button></div>
+<div class="grid"><button class="start mxw2"></button></div>
+<div class="grid"><button class="sa"></button></div>
+<div class="grid"><button class="sa mxw2"></button></div>
+<div class="grid"><button class="na"></button></div>
+<div class="grid"><button class="na mxw2"></button></div>
+
+<pre><!--min-width:20px--></pre>
+<div class="grid"><button class="mw20"></button></div>
+<div class="grid"><button class="mw20 mxh10"></button></div>
+<div class="grid"><button class="start mw20"></button></div>
+<div class="grid"><button class="start mw20 mxh10"></button></div>
+<div class="grid"><button class="sa mw20"></button></div>
+<div class="grid"><button class="sa mw20 mxh10"></button></div>
+<div class="grid"><button class="na mw20"></button></div>
+<div class="grid"><button class="na mw20 mxh10"></button></div>
+
+<pre><!--min-width:0--></pre>
+<div class="grid"><button class="mw0"></button></div>
+<div class="grid"><button class="mw0 mxh10"></button></div>
+<div class="grid"><button class="start mw0"></button></div>
+<div class="grid"><button class="start mw0 mxh10"></button></div>
+<div class="grid"><button class="sa mw0"></button></div>
+<div class="grid"><button class="sa mw0 mxh10"></button></div>
+<div class="grid"><button class="na mw0"></button></div>
+<div class="grid"><button class="na mw0 mxh10"></button></div>
+
+<pre><!--width:20px--></pre>
+
+<div class="grid r"><button class="w20"></button></div>
+<div class="grid r"><button class="w20 mxh10"></button></div>
+<div class="grid r"><button class="start w20"></button></div>
+<div class="grid r"><button class="start w20 mxh10"></button></div>
+<div class="grid r"><button class="sa w20"></button></div>
+<div class="grid r"><button class="sa w20 mxh2"></button></div>
+<div class="grid r"><button class="na w20"></button></div>
+<div class="grid r"><button class="na w20 mxh2"></button></div>
+
+<pre><!--width:20px--></pre>
+
+<div class="grid"><button class="start w20"></button></div>
+<div class="grid"><button class="start w20 mxh10"></button></div>
+<div class="grid"><button class="start w20"></button></div>
+<div class="grid"><button class="start w20 mxh10"></button></div>
+<div class="grid"><button class="sa w20"></button></div>
+<div class="grid"><button class="sa w20 mxh10"></button></div>
+<div class="grid"><button class="na w20"></button></div>
+<div class="grid"><button class="na w20 mxh10"></button></div>
+
+<pre><!--height:20px--></pre>
+
+<div class="grid r"><button class="h20"></button></div>
+<div class="grid r"><button class="h20 mxw10"></button></div>
+<div class="grid r"><button class="start h20"></button></div>
+<div class="grid r"><button class="start h20 mxw10"></button></div>
+<div class="grid r"><button class="as h20"></button></div>
+<div class="grid r"><button class="as h20 mxw10"></button></div>
+<div class="grid r"><button class="an h20"></button></div>
+<div class="grid r"><button class="an h20 mxw10"></button></div>
+
+<pre><!--height:20px--></pre>
+
+<div class="grid"><button class="h20"></button></div>
+<div class="grid"><button class="h20 mxw2"></button></div>
+<div class="grid"><button class="start h20"></button></div>
+<div class="grid"><button class="start h20 mxw10"></button></div>
+<div class="grid"><button class="as h20"></button></div>
+<div class="grid"><button class="as h20 mxw2"></button></div>
+<div class="grid"><button class="an h20"></button></div>
+<div class="grid"><button class="an h20 mxw10"></button></div>
+
+<script>
+var buttonSizes =
+[
+  ['32px', '4px'],
+  ['8px', '4px'],
+  ['8px', '4px'],
+  ['8px', '4px'],
+  ['8px', '4px'],
+  ['2px', '4px'],
+  ['32px', '20px'],
+  ['10px', '20px'],
+  ['8px', '20px'],
+  ['8px', '20px'],
+  ['8px', '20px'],
+  ['8px', '20px'],
+  ['8px', '20px'],
+  ['8px', '20px'],
+  ['32px', '4px'],
+  ['10px', '4px'],
+  ['8px', '4px'],
+  ['8px', '4px'],
+  ['8px', '4px'],
+  ['8px', '4px'],
+  ['8px', '4px'],
+  ['2px', '4px'],
+  ['4px', '32px'],
+  ['2px', '32px'],
+  ['4px', '4px'],
+  ['2px', '4px'],
+  ['4px', '32px'],
+  ['2px', '32px'],
+  ['4px', '32px'],
+  ['2px', '32px'],
+  ['20px', '32px'],
+  ['20px', '10px'],
+  ['20px', '4px'],
+  ['20px', '4px'],
+  ['20px', '32px'],
+  ['20px', '10px'],
+  ['20px', '32px'],
+  ['20px', '10px'],
+  ['4px', '32px'],
+  ['4px', '10px'],
+  ['8px', '4px'],
+  ['8px', '4px'],
+  ['8px', '32px'],
+  ['8px', '10px'],
+  ['8px', '32px'],
+  ['8px', '10px'],
+  ['20px', '4px'],
+  ['20px', '4px'],
+  ['20px', '4px'],
+  ['20px', '4px'],
+  ['20px', '4px'],
+  ['20px', '2px'],
+  ['20px', '4px'],
+  ['20px', '2px'],
+  ['20px', '4px'],
+  ['20px', '4px'],
+  ['20px', '4px'],
+  ['20px', '4px'],
+  ['20px', '32px'],
+  ['20px', '10px'],
+  ['20px', '32px'],
+  ['20px', '10px'],
+  ['32px', '20px'],
+  ['10px', '20px'],
+  ['8px', '20px'],
+  ['8px', '20px'],
+  ['32px', '20px'],
+  ['10px', '20px'],
+  ['32px', '20px'],
+  ['10px', '20px'],
+  ['4px', '20px'],
+  ['2px', '20px'],
+  ['4px', '20px'],
+  ['4px', '20px'],
+  ['4px', '20px'],
+  ['2px', '20px'],
+  ['4px', '20px'],
+  ['4px', '20px'],
+];
+var buttons = document.querySelectorAll('button');
+for (var i = 0; i < buttons.length; ++i) {
+  var button = buttons[i];
+  button.style.width = buttonSizes[i][0];
+  button.style.height = buttonSizes[i][1];
+}
+</script>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/css-grid/grid-item-intrinsic-size-normal-001.html
@@ -0,0 +1,168 @@
+<!DOCTYPE HTML>
+<!--
+     Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<html><head>
+  <meta charset="utf-8">
+  <title>CSS Grid Test: stretching intrinsic size items with 'normal' and/or 'stretch' and min/max-size, with Automatic Minimum Size clamping</title>
+  <link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">
+  <link rel="help" href="https://drafts.csswg.org/css-align-3/#valdef-justify-self-normal">
+  <link rel="match" href="grid-item-intrinsic-ratio-normal-003-ref.html">
+  <style type="text/css">
+* { vertical-align: bottom; }
+.grid {
+  display: inline-grid;
+  border: 3px solid grey;
+  grid: 32px / 4px;
+  margin-right:20px;
+}
+.r { grid: 4px / 32px; }
+
+button {
+  border: 1px solid;
+  padding: 0;
+  margin: 0;
+  background: lightgrey;
+}
+
+.start {align-self:start; justify-self:start}
+.na {align-self:normal; justify-self:start}
+.sa {align-self:stretch; justify-self:start}
+.an {align-self:start; justify-self:normal}
+.as {align-self:start; justify-self:stretch}
+.w20 { width: 20px }
+.mw20 { min-width: 20px }
+.mxw10 { max-width: 10px }
+.mxw2 { max-width: 2px }
+.mw0 { min-width: 0px }
+
+.h20 { height: 20px }
+.mh20 { min-height: 20px }
+.mxh10 { max-height: 10px }
+.mxh2 { max-height: 2px }
+.mh0 { min-height: 0px }
+
+  </style>
+</head>
+<body>
+
+<div class="grid r"><button></button></div>
+<div class="grid r"><button class="start"></button></div>
+<div class="grid r"><button class="sa"></button></div>
+<div class="grid r"><button class="sa mxw10"></button></div>
+<div class="grid r"><button class="na"></button></div>
+<div class="grid r"><button class="na mxw2"></button></div>
+
+<pre><!--min-height:20px--></pre>
+<div class="grid r"><button class="mh20"></button></div>
+<div class="grid r"><button class="mh20 mxw10"></button></div>
+<div class="grid r"><button class="start mh20"></button></div>
+<div class="grid r"><button class="start mh20 mxw10"></button></div>
+<div class="grid r"><button class="sa mh20"></button></div>
+<div class="grid r"><button class="sa mh20 mxw10"></button></div>
+<div class="grid r"><button class="na mh20"></button></div>
+<div class="grid r"><button class="na mh20 mxw10"></button></div>
+
+<pre><!--min-height:0--></pre>
+<div class="grid r"><button class="mh0"></button></div>
+<div class="grid r"><button class="mh0 mxw10"></button></div>
+<div class="grid r"><button class="start mh0"></button></div>
+<div class="grid r"><button class="start mh0 mxw10"></button></div>
+<div class="grid r"><button class="sa mh0"></button></div>
+<div class="grid r"><button class="sa mh0 mxw10"></button></div>
+<div class="grid r"><button class="na mh0"></button></div>
+<div class="grid r"><button class="na mh0 mxw2"></button></div>
+
+<pre><!----></pre>
+
+<div class="grid"><button></button></div>
+<div class="grid"><button class="mxw2"></button></div>
+<div class="grid"><button class="start"></button></div>
+<div class="grid"><button class="start mxw2"></button></div>
+<div class="grid"><button class="sa"></button></div>
+<div class="grid"><button class="sa mxw2"></button></div>
+<div class="grid"><button class="na"></button></div>
+<div class="grid"><button class="na mxw2"></button></div>
+
+<pre><!--min-width:20px--></pre>
+<div class="grid"><button class="mw20"></button></div>
+<div class="grid"><button class="mw20 mxh10"></button></div>
+<div class="grid"><button class="start mw20"></button></div>
+<div class="grid"><button class="start mw20 mxh10"></button></div>
+<div class="grid"><button class="sa mw20"></button></div>
+<div class="grid"><button class="sa mw20 mxh10"></button></div>
+<div class="grid"><button class="na mw20"></button></div>
+<div class="grid"><button class="na mw20 mxh10"></button></div>
+
+<pre><!--min-width:0--></pre>
+<div class="grid"><button class="mw0"></button></div>
+<div class="grid"><button class="mw0 mxh10"></button></div>
+<div class="grid"><button class="start mw0"></button></div>
+<div class="grid"><button class="start mw0 mxh10"></button></div>
+<div class="grid"><button class="sa mw0"></button></div>
+<div class="grid"><button class="sa mw0 mxh10"></button></div>
+<div class="grid"><button class="na mw0"></button></div>
+<div class="grid"><button class="na mw0 mxh10"></button></div>
+
+<pre><!--width:20px--></pre>
+
+<div class="grid r"><button class="w20"></button></div>
+<div class="grid r"><button class="w20 mxh10"></button></div>
+<div class="grid r"><button class="start w20"></button></div>
+<div class="grid r"><button class="start w20 mxh10"></button></div>
+<div class="grid r"><button class="sa w20"></button></div>
+<div class="grid r"><button class="sa w20 mxh2"></button></div>
+<div class="grid r"><button class="na w20"></button></div>
+<div class="grid r"><button class="na w20 mxh2"></button></div>
+
+<pre><!--width:20px--></pre>
+
+<div class="grid"><button class="start w20"></button></div>
+<div class="grid"><button class="start w20 mxh10"></button></div>
+<div class="grid"><button class="start w20"></button></div>
+<div class="grid"><button class="start w20 mxh10"></button></div>
+<div class="grid"><button class="sa w20"></button></div>
+<div class="grid"><button class="sa w20 mxh10"></button></div>
+<div class="grid"><button class="na w20"></button></div>
+<div class="grid"><button class="na w20 mxh10"></button></div>
+
+<pre><!--height:20px--></pre>
+
+<div class="grid r"><button class="h20"></button></div>
+<div class="grid r"><button class="h20 mxw10"></button></div>
+<div class="grid r"><button class="start h20"></button></div>
+<div class="grid r"><button class="start h20 mxw10"></button></div>
+<div class="grid r"><button class="as h20"></button></div>
+<div class="grid r"><button class="as h20 mxw10"></button></div>
+<div class="grid r"><button class="an h20"></button></div>
+<div class="grid r"><button class="an h20 mxw10"></button></div>
+
+<pre><!--height:20px--></pre>
+
+<div class="grid"><button class="h20"></button></div>
+<div class="grid"><button class="h20 mxw2"></button></div>
+<div class="grid"><button class="start h20"></button></div>
+<div class="grid"><button class="start h20 mxw10"></button></div>
+<div class="grid"><button class="as h20"></button></div>
+<div class="grid"><button class="as h20 mxw2"></button></div>
+<div class="grid"><button class="an h20"></button></div>
+<div class="grid"><button class="an h20 mxw10"></button></div>
+
+
+<!--  For generating button size results in -ref file
+<script>
+document.body.clientHeight;
+var buttons = document.querySelectorAll('button');
+var s = '  [\n';
+for (var i = 0; i < buttons.length; ++i) {
+  var cs = window.getComputedStyle(buttons[i]);
+  s += "  ['"+ cs['width'] + "', '" + cs['height'] + "'],\n";
+}
+s += ']';
+console.log(s)
+</script>
+-->
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/css-grid/grid-item-intrinsic-size-normal-002-ref.html
@@ -0,0 +1,234 @@
+<!DOCTYPE HTML>
+<!--
+     Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<html><head>
+  <meta charset="utf-8">
+  <title>Reference: stretching intrinsic size items with 'normal' and/or 'stretch' and min/max-size, with Automatic Minimum Size clamping</title>
+  <link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">
+  <style type="text/css">
+* { vertical-align: top; }
+.grid {
+  display: inline-grid;
+  border: 3px solid grey;
+  grid: 32px / 4px;
+  margin-right:20px;
+  align-items: start;
+  justify-items: start;
+}
+.r { grid: 4px / 32px; }
+
+iframe {
+  border: 1px solid;
+  padding: 0;
+  margin: 0;
+  background: lightgrey;
+}
+
+.w20 { width: 20px min-width: 0px; }
+.mw20 { min-width: 20px }
+.mw0 { min-width: 0px }
+
+.h20 { height: 20px; min-height: 0px; }
+.mh20 { min-height: 20px }
+.mh0 { min-height: 0px }
+
+  </style>
+</head>
+<body>
+
+<div class="grid r"><iframe></iframe></div>
+<div class="grid r"><iframe class="start"></iframe></div>
+<div class="grid r"><iframe class="sa"></iframe></div>
+<div class="grid r"><iframe class="sa mxw10"></iframe></div>
+<div class="grid r"><iframe class="na"></iframe></div>
+<div class="grid r"><iframe class="na mxw2"></iframe></div>
+
+<pre><!--min-height:20px--></pre>
+<div class="grid r" style="margin-right:0"><iframe class="mh20"></iframe></div>
+<div class="grid r"><iframe class="mh20 mxw10"></iframe></div>
+<div class="grid r"><iframe class="start mh20"></iframe></div>
+<div class="grid r"><iframe class="start mh20 mxw10"></iframe></div>
+<div class="grid r"><iframe class="sa mh20"></iframe></div>
+<div class="grid r"><iframe class="sa mh20 mxw10"></iframe></div>
+<div class="grid r"><iframe class="na mh20"></iframe></div>
+<div class="grid r"><iframe class="na mh20 mxw10"></iframe></div>
+
+<pre><!--min-height:0--></pre>
+<div class="grid r"><iframe class="mh0"></iframe></div>
+<div class="grid r"><iframe class="mh0 mxw10"></iframe></div>
+<div class="grid r"><iframe class="start mh0"></iframe></div>
+<div class="grid r"><iframe class="start mh0 mxw10"></iframe></div>
+<div class="grid r"><iframe class="sa mh0"></iframe></div>
+<div class="grid r"><iframe class="sa mh0 mxw10"></iframe></div>
+<div class="grid r"><iframe class="na mh0"></iframe></div>
+<div class="grid r"><iframe class="na mh0 mxw2"></iframe></div>
+
+<pre><!----></pre>
+
+<div class="grid"><iframe></iframe></div>
+<div class="grid"><iframe class="mxw2"></iframe></div>
+<div class="grid"><iframe class="start"></iframe></div>
+<div class="grid"><iframe class="start mxw2"></iframe></div>
+<div class="grid"><iframe class="sa"></iframe></div>
+<div class="grid"><iframe class="sa mxw2"></iframe></div>
+<div class="grid"><iframe class="na"></iframe></div>
+<div class="grid"><iframe class="na mxw2"></iframe></div>
+
+<pre><!--min-width:20px--></pre>
+<div class="grid"><iframe class="mw20"></iframe></div>
+<div class="grid"><iframe class="mw20 mxh10"></iframe></div>
+<div class="grid"><iframe class="start mw20"></iframe></div>
+<div class="grid" style="margin-top:5px"><iframe class="start mw20 mxh10"></iframe></div>
+<div class="grid" style="margin-top:10px"><iframe class="sa mw20"></iframe></div>
+<div class="grid" style="margin-top:25px"><iframe class="sa mw20 mxh10"></iframe></div>
+<div class="grid"><iframe class="na mw20"></iframe></div>
+<div class="grid" style="margin-top:5px"><iframe class="na mw20 mxh10 mxw10"></iframe></div>
+
+<pre><!--min-width:0--></pre>
+<div class="grid"><iframe class="mw0"></iframe></div>
+<div class="grid"><iframe class="mw0 mxh10"></iframe></div>
+<div class="grid"><iframe class="start mw0"></iframe></div>
+<div class="grid" style="margin-top:5px"><iframe class="start mw0 mxh10"></iframe></div>
+<div class="grid" style="margin-top:10px"><iframe class="sa mw0"></iframe></div>
+<div class="grid" style="margin-top:25px"><iframe class="sa mw0 mxh10 mxw10"></iframe></div>
+<div class="grid"><iframe class="na mw0 mxw10"></iframe></div>
+<div class="grid" style="margin-top:5px"><iframe class="na mw0 mxh10"></iframe></div>
+
+<pre><!--width:20px--></pre>
+
+<div class="grid r"><iframe class="w20"></iframe></div>
+<div class="grid r"><iframe class="w20 mxh10"></iframe></div>
+<div class="grid r"><iframe class="start w20"></iframe></div>
+<div class="grid r"><iframe class="start w20 mxh10"></iframe></div>
+<div class="grid r"><iframe class="sa w20"></iframe></div>
+<div class="grid r"><iframe class="sa w20 mxh2"></iframe></div>
+<div class="grid r"><iframe class="na w20"></iframe></div>
+<div class="grid r"><iframe class="na w20 mxh2"></iframe></div>
+
+<pre><!--width:20px--></pre>
+
+<div class="grid"><iframe class="start w20"></iframe></div>
+<div class="grid"><iframe class="start w20 mxh10"></iframe></div>
+<div class="grid"><iframe class="start w20"></iframe></div>
+<div class="grid"><iframe class="start w20 mxh10"></iframe></div>
+<div class="grid"><iframe class="sa w20"></iframe></div>
+<div class="grid"><iframe class="sa w20 mxh10"></iframe></div>
+<div class="grid"><iframe class="na w20"></iframe></div>
+<div class="grid"><iframe class="na w20 mxh10"></iframe></div>
+
+<pre><!--height:20px--></pre>
+
+<div class="grid r"><iframe class="h20"></iframe></div>
+<div class="grid r"><iframe class="h20 mxw10"></iframe></div>
+<div class="grid r"><iframe class="start h20"></iframe></div>
+<div class="grid r"><iframe class="start h20 mxw10"></iframe></div>
+<div class="grid r"><iframe class="as h20"></iframe></div>
+<div class="grid r"><iframe class="as h20 mxw10"></iframe></div>
+<div class="grid r"><iframe class="an h20"></iframe></div>
+<div class="grid r"><iframe class="an h20 mxw10"></iframe></div>
+
+<pre><!--height:20px--></pre>
+
+<div class="grid"><iframe class="h20"></iframe></div>
+<div class="grid"><iframe class="h20 mxw2"></iframe></div>
+<div class="grid"><iframe class="start h20"></iframe></div>
+<div class="grid"><iframe class="start h20 mxw10"></iframe></div>
+<div class="grid"><iframe class="as h20"></iframe></div>
+<div class="grid"><iframe class="as h20 mxw2"></iframe></div>
+<div class="grid"><iframe class="an h20"></iframe></div>
+<div class="grid"><iframe class="an h20 mxw10"></iframe></div>
+
+<script>
+var iframeSizes =
+[
+  ['30px', '2px'],
+  ['30px', '2px'],
+  ['30px', '2px'],
+  ['10px', '2px'],
+  ['30px', '2px'],
+  ['2px', '2px'],
+  ['30px', '20px'],
+  ['10px', '20px'],
+  ['30px', '150px'],
+  ['10px', '150px'],
+  ['30px', '20px'],
+  ['10px', '20px'],
+  ['30px', '20px'],
+  ['10px', '20px'],
+  ['30px', '2px'],
+  ['10px', '2px'],
+  ['30px', '150px'],
+  ['10px', '150px'],
+  ['30px', '2px'],
+  ['10px', '2px'],
+  ['30px', '2px'],
+  ['2px', '2px'],
+  ['2px', '30px'],
+  ['2px', '30px'],
+  ['2px', '30px'],
+  ['2px', '30px'],
+  ['2px', '30px'],
+  ['2px', '30px'],
+  ['2px', '30px'],
+  ['2px', '30px'],
+  ['20px', '30px'],
+  ['20px', '10px'],
+  ['300px', '30px'],
+  ['300px', '10px'],
+  ['300px', '30px'],
+  ['300px', '10px'],
+  ['300px', '30px'],
+  ['20px', '10px'],
+  ['2px', '30px'],
+  ['2px', '10px'],
+  ['300px', '30px'],
+  ['300px', '10px'],
+  ['300px', '30px'],
+  ['10px', '10px'],
+  ['10px', '30px'],
+  ['300px', '10px'],
+  ['20px', '2px'],
+  ['20px', '2px'],
+  ['20px', '2px'],
+  ['20px', '2px'],
+  ['20px', '2px'],
+  ['20px', '2px'],
+  ['20px', '2px'],
+  ['20px', '2px'],
+  ['20px', '30px'],
+  ['20px', '10px'],
+  ['20px', '30px'],
+  ['20px', '10px'],
+  ['20px', '30px'],
+  ['20px', '10px'],
+  ['20px', '30px'],
+  ['20px', '10px'],
+  ['30px', '20px'],
+  ['10px', '20px'],
+  ['30px', '20px'],
+  ['10px', '20px'],
+  ['30px', '20px'],
+  ['10px', '20px'],
+  ['30px', '20px'],
+  ['10px', '20px'],
+  ['2px', '20px'],
+  ['2px', '20px'],
+  ['2px', '20px'],
+  ['2px', '20px'],
+  ['2px', '20px'],
+  ['2px', '20px'],
+  ['2px', '20px'],
+  ['2px', '20px'],
+];
+var iframes = document.querySelectorAll('iframe');
+for (var i = 0; i < iframes.length; ++i) {
+  var iframe = iframes[i];
+  iframe.style.width = iframeSizes[i][0];
+  iframe.style.height = iframeSizes[i][1];
+}
+</script>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/css-grid/grid-item-intrinsic-size-normal-002.html
@@ -0,0 +1,168 @@
+<!DOCTYPE HTML>
+<!--
+     Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<html><head>
+  <meta charset="utf-8">
+  <title>CSS Grid Test: stretching intrinsic size items with 'normal' and/or 'stretch' and min/max-size, with Automatic Minimum Size clamping</title>
+  <link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">
+  <link rel="help" href="https://drafts.csswg.org/css-align-3/#valdef-justify-self-normal">
+  <link rel="match" href="grid-item-intrinsic-ratio-normal-003-ref.html">
+  <style type="text/css">
+* { vertical-align: top; }
+.grid {
+  display: inline-grid;
+  border: 3px solid grey;
+  grid: 32px / 4px;
+  margin-right:20px;
+}
+.r { grid: 4px / 32px; }
+
+iframe {
+  border: 1px solid;
+  padding: 0;
+  margin: 0;
+  background: lightgrey;
+}
+
+.start {align-self:start; justify-self:start}
+.na {align-self:normal; justify-self:start}
+.sa {align-self:stretch; justify-self:start}
+.an {align-self:start; justify-self:normal}
+.as {align-self:start; justify-self:stretch}
+.w20 { width: 20px }
+.mw20 { min-width: 20px }
+.mxw10 { max-width: 10px }
+.mxw2 { max-width: 2px }
+.mw0 { min-width: 0px }
+
+.h20 { height: 20px }
+.mh20 { min-height: 20px }
+.mxh10 { max-height: 10px }
+.mxh2 { max-height: 2px }
+.mh0 { min-height: 0px }
+
+  </style>
+</head>
+<body>
+
+<div class="grid r"><iframe></iframe></div>
+<div class="grid r"><iframe class="start"></iframe></div>
+<div class="grid r"><iframe class="sa"></iframe></div>
+<div class="grid r"><iframe class="sa mxw10"></iframe></div>
+<div class="grid r"><iframe class="na"></iframe></div>
+<div class="grid r"><iframe class="na mxw2"></iframe></div>
+
+<pre><!--min-height:20px--></pre>
+<div class="grid r" style="margin-right:0"><iframe class="mh20"></iframe></div>
+<div class="grid r"><iframe class="mh20 mxw10"></iframe></div>
+<div class="grid r"><iframe class="start mh20"></iframe></div>
+<div class="grid r"><iframe class="start mh20 mxw10"></iframe></div>
+<div class="grid r"><iframe class="sa mh20"></iframe></div>
+<div class="grid r"><iframe class="sa mh20 mxw10"></iframe></div>
+<div class="grid r"><iframe class="na mh20"></iframe></div>
+<div class="grid r"><iframe class="na mh20 mxw10"></iframe></div>
+
+<pre><!--min-height:0--></pre>
+<div class="grid r"><iframe class="mh0"></iframe></div>
+<div class="grid r"><iframe class="mh0 mxw10"></iframe></div>
+<div class="grid r"><iframe class="start mh0"></iframe></div>
+<div class="grid r"><iframe class="start mh0 mxw10"></iframe></div>
+<div class="grid r"><iframe class="sa mh0"></iframe></div>
+<div class="grid r"><iframe class="sa mh0 mxw10"></iframe></div>
+<div class="grid r"><iframe class="na mh0"></iframe></div>
+<div class="grid r"><iframe class="na mh0 mxw2"></iframe></div>
+
+<pre><!----></pre>
+
+<div class="grid"><iframe></iframe></div>
+<div class="grid"><iframe class="mxw2"></iframe></div>
+<div class="grid"><iframe class="start"></iframe></div>
+<div class="grid"><iframe class="start mxw2"></iframe></div>
+<div class="grid"><iframe class="sa"></iframe></div>
+<div class="grid"><iframe class="sa mxw2"></iframe></div>
+<div class="grid"><iframe class="na"></iframe></div>
+<div class="grid"><iframe class="na mxw2"></iframe></div>
+
+<pre><!--min-width:20px--></pre>
+<div class="grid"><iframe class="mw20"></iframe></div>
+<div class="grid"><iframe class="mw20 mxh10"></iframe></div>
+<div class="grid"><iframe class="start mw20"></iframe></div>
+<div class="grid" style="margin-top:5px"><iframe class="start mw20 mxh10"></iframe></div>
+<div class="grid" style="margin-top:10px"><iframe class="sa mw20"></iframe></div>
+<div class="grid" style="margin-top:25px"><iframe class="sa mw20 mxh10"></iframe></div>
+<div class="grid"><iframe class="na mw20"></iframe></div>
+<div class="grid" style="margin-top:5px"><iframe class="na mw20 mxh10 mxw10"></iframe></div>
+
+<pre><!--min-width:0--></pre>
+<div class="grid"><iframe class="mw0"></iframe></div>
+<div class="grid"><iframe class="mw0 mxh10"></iframe></div>
+<div class="grid"><iframe class="start mw0"></iframe></div>
+<div class="grid" style="margin-top:5px"><iframe class="start mw0 mxh10"></iframe></div>
+<div class="grid" style="margin-top:10px"><iframe class="sa mw0"></iframe></div>
+<div class="grid" style="margin-top:25px"><iframe class="sa mw0 mxh10 mxw10"></iframe></div>
+<div class="grid"><iframe class="na mw0 mxw10"></iframe></div>
+<div class="grid" style="margin-top:5px"><iframe class="na mw0 mxh10"></iframe></div>
+
+<pre><!--width:20px--></pre>
+
+<div class="grid r"><iframe class="w20"></iframe></div>
+<div class="grid r"><iframe class="w20 mxh10"></iframe></div>
+<div class="grid r"><iframe class="start w20"></iframe></div>
+<div class="grid r"><iframe class="start w20 mxh10"></iframe></div>
+<div class="grid r"><iframe class="sa w20"></iframe></div>
+<div class="grid r"><iframe class="sa w20 mxh2"></iframe></div>
+<div class="grid r"><iframe class="na w20"></iframe></div>
+<div class="grid r"><iframe class="na w20 mxh2"></iframe></div>
+
+<pre><!--width:20px--></pre>
+
+<div class="grid"><iframe class="start w20"></iframe></div>
+<div class="grid"><iframe class="start w20 mxh10"></iframe></div>
+<div class="grid"><iframe class="start w20"></iframe></div>
+<div class="grid"><iframe class="start w20 mxh10"></iframe></div>
+<div class="grid"><iframe class="sa w20"></iframe></div>
+<div class="grid"><iframe class="sa w20 mxh10"></iframe></div>
+<div class="grid"><iframe class="na w20"></iframe></div>
+<div class="grid"><iframe class="na w20 mxh10"></iframe></div>
+
+<pre><!--height:20px--></pre>
+
+<div class="grid r"><iframe class="h20"></iframe></div>
+<div class="grid r"><iframe class="h20 mxw10"></iframe></div>
+<div class="grid r"><iframe class="start h20"></iframe></div>
+<div class="grid r"><iframe class="start h20 mxw10"></iframe></div>
+<div class="grid r"><iframe class="as h20"></iframe></div>
+<div class="grid r"><iframe class="as h20 mxw10"></iframe></div>
+<div class="grid r"><iframe class="an h20"></iframe></div>
+<div class="grid r"><iframe class="an h20 mxw10"></iframe></div>
+
+<pre><!--height:20px--></pre>
+
+<div class="grid"><iframe class="h20"></iframe></div>
+<div class="grid"><iframe class="h20 mxw2"></iframe></div>
+<div class="grid"><iframe class="start h20"></iframe></div>
+<div class="grid"><iframe class="start h20 mxw10"></iframe></div>
+<div class="grid"><iframe class="as h20"></iframe></div>
+<div class="grid"><iframe class="as h20 mxw2"></iframe></div>
+<div class="grid"><iframe class="an h20"></iframe></div>
+<div class="grid"><iframe class="an h20 mxw10"></iframe></div>
+
+
+<!-- For generating the item sizes used in the -ref file.
+<script>
+document.body.clientHeight;
+var iframes = document.querySelectorAll('iframe');
+var s = '  [\n';
+for (var i = 0; i < iframes.length; ++i) {
+  var cs = window.getComputedStyle(iframes[i]);
+  s += "  ['"+ cs['width'] + "', '" + cs['height'] + "'],\n";
+}
+s += ']';
+console.log(s)
+</script>
+-->
+
+</body>
+</html>
--- a/layout/reftests/css-grid/reftest.list
+++ b/layout/reftests/css-grid/reftest.list
@@ -99,16 +99,18 @@ skip-if(Android) == grid-auto-min-sizing
 == grid-item-intrinsic-ratio-stretch-005.html grid-item-intrinsic-ratio-stretch-005-ref.html
 == grid-item-intrinsic-ratio-stretch-006.html grid-item-intrinsic-ratio-stretch-006-ref.html
 == grid-item-intrinsic-ratio-stretch-007.html grid-item-intrinsic-ratio-stretch-007-ref.html
 == grid-item-intrinsic-ratio-normal-001.html grid-item-intrinsic-ratio-normal-001-ref.html
 == grid-item-intrinsic-ratio-normal-002.html grid-item-intrinsic-ratio-normal-002-ref.html
 == grid-item-intrinsic-ratio-normal-003.html grid-item-intrinsic-ratio-normal-003-ref.html
 == grid-item-intrinsic-ratio-normal-004.html grid-item-intrinsic-ratio-normal-004-ref.html
 == grid-item-intrinsic-ratio-normal-005.html grid-item-intrinsic-ratio-normal-005-ref.html
+== grid-item-intrinsic-size-normal-001.html grid-item-intrinsic-size-normal-001-ref.html
+== grid-item-intrinsic-size-normal-002.html grid-item-intrinsic-size-normal-002-ref.html
 == grid-item-auto-min-size-clamp-001.html grid-item-auto-min-size-clamp-001-ref.html
 == grid-item-auto-min-size-clamp-002.html grid-item-auto-min-size-clamp-002-ref.html
 == grid-item-auto-min-size-clamp-003.html grid-item-auto-min-size-clamp-003-ref.html
 == grid-item-auto-min-size-clamp-004.html grid-item-auto-min-size-clamp-004-ref.html
 == grid-item-auto-min-size-clamp-005.html grid-item-auto-min-size-clamp-005-ref.html
 == grid-item-auto-min-size-clamp-006.html grid-item-auto-min-size-clamp-006-ref.html
 == grid-item-auto-min-size-clamp-007.html grid-item-auto-min-size-clamp-007-ref.html
 == grid-item-canvas-001.html grid-item-canvas-001-ref.html