Commit 7b0354ee authored by Morten Stenshorne's avatar Morten Stenshorne Committed by Commit Bot

[LayoutNG] Handle unset column balancing results correctly.

Handle situations where nobody propagates "tallest unbreakable or
"minimal space shortage" to a fragment builder. This happens for
childless and/or monolithic content.

Simplify the DCHECKing for this mechanism, and make it return the
correct values, if nobody has set them.

We used to fail a DCHECK in TallestUnbreakableBlockSize() (called from
NGBoxFragmentBuilder::PropagateBreak()), and we would also return the
incorrect tallest_unbreakable_block_size if it was unset (it was
initialized to LayoutUnit::Max()).

Bug: 829028
Change-Id: Icaf3da7ad3b61b2a317f39dbc470a2512f9f992e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2404581
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#806210}
parent 4add132e
......@@ -76,14 +76,11 @@ NGLayoutResult::NGLayoutResult(
if (builder->tallest_unbreakable_block_size_ >= LayoutUnit()) {
rare_data->tallest_unbreakable_block_size =
builder->tallest_unbreakable_block_size_;
#if DCHECK_IS_ON()
rare_data->has_tallest_unbreakable_block_size = true;
#endif
}
if (builder->minimal_space_shortage_ != LayoutUnit::Max()) {
#if DCHECK_IS_ON()
DCHECK(!rare_data->has_tallest_unbreakable_block_size);
#endif
// This field shares storage with "minimal space shortage", so both
// cannot be set at the same time.
DCHECK_EQ(builder->minimal_space_shortage_, LayoutUnit::Max());
} else if (builder->minimal_space_shortage_ != LayoutUnit::Max()) {
rare_data->minimal_space_shortage = builder->minimal_space_shortage_;
}
......
......@@ -185,22 +185,15 @@ class CORE_EXPORT NGLayoutResult : public RefCounted<NGLayoutResult> {
}
LayoutUnit MinimalSpaceShortage() const {
if (!HasRareData())
if (!HasRareData() || rare_data_->minimal_space_shortage == kIndefiniteSize)
return LayoutUnit::Max();
#if DCHECK_IS_ON()
// This field shares storage with another field.
DCHECK(!rare_data_->has_tallest_unbreakable_block_size);
#endif
return rare_data_->minimal_space_shortage;
}
LayoutUnit TallestUnbreakableBlockSize() const {
if (!HasRareData())
if (!HasRareData() ||
rare_data_->tallest_unbreakable_block_size == kIndefiniteSize)
return LayoutUnit();
#if DCHECK_IS_ON()
// This field shares storage with another field.
DCHECK(rare_data_->has_tallest_unbreakable_block_size);
#endif
return rare_data_->tallest_unbreakable_block_size;
}
......@@ -400,7 +393,7 @@ class CORE_EXPORT NGLayoutResult : public RefCounted<NGLayoutResult> {
// couldn't fit all the content, and we're allowed to stretch columns
// further, we'll perform another pass with the column block-size
// increased by this amount.
LayoutUnit minimal_space_shortage = LayoutUnit::Max();
LayoutUnit minimal_space_shortage = kIndefiniteSize;
};
NGExclusionSpace exclusion_space;
scoped_refptr<SerializedScriptValue> custom_layout_data;
......@@ -408,10 +401,6 @@ class CORE_EXPORT NGLayoutResult : public RefCounted<NGLayoutResult> {
LayoutUnit overflow_block_size = kIndefiniteSize;
LayoutUnit annotation_overflow;
LayoutUnit block_end_annotation_space;
#if DCHECK_IS_ON()
bool has_tallest_unbreakable_block_size = false;
#endif
bool is_single_use = false;
int lines_until_clamp = 0;
wtf_size_t table_column_count_ = 0;
......
......@@ -1014,8 +1014,6 @@ crbug.com/829028 virtual/layout_ng_block_frag/external/wpt/css/css-break/fieldse
crbug.com/1066380 virtual/layout_ng_block_frag/external/wpt/css/css-break/widows-orphans-002.html [ Failure ]
crbug.com/1066380 virtual/layout_ng_block_frag/external/wpt/css/css-break/widows-orphans-004.html [ Failure ]
crbug.com/829028 virtual/layout_ng_block_frag/external/wpt/css/css-break/widows-orphans-005.html [ Failure ]
crbug.com/829028 virtual/layout_ng_block_frag/external/wpt/css/css-contain/contain-size-breaks-001.html [ Crash Failure ]
crbug.com/829028 virtual/layout_ng_block_frag/external/wpt/css/css-contain/contain-size-monolithic-001.html [ Crash Failure ]
crbug.com/829028 virtual/layout_ng_block_frag/external/wpt/css/css-contain/contain-size-multicol-001.html [ Failure ]
crbug.com/1079031 virtual/layout_ng_block_frag/external/wpt/css/css-multicol/change-out-of-flow-type-and-remove-inner-multicol-crash.html [ Crash Failure ]
crbug.com/1058792 virtual/layout_ng_block_frag/external/wpt/css/css-multicol/composited-under-clip-under-multicol.html [ Failure Crash ]
......
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