Once content is added to a builder, break as normally.

If the RequiresContentBeforeBreaking flag was set when initializing the
fragment builder, it was never set to false again. This was generally
unproblematic, since it only affected last-resort break opportunities,
which generally only occur at the beginning of a fragment (e.g. between
a container and its first child). However, in flex layout there may be a
last-resort break opportunity before any flex item that's flush with its
flex line, because that is seen as having no container separation.

Therefore, reset the RequiresContentBeforeBreaking flag once a child has
been added to the builder. That in itself is a simple fix, in
NGBoxFragmentBuilder::AddChild().

The rest of this CL is about keeping this mechanism working for
out-of-flow positioned elements. We now need to check the
RequiresContentBeforeBreaking state exactly when the out-of-flow
positioned element is found in the box tree, not when it's being laid
out. Doing it later, in NGOutOfFlowLayoutPart, is now too late, since
the flag may have been reset in the meantime, which would prevent us
from forcing OOFs to stay in the current fragmentainer when they should.
So store it directly in NGLogicalOutOfFlowPositionedNode when creating
it. Since these objects bubble up the parent chain as physical
fragments, NGPhysicalOutOfFlowPositionedNode also needs to store this.
Storing it in NGContainingBlock is no longer necessary, on the other
hand.

css/css-break/tall-content-inside-constrained-block-006.tentative.html
is a test for this.

Bug: 1500947
Change-Id: I3b60239b0bdac82477748b3e0a99daf074d7246d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5029777
Reviewed-by: Alison Maher <almaher@microsoft.com>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1224475}
diff --git a/css/css-break/flexbox/multi-line-row-flex-fragmentation-077.html b/css/css-break/flexbox/multi-line-row-flex-fragmentation-077.html
new file mode 100644
index 0000000..4a0b056
--- /dev/null
+++ b/css/css-break/flexbox/multi-line-row-flex-fragmentation-077.html
@@ -0,0 +1,31 @@
+<!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=1500947">
+<link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
+<style>
+  .flex {
+    display: flex;
+    flex-flow: row wrap;
+  }
+  .flex > div {
+    flex: 0 0 100%;
+    background: green;
+  }
+  .flex > div > div {
+    contain:size;
+    height: 50px;
+  }
+</style>
+<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+<div style="width:100px; height:100px; background:red;">
+  <div style="columns:2; gap:0; column-fill:auto; height:110px;">
+    <div style="height:10px;">
+      <div style="height:50px; background:green;"></div>
+      <div class="flex">
+        <div><div></div></div>
+        <div><div></div></div>
+        <div><div></div></div>
+      </div>
+    </div>
+  </div>
+</div>
diff --git a/css/css-break/flexbox/multi-line-row-flex-fragmentation-078.html b/css/css-break/flexbox/multi-line-row-flex-fragmentation-078.html
new file mode 100644
index 0000000..1427d57
--- /dev/null
+++ b/css/css-break/flexbox/multi-line-row-flex-fragmentation-078.html
@@ -0,0 +1,29 @@
+<!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=1500947">
+<link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
+<style>
+  .flex {
+    display: flex;
+    flex-flow: row wrap;
+  }
+  .flex > div {
+    flex: 0 0 100%;
+    contain: size;
+    height: 50px;
+    background: green;
+  }
+</style>
+<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+<div style="width:100px; height:100px; background:red;">
+  <div style="columns:2; gap:0; column-fill:auto; height:120px;">
+    <div style="height:10px;">
+      <div style="height:50px; contain:size; background:green;"></div>
+      <div class="flex">
+        <div></div>
+        <div></div>
+        <div></div>
+      </div>
+    </div>
+  </div>
+</div>
diff --git a/css/css-break/flexbox/multi-line-row-flex-fragmentation-079.html b/css/css-break/flexbox/multi-line-row-flex-fragmentation-079.html
new file mode 100644
index 0000000..57c094d
--- /dev/null
+++ b/css/css-break/flexbox/multi-line-row-flex-fragmentation-079.html
@@ -0,0 +1,29 @@
+<!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=1500947">
+<link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
+<style>
+  .flex {
+    display: flex;
+    flex-flow: row wrap;
+  }
+  .flex > div {
+    flex: 0 0 100%;
+    contain: size;
+    height: 50px;
+    background: green;
+  }
+</style>
+<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+<div style="width:100px; height:100px; background:red;">
+  <div style="columns:2; gap:0; column-fill:auto; height:120px;">
+    <div style="height:10px;">
+      <div class="flex">
+        <div></div>
+        <div></div>
+        <div></div>
+        <div></div>
+      </div>
+    </div>
+  </div>
+</div>