Fix auto block-size of auto-filled nested multicol.

Don't use the entire outer fragmentainer if there's no content that
needs it.

Note that we only shrink the size of the inner multicol fragments, not
the inner *column* fragments (fragmentainers). They will still use the
entire outer fragmentainer, which isn't ideal, but shrinking those too
would cause trouble for some out-of-flow positioning tests, and I
couldn't come up with an easy way to work around that.

Bug: 1339963
Change-Id: Ifd20922d58e22306b04e7ac784a4fca0f46ffe39
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3936279
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Reviewed-by: Alison Maher <almaher@microsoft.com>
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1056230}
diff --git a/css/css-multicol/auto-fill-auto-size-001-print-ref.html b/css/css-multicol/auto-fill-auto-size-001-print-ref.html
new file mode 100644
index 0000000..fcd9b7d
--- /dev/null
+++ b/css/css-multicol/auto-fill-auto-size-001-print-ref.html
@@ -0,0 +1,3 @@
+<!DOCTYPE html>
+<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
+On the first page
diff --git a/css/css-multicol/auto-fill-auto-size-001-print.html b/css/css-multicol/auto-fill-auto-size-001-print.html
new file mode 100644
index 0000000..6652fe1
--- /dev/null
+++ b/css/css-multicol/auto-fill-auto-size-001-print.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
+<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1339963">
+<link rel="match" href="auto-fill-auto-size-001-print-ref.html">
+<div style="columns:2; column-fill:auto; border:10px solid red; border-top:none; border-bottom:none;"></div>
+On the first page
diff --git a/css/css-multicol/auto-fill-auto-size-002-print-ref.html b/css/css-multicol/auto-fill-auto-size-002-print-ref.html
new file mode 100644
index 0000000..2ae0778
--- /dev/null
+++ b/css/css-multicol/auto-fill-auto-size-002-print-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
+<style>
+  body { margin: 0; }
+</style>
+<div style="height:150vh;"></div>
+Middle of second page
diff --git a/css/css-multicol/auto-fill-auto-size-002-print.html b/css/css-multicol/auto-fill-auto-size-002-print.html
new file mode 100644
index 0000000..4e02432
--- /dev/null
+++ b/css/css-multicol/auto-fill-auto-size-002-print.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
+<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1339963">
+<link rel="match" href="auto-fill-auto-size-002-print-ref.html">
+<style>
+  body { margin: 0; }
+</style>
+<div style="columns:2; column-fill:auto;">
+  <div style="height:250vh;"></div>
+</div>
+Middle of second page
diff --git a/css/css-multicol/multicol-nested-025.html b/css/css-multicol/multicol-nested-025.html
new file mode 100644
index 0000000..badc91e
--- /dev/null
+++ b/css/css-multicol/multicol-nested-025.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
+<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1339963">
+<link rel="match" href="../reference/nothing.html">
+<p>There should be nothing below.</p>
+<div style="columns:2; column-fill:auto; height:100px;">
+  <div style="columns:2; column-fill:auto; background:red;"></div>
+</div>
diff --git a/css/css-multicol/multicol-nested-026.html b/css/css-multicol/multicol-nested-026.html
new file mode 100644
index 0000000..25371b7
--- /dev/null
+++ b/css/css-multicol/multicol-nested-026.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
+<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1339963">
+<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
+<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+<div style="columns:2; gap:0; column-fill:auto; width:100px; height:100px;">
+  <div style="columns:2; gap:0; column-fill:auto; background:red;">
+    <div style="height:150px;">
+      <div style="height:150px; background:green;"></div>
+      <div style="width:200%; height:100px; background:green;"></div>
+    </div>
+  </div>
+  <div style="height:50px; background:green;"></div>
+</div>
diff --git a/css/css-multicol/multicol-nested-027.html b/css/css-multicol/multicol-nested-027.html
new file mode 100644
index 0000000..02590d3
--- /dev/null
+++ b/css/css-multicol/multicol-nested-027.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
+<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1339963">
+<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
+<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+<div style="columns:2; gap:0; column-fill:auto; width:100px; height:100px; background:red;">
+  <div style="columns:2; gap:0; column-fill:auto; min-height:75px; background:green;">
+    <div style="height:50px;"></div>
+  </div>
+  <div style="height:25px; background:green;"></div>
+  <div style="break-inside:avoid; height:100px; background:green;"></div>
+</div>
diff --git a/css/css-multicol/multicol-nested-028.html b/css/css-multicol/multicol-nested-028.html
new file mode 100644
index 0000000..cfd164f
--- /dev/null
+++ b/css/css-multicol/multicol-nested-028.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
+<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1339963">
+<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
+<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+<div style="columns:4; gap:0; column-fill:auto; width:100px; height:100px; background:red;">
+  <div style="columns:2; gap:0; column-fill:auto; min-height:125px; background:green;">
+    <div style="height:205px;"></div>
+  </div>
+  <div style="break-inside:avoid; height:75px; background:green;"></div>
+  <div style="break-inside:avoid; height:200px; background:green;"></div>
+</div>