Don't stretch grid items with non-auto block-size.

Per the resolution in https://github.com/w3c/csswg-drafts/issues/4525.

Differential Revision: https://phabricator.services.mozilla.com/D60675

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1597055
gecko-commit: 4eb80ad3235c897dbf240d9042eca9297405ecb1
gecko-integration-branch: autoland
gecko-reviewers: mats
diff --git a/css/css-grid/grid-item-non-auto-height-stretch-001.html b/css/css-grid/grid-item-non-auto-height-stretch-001.html
new file mode 100644
index 0000000..458ed02
--- /dev/null
+++ b/css/css-grid/grid-item-non-auto-height-stretch-001.html
@@ -0,0 +1,22 @@
+<!doctype html>
+<title>Grid items only stretch if block-size computes to auto</title>
+<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/4525">
+<link rel="help" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
+<link rel="help" href="https://mozilla.org" title="Mozilla">
+<link rel="match" href="grid-item-non-auto-height-stretch-ref.html">
+<style>
+#grid {
+  display: grid;
+  width: 100px;
+  height: 100px;
+  grid-template: 100% / 100%;
+  background: green;
+}
+#item {
+  height: max-content;
+  background: red;
+}
+</style>
+<div id="grid">
+  <div id="item"></div>
+</div>
diff --git a/css/css-grid/grid-item-non-auto-height-stretch-002.html b/css/css-grid/grid-item-non-auto-height-stretch-002.html
new file mode 100644
index 0000000..9b2757f
--- /dev/null
+++ b/css/css-grid/grid-item-non-auto-height-stretch-002.html
@@ -0,0 +1,23 @@
+<!doctype html>
+<title>Grid items only stretch if block-size computes to auto</title>
+<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/4525">
+<link rel="help" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
+<link rel="help" href="https://mozilla.org" title="Mozilla">
+<link rel="match" href="grid-item-non-auto-height-stretch-ref.html">
+<style>
+#grid {
+  writing-mode: vertical-lr;
+  display: grid;
+  width: 100px;
+  height: 100px;
+  grid-template: 100% / 100%;
+  background: green;
+}
+#item {
+  width: max-content;
+  background: red;
+}
+</style>
+<div id="grid">
+  <div id="item"></div>
+</div>
diff --git a/css/css-grid/grid-item-non-auto-height-stretch-003.html b/css/css-grid/grid-item-non-auto-height-stretch-003.html
new file mode 100644
index 0000000..acd382b
--- /dev/null
+++ b/css/css-grid/grid-item-non-auto-height-stretch-003.html
@@ -0,0 +1,22 @@
+<!doctype html>
+<title>Grid items only stretch if block-size computes to auto</title>
+<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/4525">
+<link rel="help" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
+<link rel="help" href="https://mozilla.org" title="Mozilla">
+<link rel="match" href="grid-item-non-auto-height-stretch-ref.html">
+<style>
+#grid {
+  display: grid;
+  width: 100px;
+  height: 100px;
+  grid-template: 100% / 100%;
+  background: green;
+}
+#item {
+  height: min-content;
+  background: red;
+}
+</style>
+<div id="grid">
+  <div id="item"></div>
+</div>
diff --git a/css/css-grid/grid-item-non-auto-height-stretch-004.html b/css/css-grid/grid-item-non-auto-height-stretch-004.html
new file mode 100644
index 0000000..b68cf75
--- /dev/null
+++ b/css/css-grid/grid-item-non-auto-height-stretch-004.html
@@ -0,0 +1,23 @@
+<!doctype html>
+<title>Grid items only stretch if block-size computes to auto</title>
+<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/4525">
+<link rel="help" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
+<link rel="help" href="https://mozilla.org" title="Mozilla">
+<link rel="match" href="grid-item-non-auto-height-stretch-ref.html">
+<style>
+#grid {
+  writing-mode: vertical-lr;
+  display: grid;
+  width: 100px;
+  height: 100px;
+  grid-template: 100% / 100%;
+  background: green;
+}
+#item {
+  width: min-content;
+  background: red;
+}
+</style>
+<div id="grid">
+  <div id="item"></div>
+</div>
diff --git a/css/css-grid/grid-item-non-auto-height-stretch-ref.html b/css/css-grid/grid-item-non-auto-height-stretch-ref.html
new file mode 100644
index 0000000..1249dba
--- /dev/null
+++ b/css/css-grid/grid-item-non-auto-height-stretch-ref.html
@@ -0,0 +1,10 @@
+<!doctype html>
+<title>CSS test reference</title>
+<style>
+#ref {
+  width: 100px;
+  height: 100px;
+  background: green;
+}
+</style>
+<div id="ref"></div>