Skip to content

Commit

Permalink
LayoutNG: Remvoe 'NG' from symbols defined in layout/ng/table/
Browse files Browse the repository at this point in the history
The file names are going to be renamed in a later CL.
This CL has no behavior changes.

Bug: 1492009
Change-Id: I13888b1f975bf0a429c635b28da87e4adc13a8d1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4957501
Reviewed-by: Koji Ishii <kojii@chromium.org>
Auto-Submit: Kent Tamura <tkent@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1212632}
  • Loading branch information
tkent-google authored and Chromium LUCI CQ committed Oct 20, 2023
1 parent b22c737 commit c12b093
Show file tree
Hide file tree
Showing 45 changed files with 665 additions and 660 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ void NGFlexLayoutAlgorithm::ConstructAndAppendFlexItems(
flex_base_border_box = ResolveMainBlockLength(
flex_basis_space, child_style, border_padding_in_child_writing_mode,
flex_basis_length, IntrinsicBlockSizeFunc);
if (const NGTableNode* table_child = DynamicTo<NGTableNode>(&child)) {
if (const auto* table_child = DynamicTo<TableNode>(&child)) {
// (1) A table interprets forced block size as the height of its
// captions + rows.
// (2) The specified height of a table only applies to the rows.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2990,7 +2990,7 @@ void NGBlockLayoutAlgorithm::PropagateBaselineFromBlockChild(

// When computing baselines for an inline-block, table's don't contribute any
// baselines.
if (child.IsTableNG() &&
if (child.IsTable() &&
baseline_algorithm == NGBaselineAlgorithmType::kInlineBlock) {
return;
}
Expand Down
14 changes: 7 additions & 7 deletions third_party/blink/renderer/core/layout/ng/ng_block_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@ NOINLINE void DetermineAlgorithmAndRun(const NGLayoutAlgorithmParams& params,
if (box.IsLayoutNGFlexibleBox()) {
CreateAlgorithmAndRun<NGFlexLayoutAlgorithm>(params, callback);
} else if (box.IsTable()) {
CreateAlgorithmAndRun<NGTableLayoutAlgorithm>(params, callback);
CreateAlgorithmAndRun<TableLayoutAlgorithm>(params, callback);
} else if (box.IsTableRow()) {
CreateAlgorithmAndRun<NGTableRowLayoutAlgorithm>(params, callback);
CreateAlgorithmAndRun<TableRowLayoutAlgorithm>(params, callback);
} else if (box.IsTableSection()) {
CreateAlgorithmAndRun<NGTableSectionLayoutAlgorithm>(params, callback);
CreateAlgorithmAndRun<TableSectionLayoutAlgorithm>(params, callback);
} else if (box.IsLayoutCustom()) {
CreateAlgorithmAndRun<CustomLayoutAlgorithm>(params, callback);
} else if (box.IsMathML()) {
Expand Down Expand Up @@ -246,9 +246,9 @@ bool CanUseCachedIntrinsicInlineSizes(const NGConstraintSpace& constraint_space,
return false;
}

if (node.IsNGTableCell() && To<LayoutTableCell>(node.GetLayoutBox())
->IntrinsicLogicalWidthsBorderSizes() !=
constraint_space.TableCellBorders()) {
if (node.IsTableCell() && To<LayoutTableCell>(node.GetLayoutBox())
->IntrinsicLogicalWidthsBorderSizes() !=
constraint_space.TableCellBorders()) {
return false;
}

Expand Down Expand Up @@ -1034,7 +1034,7 @@ MinMaxSizesResult NGBlockNode::ComputeMinMaxSizes(
/* child_depends_on_block_constraints */
result.depends_on_block_constraints, result.sizes);

if (IsNGTableCell()) {
if (IsTableCell()) {
To<LayoutTableCell>(box_.Get())
->SetIntrinsicLogicalWidthsBorderSizes(
constraint_space.TableCellBorders());
Expand Down
2 changes: 1 addition & 1 deletion third_party/blink/renderer/core/layout/ng/ng_block_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class CORE_EXPORT NGBlockNode : public NGLayoutInputNode {
NGBlockNode GetRenderedLegend() const;
NGBlockNode GetFieldsetContent() const;

bool IsNGTableCell() const { return box_->IsTableCell(); }
bool IsTableCell() const { return box_->IsTableCell(); }

bool IsFrameSet() const { return box_->IsFrameSet(); }
bool IsParentNGFrameSet() const { return box_->Parent()->IsFrameSet(); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ class CORE_EXPORT NGBoxFragmentBuilder final : public NGFragmentBuilder {
}

void SetIsFieldsetContainer() { is_fieldset_container_ = true; }
void SetIsTableNGPart() { is_table_ng_part_ = true; }
void SetIsTablePart() { is_table_part_ = true; }

void SetIsInlineFormattingContext(bool is_inline_formatting_context) {
is_inline_formatting_context_ = is_inline_formatting_context;
Expand Down Expand Up @@ -530,16 +530,16 @@ class CORE_EXPORT NGBoxFragmentBuilder final : public NGFragmentBuilder {
}

void SetTableColumnGeometries(
const NGTableFragmentData::ColumnGeometries& table_column_geometries) {
const TableFragmentData::ColumnGeometries& table_column_geometries) {
table_column_geometries_ = table_column_geometries;
}

void SetTableCollapsedBorders(const NGTableBorders& table_collapsed_borders) {
void SetTableCollapsedBorders(const TableBorders& table_collapsed_borders) {
table_collapsed_borders_ = &table_collapsed_borders;
}

void SetTableCollapsedBordersGeometry(
std::unique_ptr<NGTableFragmentData::CollapsedBordersGeometry>
std::unique_ptr<TableFragmentData::CollapsedBordersGeometry>
table_collapsed_borders_geometry) {
table_collapsed_borders_geometry_ =
std::move(table_collapsed_borders_geometry);
Expand Down Expand Up @@ -650,7 +650,7 @@ class CORE_EXPORT NGBoxFragmentBuilder final : public NGFragmentBuilder {
absl::optional<LogicalRect> inflow_bounds_;

bool is_fieldset_container_ = false;
bool is_table_ng_part_ = false;
bool is_table_part_ = false;
bool is_initial_block_size_indefinite_ = false;
bool is_inline_formatting_context_;
bool is_known_to_fit_in_fragmentainer_ = false;
Expand Down Expand Up @@ -687,9 +687,9 @@ class CORE_EXPORT NGBoxFragmentBuilder final : public NGFragmentBuilder {

// Table specific types.
absl::optional<LogicalRect> table_grid_rect_;
NGTableFragmentData::ColumnGeometries table_column_geometries_;
const NGTableBorders* table_collapsed_borders_ = nullptr;
std::unique_ptr<NGTableFragmentData::CollapsedBordersGeometry>
TableFragmentData::ColumnGeometries table_column_geometries_;
const TableBorders* table_collapsed_borders_ = nullptr;
std::unique_ptr<TableFragmentData::CollapsedBordersGeometry>
table_collapsed_borders_geometry_;
absl::optional<wtf_size_t> table_column_count_;

Expand Down
16 changes: 8 additions & 8 deletions third_party/blink/renderer/core/layout/ng/ng_constraint_space.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ class CORE_EXPORT NGConstraintSpace final {
: false;
}

const NGTableConstraintSpaceData* TableData() const {
const TableConstraintSpaceData* TableData() const {
return HasRareData() ? rare_data_->TableData() : nullptr;
}

Expand Down Expand Up @@ -836,7 +836,7 @@ class CORE_EXPORT NGConstraintSpace final {
return true;
}

void ReplaceTableRowData(const NGTableConstraintSpaceData& table_data,
void ReplaceTableRowData(const TableConstraintSpaceData& table_data,
const wtf_size_t row_index) {
DCHECK(HasRareData());
rare_data_->ReplaceTableRowData(table_data, row_index);
Expand Down Expand Up @@ -1204,20 +1204,20 @@ class CORE_EXPORT NGConstraintSpace final {
}

void SetTableRowData(
scoped_refptr<const NGTableConstraintSpaceData> table_data,
scoped_refptr<const TableConstraintSpaceData> table_data,
wtf_size_t row_index) {
EnsureTableRowData()->table_data = std::move(table_data);
EnsureTableRowData()->row_index = row_index;
}

void SetTableSectionData(
scoped_refptr<const NGTableConstraintSpaceData> table_data,
scoped_refptr<const TableConstraintSpaceData> table_data,
wtf_size_t section_index) {
EnsureTableSectionData()->table_data = std::move(table_data);
EnsureTableSectionData()->section_index = section_index;
}

void ReplaceTableRowData(const NGTableConstraintSpaceData& table_data,
void ReplaceTableRowData(const TableConstraintSpaceData& table_data,
wtf_size_t row_index) {
DCHECK_EQ(GetDataUnionType(), DataUnionType::kTableRowData);
DCHECK(
Expand All @@ -1228,7 +1228,7 @@ class CORE_EXPORT NGConstraintSpace final {
table_row_data_.row_index = row_index;
}

const NGTableConstraintSpaceData* TableData() {
const TableConstraintSpaceData* TableData() {
if (GetDataUnionType() == DataUnionType::kTableRowData)
return table_row_data_.table_data.get();
if (GetDataUnionType() == DataUnionType::kTableSectionData)
Expand Down Expand Up @@ -1381,7 +1381,7 @@ class CORE_EXPORT NGConstraintSpace final {
return !table_data && row_index == kNotFound;
}

scoped_refptr<const NGTableConstraintSpaceData> table_data;
scoped_refptr<const TableConstraintSpaceData> table_data;
wtf_size_t row_index = kNotFound;
};

Expand All @@ -1395,7 +1395,7 @@ class CORE_EXPORT NGConstraintSpace final {
return !table_data && section_index == kNotFound;
}

scoped_refptr<const NGTableConstraintSpaceData> table_data;
scoped_refptr<const TableConstraintSpaceData> table_data;
wtf_size_t section_index = kNotFound;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ class CORE_EXPORT NGConstraintSpaceBuilder final {
}
}

void SetTableRowData(const NGTableConstraintSpaceData* table_data,
void SetTableRowData(const TableConstraintSpaceData* table_data,
wtf_size_t row_index) {
#if DCHECK_IS_ON()
DCHECK(!is_table_row_data_set_);
Expand All @@ -467,7 +467,7 @@ class CORE_EXPORT NGConstraintSpaceBuilder final {
}

void SetTableSectionData(
scoped_refptr<const NGTableConstraintSpaceData> table_data,
scoped_refptr<const TableConstraintSpaceData> table_data,
wtf_size_t section_index) {
#if DCHECK_IS_ON()
DCHECK(!is_table_section_data_set_);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,7 @@ BoxStrut ComputeBorders(const NGConstraintSpace& constraint_space,
return constraint_space.TableCellBorders();

if (node.IsTable()) {
return To<NGTableNode>(node).GetTableBorders()->TableBorder();
return To<TableNode>(node).GetTableBorders()->TableBorder();
}

return ComputeBordersInternal(node.Style());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ LayoutUnit ComputeInlineSizeForFragment(
}

if (node.IsTable()) {
return To<NGTableNode>(node).ComputeTableInlineSize(space, border_padding);
return To<TableNode>(node).ComputeTableInlineSize(space, border_padding);
}

return ComputeInlineSizeForFragmentInternal(space, node, border_padding,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ NGPhysicalBoxFragment::NGPhysicalBoxFragment(

bit_field_.set<IsFirstForNodeFlag>(builder->is_first_for_node_);
is_fieldset_container_ = builder->is_fieldset_container_;
is_table_ng_part_ = builder->is_table_ng_part_;
is_table_part_ = builder->is_table_part_;
is_painted_atomically_ = builder->space_.IsPaintedAtomically();
PhysicalBoxSides sides_to_include(builder->sides_to_include_,
builder->GetWritingMode());
Expand Down Expand Up @@ -1208,13 +1208,14 @@ PhysicalRect NGPhysicalBoxFragment::ComputeSelfInkOverflow() const {
const ComputedStyle& style = Style();

PhysicalRect ink_overflow(LocalRect());
if (UNLIKELY(IsTableNGRow())) {
if (UNLIKELY(IsTableRow())) {
// This is necessary because table-rows paints beyond border box if it
// contains rowspanned cells.
for (const NGLink& child : PostLayoutChildren()) {
const auto& child_fragment = To<NGPhysicalBoxFragment>(*child);
if (!child_fragment.IsTableNGCell())
if (!child_fragment.IsTableCell()) {
continue;
}
const auto* child_layout_object =
To<LayoutTableCell>(child_fragment.GetLayoutObject());
if (child_layout_object->ComputedRowSpan() == 1)
Expand Down Expand Up @@ -1739,7 +1740,7 @@ void NGPhysicalBoxFragment::CheckSameForSimplifiedLayout(
DCHECK_EQ(IsFragmentationContextRoot(), other.IsFragmentationContextRoot());

DCHECK_EQ(is_fieldset_container_, other.is_fieldset_container_);
DCHECK_EQ(is_table_ng_part_, other.is_table_ng_part_);
DCHECK_EQ(is_table_part_, other.is_table_part_);
DCHECK_EQ(is_painted_atomically_, other.is_painted_atomically_);
DCHECK_EQ(has_collapsed_borders_, other.has_collapsed_borders_);

Expand All @@ -1757,7 +1758,7 @@ void NGPhysicalBoxFragment::CheckSameForSimplifiedLayout(
DCHECK(FirstBaseline() == other.FirstBaseline());
DCHECK(LastBaseline() == other.LastBaseline());

if (IsTableNG()) {
if (IsTable()) {
DCHECK_EQ(TableGridRect(), other.TableGridRect());

if (TableColumnGeometries()) {
Expand All @@ -1778,8 +1779,9 @@ void NGPhysicalBoxFragment::CheckSameForSimplifiedLayout(
}
}

if (IsTableNGCell())
if (IsTableCell()) {
DCHECK_EQ(TableCellColumnIndex(), other.TableCellColumnIndex());
}

DCHECK(Borders() == other.Borders());
DCHECK(Padding() == other.Padding());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,15 @@ class CORE_EXPORT NGPhysicalBoxFragment final : public NGPhysicalFragment {
return rare_data_->GetField(FieldId::kTableGridRect)->table_grid_rect;
}

const NGTableFragmentData::ColumnGeometries* TableColumnGeometries() const {
const TableFragmentData::ColumnGeometries* TableColumnGeometries() const {
return rare_data_->table_column_geometries_.Get();
}

const NGTableBorders* TableCollapsedBorders() const {
const TableBorders* TableCollapsedBorders() const {
return rare_data_ ? rare_data_->table_collapsed_borders_ : nullptr;
}

const NGTableFragmentData::CollapsedBordersGeometry*
const TableFragmentData::CollapsedBordersGeometry*
TableCollapsedBordersGeometry() const {
if (const auto* field =
GetRareField(FieldId::kTableCollapsedBordersGeometry)) {
Expand All @@ -188,15 +188,15 @@ class CORE_EXPORT NGPhysicalBoxFragment final : public NGPhysicalFragment {
}

absl::optional<wtf_size_t> TableSectionStartRowIndex() const {
DCHECK(IsTableNGSection());
DCHECK(IsTableSection());
if (const auto* field = GetRareField(FieldId::kTableSectionStartRowIndex)) {
return field->table_section_start_row_index;
}
return absl::nullopt;
}

const Vector<LayoutUnit>* TableSectionRowOffsets() const {
DCHECK(IsTableNGSection());
DCHECK(IsTableSection());
if (const auto* field = GetRareField(FieldId::kTableSectionRowOffsets)) {
return &field->table_section_row_offsets;
}
Expand Down Expand Up @@ -401,7 +401,7 @@ class CORE_EXPORT NGPhysicalBoxFragment final : public NGPhysicalFragment {
bool IsOnlyForNode() const { return IsFirstForNode() && !BreakToken(); }

bool HasDescendantsForTablePart() const {
DCHECK(IsTableNGPart() || IsTableNGCell());
DCHECK(IsTablePart() || IsTableCell());
return bit_field_.get<HasDescendantsForTablePartFlag>();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ NGPhysicalFragment::NGPhysicalFragment(NGFragmentBuilder* builder,
may_have_descendant_above_block_start_(
builder->may_have_descendant_above_block_start_),
is_fieldset_container_(false),
is_table_ng_part_(false),
is_table_part_(false),
is_painted_atomically_(false),
has_collapsed_borders_(builder->has_collapsed_borders_),
has_first_baseline_(false),
Expand Down Expand Up @@ -441,7 +441,7 @@ NGPhysicalFragment::NGPhysicalFragment(const NGPhysicalFragment& other)
may_have_descendant_above_block_start_(
other.may_have_descendant_above_block_start_),
is_fieldset_container_(other.is_fieldset_container_),
is_table_ng_part_(other.is_table_ng_part_),
is_table_part_(other.is_table_part_),
is_painted_atomically_(other.is_painted_atomically_),
has_collapsed_borders_(other.has_collapsed_borders_),
has_first_baseline_(other.has_first_baseline_),
Expand Down
20 changes: 9 additions & 11 deletions third_party/blink/renderer/core/layout/ng/ng_physical_fragment.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,22 +235,20 @@ class CORE_EXPORT NGPhysicalFragment
bool IsSvg() const { return layout_object_->IsSVG(); }
bool IsSvgText() const { return layout_object_->IsSVGText(); }

bool IsTableNGPart() const { return is_table_ng_part_; }
bool IsTablePart() const { return is_table_part_; }

bool IsTableNG() const {
return IsTableNGPart() && layout_object_->IsTable();
}
bool IsTable() const { return IsTablePart() && layout_object_->IsTable(); }

bool IsTableNGRow() const {
return IsTableNGPart() && layout_object_->IsTableRow();
bool IsTableRow() const {
return IsTablePart() && layout_object_->IsTableRow();
}

bool IsTableNGSection() const {
return IsTableNGPart() && layout_object_->IsTableSection();
bool IsTableSection() const {
return IsTablePart() && layout_object_->IsTableSection();
}

bool IsTableNGCell() const {
return IsTableNGPart() && layout_object_->IsTableCell();
bool IsTableCell() const {
return IsTablePart() && layout_object_->IsTableCell();
}

bool IsGridNG() const { return layout_object_->IsLayoutNGGrid(); }
Expand Down Expand Up @@ -805,7 +803,7 @@ class CORE_EXPORT NGPhysicalFragment
// The following are only used by NGPhysicalBoxFragment but are initialized
// for all types to allow methods using them to be inlined.
uint8_t is_fieldset_container_ : 1; // NOLINT
uint8_t is_table_ng_part_ : 1; // NOLINT
uint8_t is_table_part_ : 1; // NOLINT
uint8_t is_painted_atomically_ : 1; // NOLINT
uint8_t has_collapsed_borders_ : 1; // NOLINT
uint8_t has_first_baseline_ : 1; // NOLINT
Expand Down

0 comments on commit c12b093

Please sign in to comment.