[LayoutNG] Fix stability issues with NGBlockLayoutAlgorithm.

...we had all the right concepts, but we're holding them the wrong way.

This patch does a few inter-related things to ensure we don't have
different parts of the block layout algorithm fighting each other.

Previously we could end up in a state where a child believed it should
be placed at a particular BFC-block-offset, and the parent disagreeing
with that. This caused us to perform three layouts, and fail the
DCHECK_EQ(layout_result->Status(), kSuccess) check.
(if we did the layouts in a loop, this would otherwise result in a
 timeout).

This introduces/changes:
 - NGLayoutResult::IsEmptyBlock This flag is determined at the very
   end of the layout algorithm. If we didn't resolve our BFC
   block-offset, or were an empty-inline line-box we get this flag.
   This flag is more stable than checking if the
   NGLayoutResult::BlockBfcOffset had a value as this would sometimes
   be present for empty-blocks.
 - Changes the NGConstraintSpace::FloatsBfcBlockOffset to
   NGConstraintSpace::ForcedBfcBlockOffset. This is used in *almost*
   an identical way, except that:
   - Empty-blocks will always set their position to this.
   - Non-empty-blocks will typically also set their position to this
     (unless shifted by clearance).
 - AdjoiningFloatsTypes are now "passed" parent->child->sibling much
   like exclusion spaces are. Only at the end of an algorithm do we
   determine if they should be "passed" up to a parent based on if it
   is an empty block or not.
   This helps in determining clearance past adjoining floats.
 - Determining the BFC-block-offset when a child has aborted now has a
   more complex check to determine if the current layout should be
   considered as "clearing" floats also.
 - Removes the "forced-clearance" flag, in favour of the "forced" BFC
   block-offset, and adds the "ancestor has clearance past adjoining
   floats" flag.

Bug: 962344, 962300
Change-Id: Ife4030847f2e2b97aa5726072fadf581696ab8e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1611111
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Emil A Eklund <eae@chromium.org>
Reviewed-by: Morten Stenshorne <mstensho@chromium.org>
Reviewed-by: Emil A Eklund <eae@chromium.org>
Reviewed-by: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#661462}
14 files changed