Commit 171133bf authored by Ian Kilpatrick's avatar Ian Kilpatrick Committed by Commit Bot

[LayoutNG] Allow clearance as a valid value in the new-fc DCHECK.

Patch:
https://chromium-review.googlesource.com/c/chromium/src/+/1692627

Made us consider inline-level OOF-positioned nodes as adjoining, as
their static-position depends on where other floats are placed.

During the first pass the BFC block-offset gets resolved here:
https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc?l=986&rcl=e6157bb7afb778d5c15bb2bb09a457d9632151da

This aborts as it has an adjoining inline-OOF, and *doesn't* resolve
the BFC block-offset at |child_bfc_offset_estimate| instead applying
clearance.

Upon the second pass we now hit the DCHECK as neither of the options
has clearance applied.

Bug: 987004
Change-Id: I2634d56726a4664c869b2ecfa1e7a8a13458e78f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1731917
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#684426}
parent 03efa572
......@@ -983,10 +983,12 @@ bool NGBlockLayoutAlgorithm::HandleNewFormattingContext(
// block offset.
bfc_offset_already_resolved = true;
child_bfc_offset_estimate = *ConstraintSpace().ForcedBfcBlockOffset();
// We require that the BFC block offset be the one we'd get with either
// margins adjoining or margins separated. Anything else is a bug.
// We require that the BFC block offset be the one we'd get with margins
// adjoining, margins separated, or if clearance was applied to either of
// these. Anything else is a bug.
DCHECK(child_bfc_offset_estimate == adjoining_bfc_offset_estimate ||
child_bfc_offset_estimate == non_adjoining_bfc_offset_estimate);
child_bfc_offset_estimate == non_adjoining_bfc_offset_estimate ||
child_bfc_offset_estimate == ConstraintSpace().ClearanceOffset());
// Figure out if the child margin has already got separated from the
// margin strut or not.
child_margin_got_separated =
......
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=987004">
<meta name="assert" content="The renderer should not crash.">
<div style="width: 100px; overflow: hidden;">
<div style="float: left; width: 100%; height: 20px; background: hotpink;"></div>
<div style="clear: both;">
<span style="position: absolute; width: 10px; height: 10px; background: orange;"></span>
<div style="height: 10px; background: green; overflow: hidden;"></div>
</div>
</div>
<script>
test(() => {
}, 'Test passes if the renderer does not crash.');
</script>
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