Fix for repeated table sections inside clipped container.

When we reach the block-end of a container with clipped overflow, we
re-lay out the last fragment with block fragmentation forced off. That's
RelayoutWithoutFragmentation() in NGLayoutAlgorithm. In this mode we
didn't handle repeated table sections correctly.

First of all, we wouldn't detect that the sections were repeatable at
all, because IsAvoidBreakValue() would return false, since the
constraint space says that we're not inside any block fragmentation (and
therefore break-inside:avoid should have no effect). Move that check
into code that's only run when at the first table box fragment.

Secondly, we were bypassing some code that was needed to detect that we
need to RelayoutAsLastTableBox() at this point. Fix that as well. We
could perhaps have set the is_known_to_be_last_table_box_ in
NGTableLayoutAlgorithm instead when in RelayoutWithoutFragmentation, but
fixing it this way instead seemed more robust, less convoluted, albeit a
bit more expensive, since we're performing an unnecessary layout pass at
the last table fragment (but that should really be no big deal).

Bug: 1410896
Change-Id: If63da5a7388bc7dbc70681195c079b9cbe03907e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4208191
Reviewed-by: Alison Maher <almaher@microsoft.com>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1099436}
diff --git a/css/css-break/table/repeated-section/repeated-section-in-clipped-overflow-001.tentative.html b/css/css-break/table/repeated-section/repeated-section-in-clipped-overflow-001.tentative.html
new file mode 100644
index 0000000..96cd602
--- /dev/null
+++ b/css/css-break/table/repeated-section/repeated-section-in-clipped-overflow-001.tentative.html
@@ -0,0 +1,15 @@
+<!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=1410896">
+<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="height:400px; overflow:clip;">
+    <div style="display:table; width:100%;">
+      <div style="display:table-header-group; break-inside:avoid;">
+        <div style="height:25px; background:green;"></div>
+      </div>
+      <div style="height:500px; background:green;"></div>
+    </div>
+  </div>
+</div>
diff --git a/css/css-break/table/repeated-section/repeated-section-in-clipped-overflow-002.tentative.html b/css/css-break/table/repeated-section/repeated-section-in-clipped-overflow-002.tentative.html
new file mode 100644
index 0000000..b55d8a3
--- /dev/null
+++ b/css/css-break/table/repeated-section/repeated-section-in-clipped-overflow-002.tentative.html
@@ -0,0 +1,15 @@
+<!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=1410896">
+<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="height:400px; overflow:clip;">
+    <div style="display:table; width:100%;">
+      <div style="height:500px; background:green;"></div>
+      <div style="display:table-footer-group; break-inside:avoid;">
+        <div style="height:25px; background:green;"></div>
+      </div>
+    </div>
+  </div>
+</div>
diff --git a/css/css-break/table/repeated-section/repeated-section-in-clipped-overflow-003.tentative.html b/css/css-break/table/repeated-section/repeated-section-in-clipped-overflow-003.tentative.html
new file mode 100644
index 0000000..794a596
--- /dev/null
+++ b/css/css-break/table/repeated-section/repeated-section-in-clipped-overflow-003.tentative.html
@@ -0,0 +1,18 @@
+<!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=1410896">
+<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="height:400px; overflow:clip;">
+    <div style="display:table; width:100%;">
+      <div style="display:table-header-group; break-inside:avoid;">
+        <div style="height:25px; background:green;"></div>
+      </div>
+      <div style="height:500px; background:green;"></div>
+      <div style="display:table-footer-group; break-inside:avoid;">
+        <div style="height:25px; background:green;"></div>
+      </div>
+    </div>
+  </div>
+</div>