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

[LayoutNG] Only stretch consumed block-size when overflowing.

The main motivation behind this change is to get the code out of the way
when interrupted by spanners. In such cases there may be space left in
the fragmentainer when finishing the fragment before the spanner (i.e.
the last piece of column content before the spanner), but this should
neither be part of the fragment nor consumed block-size.

We used to include the remaining space of the column interrupted by a
spanner in consumed block-size, so that a node with fixed block-size
would have this subtracted when generating fragments after the spanner
(causing us to use less space on the node than we should).

Bug: 829028
Change-Id: I7990532474b45ef20900455da75b8337d08c62fc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2532467Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarAlison Maher <almaher@microsoft.com>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826889}
parent 5d4f87d1
......@@ -353,6 +353,7 @@ class CORE_EXPORT NGBoxFragmentBuilder final
bool HasSeenAllChildren() { return has_seen_all_children_; }
void SetIsAtBlockEnd() { is_at_block_end_ = true; }
bool IsAtBlockEnd() const { return is_at_block_end_; }
void SetColumnSpanner(NGBlockNode spanner) { column_spanner_ = spanner; }
bool FoundColumnSpanner() const { return !!column_spanner_; }
......
......@@ -329,18 +329,8 @@ bool FinishFragmentation(NGBlockNode node,
sides.block_end = false;
builder->SetSidesToInclude(sides);
LayoutUnit consumed_here = final_block_size;
if (builder->DidBreakSelf() || builder->HasChildBreakInside()) {
// If this node is to be resumed in the next fragmentainer, consumed
// block-size always includes the entire remainder of the fragmentainer. The
// frament itself will only do that unless we've reached the end of the node
// (and we are breaking because of overflow). We include the entire
// fragmentainer in consumed block-size in order to write offsets correctly
// back to legacy layout, which would otherwise become incorrect for
// overflowing content.
consumed_here = std::max(consumed_here, space_left);
}
builder->SetConsumedBlockSize(previously_consumed_block_size + consumed_here);
builder->SetConsumedBlockSize(previously_consumed_block_size +
final_block_size);
builder->SetFragmentBlockSize(final_block_size);
if (builder->FoundColumnSpanner())
......@@ -403,6 +393,18 @@ bool FinishFragmentation(NGBlockNode node,
if (!builder->HasInflowChildBreakInside())
builder->SetBreakAppeal(kBreakAppealPerfect);
}
if (builder->IsAtBlockEnd()) {
// This node is to be resumed in the next fragmentainer. Make sure that
// consumed block-size includes the entire remainder of the fragmentainer.
// The fragment will normally take up all that space, but not if we've
// reached the end of the node (and we are breaking because of
// overflow). We include the entire fragmentainer in consumed block-size
// in order to write offsets correctly back to legacy layout.
builder->SetConsumedBlockSize(previously_consumed_block_size +
std::max(final_block_size, space_left));
}
return true;
}
......
......@@ -1124,7 +1124,6 @@ crbug.com/829028 virtual/layout_ng_block_frag/fast/multicol/overflowing-columns-
crbug.com/1079031 virtual/layout_ng_block_frag/fast/multicol/positioned-outside-of-columns.html [ Crash Failure ]
crbug.com/1079031 virtual/layout_ng_block_frag/fast/multicol/positioned-split.html [ Failure ]
crbug.com/1079031 virtual/layout_ng_block_frag/fast/multicol/span/abspos-containing-block-outside-spanner.html [ Crash Failure Timeout ]
crbug.com/829028 virtual/layout_ng_block_frag/fast/multicol/span/inside-block-with-fixed-height.html [ Failure ]
crbug.com/1058792 virtual/layout_ng_block_frag/fast/multicol/span/invalid-spanner-in-transform.html [ Failure Crash ]
crbug.com/829028 virtual/layout_ng_block_frag/fast/multicol/span/outer-column-break-after-inner-spanner-2.html [ Failure ]
crbug.com/829028 virtual/layout_ng_block_frag/fast/multicol/span/outer-column-break-after-inner-spanner-and-float.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