Commit 26ced6f3 authored by Morten Stenshorne's avatar Morten Stenshorne Committed by Commit Bot

[LayoutNG] Don't fragment monolithic content.

fragmentation/auto-overflow.html now starts to fail, but that test is
invalid, so removing it. A block with overflow:auto is potentially
scrollable, and treating it as monolithic therefore makes sense. All
other browsers do this as well. Note that we did actually "always" treat
it as monolithic, as far as LayoutBox::GetPaginationBreakability() was
concerned, but since our legacy engine doesn't really understand
fragmentation, we ended up slicing it, making the test pass. LayoutNG
will now let such tall objects overflow the column instead, which
wouldn't match the expectation.

Bug: 829028
Change-Id: Id2ca5488049ef8e768a363e4dbe8767c7bc4d645
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2062351Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742541}
parent 89f1df98
...@@ -2420,8 +2420,8 @@ NGConstraintSpace NGBlockLayoutAlgorithm::CreateConstraintSpaceForChild( ...@@ -2420,8 +2420,8 @@ NGConstraintSpace NGBlockLayoutAlgorithm::CreateConstraintSpaceForChild(
// fragmentation line. // fragmentation line.
if (is_new_fc) if (is_new_fc)
fragmentainer_offset_delta = *child_bfc_block_offset; fragmentainer_offset_delta = *child_bfc_block_offset;
SetupFragmentation(ConstraintSpace(), fragmentainer_offset_delta, &builder, SetupFragmentation(ConstraintSpace(), child, fragmentainer_offset_delta,
is_new_fc); &builder, is_new_fc);
builder.SetEarlyBreakAppeal(container_builder_.BreakAppeal()); builder.SetEarlyBreakAppeal(container_builder_.BreakAppeal());
} }
......
...@@ -659,7 +659,8 @@ NGBreakStatus NGColumnLayoutAlgorithm::LayoutSpanner( ...@@ -659,7 +659,8 @@ NGBreakStatus NGColumnLayoutAlgorithm::LayoutSpanner(
margin_strut->Append(margins.block_start, /* is_quirky */ false); margin_strut->Append(margins.block_start, /* is_quirky */ false);
LayoutUnit block_offset = intrinsic_block_size_ + margin_strut->Sum(); LayoutUnit block_offset = intrinsic_block_size_ + margin_strut->Sum();
auto spanner_space = CreateConstraintSpaceForSpanner(block_offset); auto spanner_space =
CreateConstraintSpaceForSpanner(spanner_node, block_offset);
const NGEarlyBreak* early_break_in_child = nullptr; const NGEarlyBreak* early_break_in_child = nullptr;
if (early_break_ && early_break_->Type() == NGEarlyBreak::kBlock && if (early_break_ && early_break_->Type() == NGEarlyBreak::kBlock &&
...@@ -987,6 +988,7 @@ NGConstraintSpace NGColumnLayoutAlgorithm::CreateConstraintSpaceForBalancing( ...@@ -987,6 +988,7 @@ NGConstraintSpace NGColumnLayoutAlgorithm::CreateConstraintSpaceForBalancing(
} }
NGConstraintSpace NGColumnLayoutAlgorithm::CreateConstraintSpaceForSpanner( NGConstraintSpace NGColumnLayoutAlgorithm::CreateConstraintSpaceForSpanner(
const NGBlockNode& spanner,
LayoutUnit block_offset) const { LayoutUnit block_offset) const {
NGConstraintSpaceBuilder space_builder( NGConstraintSpaceBuilder space_builder(
ConstraintSpace(), Style().GetWritingMode(), /* is_new_fc */ true); ConstraintSpace(), Style().GetWritingMode(), /* is_new_fc */ true);
...@@ -994,7 +996,7 @@ NGConstraintSpace NGColumnLayoutAlgorithm::CreateConstraintSpaceForSpanner( ...@@ -994,7 +996,7 @@ NGConstraintSpace NGColumnLayoutAlgorithm::CreateConstraintSpaceForSpanner(
space_builder.SetPercentageResolutionSize(content_box_size_); space_builder.SetPercentageResolutionSize(content_box_size_);
if (ConstraintSpace().HasBlockFragmentation()) { if (ConstraintSpace().HasBlockFragmentation()) {
SetupFragmentation(ConstraintSpace(), block_offset, &space_builder, SetupFragmentation(ConstraintSpace(), spanner, block_offset, &space_builder,
/* is_new_fc */ true); /* is_new_fc */ true);
} }
......
...@@ -91,6 +91,7 @@ class CORE_EXPORT NGColumnLayoutAlgorithm ...@@ -91,6 +91,7 @@ class CORE_EXPORT NGColumnLayoutAlgorithm
NGConstraintSpace CreateConstraintSpaceForBalancing( NGConstraintSpace CreateConstraintSpaceForBalancing(
const LogicalSize& column_size) const; const LogicalSize& column_size) const;
NGConstraintSpace CreateConstraintSpaceForSpanner( NGConstraintSpace CreateConstraintSpaceForSpanner(
const NGBlockNode& spanner,
LayoutUnit block_offset) const; LayoutUnit block_offset) const;
NGConstraintSpace CreateConstraintSpaceForMinMax() const; NGConstraintSpace CreateConstraintSpaceForMinMax() const;
......
...@@ -72,8 +72,8 @@ NGConstraintSpace CreateConstraintSpaceForFloat( ...@@ -72,8 +72,8 @@ NGConstraintSpace CreateConstraintSpaceForFloat(
DCHECK(parent_space.HasBlockFragmentation()); DCHECK(parent_space.HasBlockFragmentation());
DCHECK_EQ(style.GetWritingMode(), parent_space.GetWritingMode()); DCHECK_EQ(style.GetWritingMode(), parent_space.GetWritingMode());
SetupFragmentation(parent_space, *origin_block_offset, &builder, SetupFragmentation(parent_space, unpositioned_float.node,
/* is_new_fc */ true); *origin_block_offset, &builder, /* is_new_fc */ true);
} else { } else {
builder.SetFragmentationType(NGFragmentationType::kFragmentNone); builder.SetFragmentationType(NGFragmentationType::kFragmentNone);
} }
......
...@@ -164,11 +164,20 @@ NGBreakAppeal CalculateBreakAppealInside(const NGConstraintSpace& space, ...@@ -164,11 +164,20 @@ NGBreakAppeal CalculateBreakAppealInside(const NGConstraintSpace& space,
} }
void SetupFragmentation(const NGConstraintSpace& parent_space, void SetupFragmentation(const NGConstraintSpace& parent_space,
const NGLayoutInputNode& child,
LayoutUnit fragmentainer_offset_delta, LayoutUnit fragmentainer_offset_delta,
NGConstraintSpaceBuilder* builder, NGConstraintSpaceBuilder* builder,
bool is_new_fc) { bool is_new_fc) {
DCHECK(parent_space.HasBlockFragmentation()); DCHECK(parent_space.HasBlockFragmentation());
// If the child is truly unbreakable, it won't participate in block
// fragmentation. If it's too tall to fit, it will either overflow the
// fragmentainer or get brutally sliced into pieces (without looking for
// allowed breakpoints, since there are none, by definition), depending on
// fragmentation type (multicol vs. printing).
if (child.IsMonolithic())
return;
builder->SetFragmentainerBlockSize(parent_space.FragmentainerBlockSize()); builder->SetFragmentainerBlockSize(parent_space.FragmentainerBlockSize());
builder->SetFragmentainerOffsetAtBfc(parent_space.FragmentainerOffsetAtBfc() + builder->SetFragmentainerOffsetAtBfc(parent_space.FragmentainerOffsetAtBfc() +
fragmentainer_offset_delta); fragmentainer_offset_delta);
......
...@@ -93,6 +93,7 @@ inline void AdjustForFragmentation(const NGBlockBreakToken* break_token, ...@@ -93,6 +93,7 @@ inline void AdjustForFragmentation(const NGBlockBreakToken* break_token,
// formatting context starts in a previous fragmentainer; the offset from the // formatting context starts in a previous fragmentainer; the offset from the
// current fragmentainer block-start. // current fragmentainer block-start.
void SetupFragmentation(const NGConstraintSpace& parent_space, void SetupFragmentation(const NGConstraintSpace& parent_space,
const NGLayoutInputNode& child,
LayoutUnit fragmentainer_offset_delta, LayoutUnit fragmentainer_offset_delta,
NGConstraintSpaceBuilder*, NGConstraintSpaceBuilder*,
bool is_new_fc); bool is_new_fc);
......
...@@ -1144,7 +1144,6 @@ crbug.com/994172 virtual/layout_ng_block_frag/fast/multicol/balance-line-underfl ...@@ -1144,7 +1144,6 @@ crbug.com/994172 virtual/layout_ng_block_frag/fast/multicol/balance-line-underfl
crbug.com/994172 virtual/layout_ng_block_frag/fast/multicol/balance-line-underflow-2.html [ Pass Crash ] crbug.com/994172 virtual/layout_ng_block_frag/fast/multicol/balance-line-underflow-2.html [ Pass Crash ]
crbug.com/591099 virtual/layout_ng_block_frag/fast/multicol/basic-rtl.html [ Failure ] crbug.com/591099 virtual/layout_ng_block_frag/fast/multicol/basic-rtl.html [ Failure ]
crbug.com/591099 virtual/layout_ng_block_frag/fast/multicol/break-before-first-line-in-first-child.html [ Failure ] crbug.com/591099 virtual/layout_ng_block_frag/fast/multicol/break-before-first-line-in-first-child.html [ Failure ]
crbug.com/591099 virtual/layout_ng_block_frag/fast/multicol/break-in-scrollable.html [ Failure ]
crbug.com/591099 virtual/layout_ng_block_frag/fast/multicol/caret-range-anonymous-block.html [ Failure ] crbug.com/591099 virtual/layout_ng_block_frag/fast/multicol/caret-range-anonymous-block.html [ Failure ]
crbug.com/591099 virtual/layout_ng_block_frag/fast/multicol/caret-range-anonymous-block-rtl.html [ Failure ] crbug.com/591099 virtual/layout_ng_block_frag/fast/multicol/caret-range-anonymous-block-rtl.html [ Failure ]
crbug.com/591099 virtual/layout_ng_block_frag/fast/multicol/caret-range-outside-columns.html [ Failure ] crbug.com/591099 virtual/layout_ng_block_frag/fast/multicol/caret-range-outside-columns.html [ Failure ]
......
<!DOCTYPE html>
<p>There should be a hotpink square below.</p>
<div style="width:50px; height:50px; background:hotpink;"></div>
<!DOCTYPE html>
<p>There should be a hotpink square below.</p>
<div id="multicol" style="columns:3; column-fill:auto; column-gap:0; height:50px;">
<div style="overflow:auto; height:100px; background:hotpink;"></div>
</div>
<script>
document.body.offsetTop;
document.getElementById("multicol").style.width = "75px";
</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