Commit c97db3d4 authored by Morten Stenshorne's avatar Morten Stenshorne Committed by Chromium LUCI CQ

Avoid indefinite column block-size in initial column balancing.

The block-size of the column fragment in the initial column balancing
pass isn't used for anything (at least currently), but setting it to
kIndefiniteSize is pretty bogus. Don't do that.

https://chromium-review.googlesource.com/c/chromium/src/+/2611570
is about to introduce DCHECKs for such situations.

Change-Id: Ib6c7342ecc2f29a9d4d29c64bbaee8e2bde1243f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2626431Reviewed-by: default avatarDavid Grogan <dgrogan@chromium.org>
Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843210}
parent 947a06d5
...@@ -2277,15 +2277,21 @@ bool NGBlockLayoutAlgorithm::FinalizeForFragmentation() { ...@@ -2277,15 +2277,21 @@ bool NGBlockLayoutAlgorithm::FinalizeForFragmentation() {
} }
if (container_builder_.IsFragmentainerBoxType()) { if (container_builder_.IsFragmentainerBoxType()) {
// We're building fragmentainers. Just copy the block-size from the // We're building fragmentainers. Unless we're in the initial column
// constraint space. Calculating the size the regular way would cause some // balancing pass (when fragmentainer block-size is unknown), just copy the
// problems with overflow. For one, we don't want to produce a break token // block-size from the constraint space. Calculating the size the regular
// if there's no child content that requires it. // way would cause some problems with overflow. For one, we don't want to
LayoutUnit consumed_block_size = // produce a break token if there's no child content that requires it. If we
BreakToken() ? BreakToken()->ConsumedBlockSize() : LayoutUnit(); // *are* in the initial column balancing pass, on the other hand, just skip
LayoutUnit block_size = ConstraintSpace().FragmentainerBlockSize(); // this part, and keep the fragment size calculated by the block layout
container_builder_.SetFragmentBlockSize(block_size); // algorithm (rather than setting it to indefinite).
container_builder_.SetConsumedBlockSize(consumed_block_size + block_size); if (ConstraintSpace().HasKnownFragmentainerBlockSize()) {
LayoutUnit consumed_block_size =
BreakToken() ? BreakToken()->ConsumedBlockSize() : LayoutUnit();
LayoutUnit block_size = ConstraintSpace().FragmentainerBlockSize();
container_builder_.SetFragmentBlockSize(block_size);
container_builder_.SetConsumedBlockSize(consumed_block_size + block_size);
}
return true; return true;
} }
......
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