Avoid invalid class C break when a first inflow child fits beside float.

If a container was cleared by a preceding float, and said container has
a float and a BFC root child, and the BFC root fits beside the float,
we'd incorrectly detect container separation before the BFC root, even
though there was no gap between it and its container.

We don't really need to let child_margin_got_separated be part of the
container separation check, since we're already comparing block-offsets.
That said, the whole child_margin_got_separated thing is a bit sketchy,
in that there may be false positives. Added a TODO.

Note that, among the tests included, only the -004 one would fail
without this fix. The two others are just regression tests, to make sure
that we still detect valid class C breakpoints in very similar
situations.

Bug: 1368518
Change-Id: I78ff2f5081e4a6878d4556ddbd859286da12e7d3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3921636
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1053246}
diff --git a/css/css-break/class-c-breakpoint-after-float-002.html b/css/css-break/class-c-breakpoint-after-float-002.html
new file mode 100644
index 0000000..110b4e7
--- /dev/null
+++ b/css/css-break/class-c-breakpoint-after-float-002.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
+<link rel="help" href="https://www.w3.org/TR/css-break-3/#possible-breaks">
+<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
+<meta name="assert" content="There should be a class C breakpoint after the float, since the flow-root sibling is cleared past the float (but note that it would otherwise fit beside it), so that there'll be a gap to establish a class C break opportunity">
+<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="width:200%;">
+    <div style="width:50%; height:50px; background:green;"></div>
+    <div style="float:left; width:50%; height:40px; background:green;"></div>
+    <div style="clear:both; width:50%; background:green;">
+      <div style="float:left; width:10px; height:10px;"></div>
+      <div style="clear:both; display:flow-root; break-inside:avoid; height:100px;"></div>
+    </div>
+  </div>
+</div>
diff --git a/css/css-break/class-c-breakpoint-after-float-003.html b/css/css-break/class-c-breakpoint-after-float-003.html
new file mode 100644
index 0000000..0923e1a
--- /dev/null
+++ b/css/css-break/class-c-breakpoint-after-float-003.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
+<link rel="help" href="https://www.w3.org/TR/css-break-3/#possible-breaks">
+<meta name="assert" content="There should be a class C breakpoint after the float, since the flow-root sibling doesn't fit beside the float, so that there'll be a gap to establish a class C break opportunity">
+<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="width:200%;">
+    <div style="width:50%; height:50px; background:green;"></div>
+    <div style="float:left; width:50%; height:40px; background:green;"></div>
+    <div style="clear:both; width:50%; background:green;">
+      <div style="float:left; width:100%; height:5px;"></div>
+      <div style="display:flow-root; break-inside:avoid; width:50px; height:100px;"></div>
+    </div>
+  </div>
+</div>
diff --git a/css/css-break/class-c-breakpoint-after-float-004.html b/css/css-break/class-c-breakpoint-after-float-004.html
new file mode 100644
index 0000000..30cdc56
--- /dev/null
+++ b/css/css-break/class-c-breakpoint-after-float-004.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
+<link rel="help" href="https://www.w3.org/TR/css-break-3/#possible-breaks">
+<meta name="assert" content="Note that this test tests that there'll be *no* class C breakpoint after the float, since the flow-root sibling can fit beside the float, so that there'll be no gap to establish a class C break opportunity">
+<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:green;">
+  <div style="width:200%;">
+    <div style="width:50%; height:50px;"></div>
+    <div style="float:left; width:50%; height:40px;"></div>
+    <div style="clear:both; width:50%; background:red;">
+      <div style="float:left; width:10px; height:100px; background:green;"></div>
+      <div style="display:flow-root; break-inside:avoid; width:40px; height:100px; background:green;"></div>
+    </div>
+  </div>
+</div>