Commit 091893f5 authored by Ian Kilpatrick's avatar Ian Kilpatrick Committed by Commit Bot

[TableNG] Fix simplified layout for table-cells.

Within NGSimplifiedLayoutAlgorithm we weren't copying across all the
necessary fields in order for it to work correctly. This change copies
these fields, and adds the necessary DCHECKs to ensure it is working
correctly.

Bug: 958381
Change-Id: I116fcff94adb7523841cf2d4ed1601fbb1fdcfd6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2503843
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarAleks Totic <atotic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821861}
parent a9d053b9
...@@ -797,6 +797,8 @@ void NGPhysicalBoxFragment::CheckSameForSimplifiedLayout( ...@@ -797,6 +797,8 @@ void NGPhysicalBoxFragment::CheckSameForSimplifiedLayout(
DCHECK_EQ(sub_type_, other.sub_type_); DCHECK_EQ(sub_type_, other.sub_type_);
DCHECK_EQ(style_variant_, other.style_variant_); DCHECK_EQ(style_variant_, other.style_variant_);
DCHECK_EQ(is_hidden_for_paint_, other.is_hidden_for_paint_); DCHECK_EQ(is_hidden_for_paint_, other.is_hidden_for_paint_);
DCHECK_EQ(is_math_fraction_, other.is_math_fraction_);
DCHECK_EQ(is_math_operator_, other.is_math_operator_);
// |has_floating_descendants_for_paint_| can change during simplified layout. // |has_floating_descendants_for_paint_| can change during simplified layout.
DCHECK_EQ(may_have_descendant_above_block_start_, DCHECK_EQ(may_have_descendant_above_block_start_,
...@@ -804,18 +806,17 @@ void NGPhysicalBoxFragment::CheckSameForSimplifiedLayout( ...@@ -804,18 +806,17 @@ void NGPhysicalBoxFragment::CheckSameForSimplifiedLayout(
DCHECK_EQ(depends_on_percentage_block_size_, DCHECK_EQ(depends_on_percentage_block_size_,
other.depends_on_percentage_block_size_); other.depends_on_percentage_block_size_);
DCHECK_EQ(is_fieldset_container_, other.is_fieldset_container_);
DCHECK_EQ(is_legacy_layout_root_, other.is_legacy_layout_root_);
DCHECK_EQ(is_painted_atomically_, other.is_painted_atomically_);
DCHECK_EQ(has_collapsed_borders_, other.has_collapsed_borders_);
DCHECK_EQ(is_inline_formatting_context_, other.is_inline_formatting_context_); DCHECK_EQ(is_inline_formatting_context_, other.is_inline_formatting_context_);
DCHECK_EQ(has_fragment_items_, other.has_fragment_items_); DCHECK_EQ(has_fragment_items_, other.has_fragment_items_);
DCHECK_EQ(include_border_top_, other.include_border_top_); DCHECK_EQ(include_border_top_, other.include_border_top_);
DCHECK_EQ(include_border_right_, other.include_border_right_); DCHECK_EQ(include_border_right_, other.include_border_right_);
DCHECK_EQ(include_border_bottom_, other.include_border_bottom_); DCHECK_EQ(include_border_bottom_, other.include_border_bottom_);
DCHECK_EQ(include_border_left_, other.include_border_left_); DCHECK_EQ(include_border_left_, other.include_border_left_);
DCHECK_EQ(is_math_fraction_, other.is_math_fraction_);
DCHECK_EQ(is_math_operator_, other.is_math_operator_);
DCHECK_EQ(is_fieldset_container_, other.is_fieldset_container_);
DCHECK_EQ(is_legacy_layout_root_, other.is_legacy_layout_root_);
DCHECK_EQ(is_painted_atomically_, other.is_painted_atomically_);
// The oof_positioned_descendants_ vector can change during "simplified" // The oof_positioned_descendants_ vector can change during "simplified"
// layout. This occurs when an OOF-descendant changes from "fixed" to // layout. This occurs when an OOF-descendant changes from "fixed" to
...@@ -831,6 +832,16 @@ void NGPhysicalBoxFragment::CheckSameForSimplifiedLayout( ...@@ -831,6 +832,16 @@ void NGPhysicalBoxFragment::CheckSameForSimplifiedLayout(
NGBlockNode(ToLayoutBox(GetMutableLayoutObject())) NGBlockNode(ToLayoutBox(GetMutableLayoutObject()))
.UseBlockEndMarginEdgeForInlineBlockBaseline()); .UseBlockEndMarginEdgeForInlineBlockBaseline());
} }
// TODO(atotic,ikilpatrick): Enable DCHECKs for:
// - TableGridRect()
// - TableColumnGeometries()
// - TableCollapsedBorders()
// - TableCollapsedBordersGeometry()
if (IsTableNGCell())
DCHECK_EQ(TableCellColumnIndex(), other.TableCellColumnIndex());
DCHECK(Borders() == other.Borders()); DCHECK(Borders() == other.Borders());
DCHECK(Padding() == other.Padding()); DCHECK(Padding() == other.Padding());
} }
......
...@@ -70,8 +70,17 @@ NGSimplifiedLayoutAlgorithm::NGSimplifiedLayoutAlgorithm( ...@@ -70,8 +70,17 @@ NGSimplifiedLayoutAlgorithm::NGSimplifiedLayoutAlgorithm(
if (physical_fragment.LastBaseline()) if (physical_fragment.LastBaseline())
container_builder_.SetLastBaseline(*physical_fragment.LastBaseline()); container_builder_.SetLastBaseline(*physical_fragment.LastBaseline());
// TODO(ikilpatrick): Set any fields for table-cells which are also set if (ConstraintSpace().IsTableCell()) {
// within the NGBlockLayoutAlgorithm. if (physical_fragment.HasCollapsedBorders())
container_builder_.SetHasCollapsedBorders(true);
if (!ConstraintSpace().IsLegacyTableCell()) {
container_builder_.SetTableCellColumnIndex(
physical_fragment.TableCellColumnIndex());
}
} else {
DCHECK(!physical_fragment.HasCollapsedBorders());
}
} else { } else {
// Only block-flow layout sets the following fields. // Only block-flow layout sets the following fields.
DCHECK(physical_fragment.IsFormattingContextRoot()); DCHECK(physical_fragment.IsFormattingContextRoot());
...@@ -105,6 +114,12 @@ NGSimplifiedLayoutAlgorithm::NGSimplifiedLayoutAlgorithm( ...@@ -105,6 +114,12 @@ NGSimplifiedLayoutAlgorithm::NGSimplifiedLayoutAlgorithm(
container_builder_.SetCustomLayoutData(result.CustomLayoutData()); container_builder_.SetCustomLayoutData(result.CustomLayoutData());
} }
// TODO(atotic,ikilpatrick): Copy across table related data for table,
// table-row, table-section.
DCHECK(!physical_fragment.IsTable());
DCHECK(!physical_fragment.IsTableRow());
DCHECK(!physical_fragment.IsTableSection());
if (physical_fragment.IsHiddenForPaint()) if (physical_fragment.IsHiddenForPaint())
container_builder_.SetIsHiddenForPaint(true); container_builder_.SetIsHiddenForPaint(true);
......
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