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

[LayoutNG] Don't break before empty block at fragmentainer boundary.

A block that has zero block-size fits within zero space, so if we have
exactly zero space left in a fragmentainer, the block shouldn't be
pushed to the next fragmentainer.

Discovered this while working on column-rule support;
fast/multicol/span/triply-nested-multiocol-zero-height-inner-with-spanner.html
started to fail, because we had one column more than expected.

fast/multicol/transform-inside-opacity.html will regress with this
change, because we're really bad at fragmenting floats, and now the poor
float ended up exactly at the end of the first column (instead of
(incorrectly but oh so helpfully) being pushed to the beginning of the
next by its parent).

Bug: 829028
Change-Id: I66d44699c44cf7e7371f196babd424a971bfd65d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1899769
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#712609}
parent cbac001c
......@@ -184,6 +184,38 @@ TEST_F(NGColumnLayoutAlgorithmTest, BlockInOneColumn) {
EXPECT_FALSE(iterator.NextChild());
}
TEST_F(NGColumnLayoutAlgorithmTest, ZeroHeightBlockAtFragmentainerBoundary) {
SetBodyInnerHTML(R"HTML(
<style>
#parent {
columns: 2;
column-fill: auto;
column-gap: 10px;
height: 100px;
width: 210px;
}
</style>
<div id="container">
<div id="parent">
<div style="width:33px; height:200px;"></div>
<div style="width:44px;"></div>
</div>
</div>
)HTML");
String dump = DumpFragmentTree(GetElementById("container"));
String expectation = R"DUMP(.:: LayoutNG Physical Fragment Tree ::.
offset:unplaced size:1000x100
offset:0,0 size:210x100
offset:0,0 size:100x100
offset:0,0 size:33x100
offset:110,0 size:100x100
offset:0,0 size:33x100
offset:0,100 size:44x0
)DUMP";
EXPECT_EQ(expectation, dump);
}
TEST_F(NGColumnLayoutAlgorithmTest, BlockInTwoColumns) {
SetBodyInnerHTML(R"HTML(
<style>
......
......@@ -368,8 +368,10 @@ bool MovePastBreakpoint(const NGConstraintSpace& space,
// If the block-offset is past the fragmentainer boundary (or exactly at
// the boundary), no part of the fragment is going to fit in the current
// fragmentainer. Fragments may be pushed past the fragmentainer boundary
// by margins.
need_break = space_left <= LayoutUnit();
// by margins. We shouldn't break before a zero-size block that's exactly
// at a fragmentainer boundary, though.
need_break = space_left < LayoutUnit() ||
(space_left == LayoutUnit() && fragment.BlockSize());
}
if (need_break) {
// If we haven't used any space at all in the fragmentainer yet, though,
......
......@@ -1265,6 +1265,7 @@ crbug.com/591099 virtual/layout_ng_block_frag/fast/multicol/tall-content-in-inne
crbug.com/829028 virtual/layout_ng_block_frag/fast/multicol/tall-float1.html [ Failure ]
crbug.com/591099 virtual/layout_ng_block_frag/fast/multicol/tall-float2.html [ Failure ]
crbug.com/591099 virtual/layout_ng_block_frag/fast/multicol/three-inner-rows.html [ Failure ]
crbug.com/829028 virtual/layout_ng_block_frag/fast/multicol/transform-inside-opacity.html [ Failure ]
crbug.com/874506 virtual/layout_ng_block_frag/fast/multicol/unsplittable-inline-block.html [ Failure ]
crbug.com/591099 virtual/layout_ng_block_frag/fast/multicol/vertical-lr/abspos-auto-position-on-line.html [ Failure ]
crbug.com/591099 virtual/layout_ng_block_frag/fast/multicol/vertical-lr/break-properties.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