Commit dd942765 authored by Morten Stenshorne's avatar Morten Stenshorne Committed by Commit Bot

[LayoutNG] Remove PositionWithBfcOffset().

There's no need to position pending floats at this point, since there
should be none. Added a DCHECK. If a child knows its BFC offset, it has
no reason to leave behind pending floats.

Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_layout_ng
Change-Id: I288b0cbd0ce43e422eddfe331dc02a5ee3afd6a8
Reviewed-on: https://chromium-review.googlesource.com/1013486Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#551028}
parent a30912ab
......@@ -967,10 +967,13 @@ bool NGBlockLayoutAlgorithm::HandleInflow(
// We try and position the child within the block formatting context. This
// may cause our BFC offset to be resolved, in which case we should abort our
// layout if needed.
WTF::Optional<NGBfcOffset> child_bfc_offset;
if (layout_result->BfcOffset()) {
if (!PositionWithBfcOffset(layout_result->BfcOffset().value(),
&child_bfc_offset))
WTF::Optional<NGBfcOffset> child_bfc_offset = layout_result->BfcOffset();
if (child_bfc_offset) {
// A child with a known BFC offset shouldn't leave behind pending floats.
DCHECK(unpositioned_floats_.IsEmpty());
bool updated = MaybeUpdateFragmentBfcOffset(child_bfc_offset->block_offset);
if (updated && abort_when_bfc_resolved_)
return false;
} else {
// Layout wasn't able to determine the BFC offset of the child. This has to
......@@ -1190,21 +1193,6 @@ NGPreviousInflowPosition NGBlockLayoutAlgorithm::ComputeInflowPosition(
empty_or_sibling_empty_affected_by_clearance};
}
bool NGBlockLayoutAlgorithm::PositionWithBfcOffset(
const NGBfcOffset& bfc_offset,
WTF::Optional<NGBfcOffset>* child_bfc_offset) {
LayoutUnit bfc_block_offset = bfc_offset.block_offset;
bool updated = MaybeUpdateFragmentBfcOffset(bfc_block_offset);
if (updated && abort_when_bfc_resolved_)
return false;
PositionPendingFloats(bfc_block_offset);
*child_bfc_offset = bfc_offset;
return true;
}
NGBfcOffset NGBlockLayoutAlgorithm::PositionEmptyChildWithParentBfc(
const NGLayoutInputNode& child,
const NGConstraintSpace& child_space,
......
......@@ -81,10 +81,6 @@ class CORE_EXPORT NGBlockLayoutAlgorithm
const NGFragment& fragment,
bool empty_block_affected_by_clearance);
// Positions the fragment that knows its BFC offset.
bool PositionWithBfcOffset(const NGBfcOffset& bfc_offset,
WTF::Optional<NGBfcOffset>* child_bfc_offset);
// Position an empty child using the parent BFC offset.
// The fragment doesn't know its offset, but we can still calculate its BFC
// position because the parent fragment's BFC is known.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment