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

Propagate space shortage to outer multicol container.

If we're doing nested column balancing (a column-fill:balance multicol
container with another column-fill:balance multicol container
descendant), we may need to stretch the outer multicol container to make
the inner one fit. Just propagate the space shortage detected while
laying out the inner column row, so that the outer multicol container
can use this to stretch itself.

Bug: 829028
Change-Id: I0b45d6f5d02f0f597f2d2de3442e728eb2abbb7b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2574754Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#834581}
parent 56ccb3e7
......@@ -642,10 +642,6 @@ scoped_refptr<const NGLayoutResult> NGColumnLayoutAlgorithm::LayoutRow(
allow_discard_start_margin = true;
} while (column_break_token);
// TODO(mstensho): Nested column balancing.
if (container_builder_.DidBreakSelf())
break;
if (!balance_columns) {
if (result->ColumnSpanner()) {
// We always have to balance columns preceding a spanner, so if we
......@@ -688,23 +684,22 @@ scoped_refptr<const NGLayoutResult> NGColumnLayoutAlgorithm::LayoutRow(
if (actual_column_count <= forced_break_count + 1)
break;
// TODO(mstensho): Handle this situation also when we're inside another
// balanced multicol container, rather than bailing (which we do now, to
// avoid infinite loops). If we exhaust the inner column-count in such
// cases, that piece of information may have to be propagated to the outer
// multicol, and instead stretch there (not here). We have no such mechanism
// in place yet.
if (ConstraintSpace().IsInsideBalancedColumns())
break;
LayoutUnit new_column_block_size =
StretchColumnBlockSize(minimal_space_shortage, column_size.block_size);
// Give up if we cannot get taller columns. The multicol container may have
// a specified block-size preventing taller columns, for instance.
DCHECK_GE(new_column_block_size, column_size.block_size);
if (new_column_block_size <= column_size.block_size)
if (new_column_block_size <= column_size.block_size) {
if (ConstraintSpace().IsInsideBalancedColumns()) {
// If we're doing nested column balancing, propagate any space shortage
// to the outer multicol container, so that the outer multicol container
// can attempt to stretch, so that this inner one may fit as well.
if (!container_builder_.IsInitialColumnBalancingPass())
container_builder_.PropagateSpaceShortage(minimal_space_shortage);
}
break;
}
// Remove column fragments and re-attempt layout with taller columns.
new_columns.clear();
......
......@@ -1038,11 +1038,6 @@ crbug.com/829028 virtual/layout_ng_block_frag/external/wpt/css/css-multicol/mult
crbug.com/829028 virtual/layout_ng_block_frag/external/wpt/css/css-multicol/multicol-inherit-002.xht [ Failure ]
crbug.com/829028 virtual/layout_ng_block_frag/external/wpt/css/css-multicol/multicol-nested-002.xht [ Failure ]
crbug.com/829028 virtual/layout_ng_block_frag/external/wpt/css/css-multicol/multicol-nested-005.xht [ Failure ]
crbug.com/829028 virtual/layout_ng_block_frag/external/wpt/css/css-multicol/multicol-nested-column-rule-001.xht [ Failure ]
crbug.com/829028 virtual/layout_ng_block_frag/external/wpt/css/css-multicol/multicol-nested-margin-002.xht [ Failure ]
crbug.com/829028 virtual/layout_ng_block_frag/external/wpt/css/css-multicol/multicol-nested-margin-003.xht [ Failure ]
crbug.com/829028 virtual/layout_ng_block_frag/external/wpt/css/css-multicol/multicol-nested-margin-004.xht [ Failure ]
crbug.com/829028 virtual/layout_ng_block_frag/external/wpt/css/css-multicol/multicol-nested-margin-005.xht [ Failure ]
crbug.com/1066616 virtual/layout_ng_block_frag/external/wpt/css/css-multicol/multicol-overflow-clip-positioned.html [ Failure ]
crbug.com/1066616 virtual/layout_ng_block_frag/external/wpt/css/css-multicol/multicol-overflow-clip.html [ Failure ]
crbug.com/1079031 virtual/layout_ng_block_frag/external/wpt/css/css-multicol/multicol-rule-002.xht [ Crash Failure Timeout ]
......@@ -1085,7 +1080,6 @@ crbug.com/829028 virtual/layout_ng_block_frag/fast/multicol/nested-auto-height-s
crbug.com/829028 virtual/layout_ng_block_frag/fast/multicol/nested-balanced-inner-column-count-1-with-forced-break.html [ Failure ]
crbug.com/829028 virtual/layout_ng_block_frag/fast/multicol/nested-short-first-row-extra-tall-line.html [ Failure ]
crbug.com/829028 virtual/layout_ng_block_frag/fast/multicol/nested-short-first-row-unsplittable-block.html [ Failure ]
crbug.com/829028 virtual/layout_ng_block_frag/fast/multicol/nested-uneven-inner-column-height.html [ Failure ]
crbug.com/829028 virtual/layout_ng_block_frag/fast/multicol/nested-very-tall-inside-short-crash.html [ Skip ]
crbug.com/1058792 virtual/layout_ng_block_frag/fast/multicol/nested-with-composited-and-multicol-crash.html [ Crash ]
crbug.com/1131125 virtual/layout_ng_block_frag/fast/multicol/nested-with-forced-breaks-in-eariler-rows.html [ Failure ]
......
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