Skip to content

Commit

Permalink
LayoutNG: Remove 'NG' from table LayoutObject names
Browse files Browse the repository at this point in the history
This CL has no production behavior changes.

Bug: 1492009
Change-Id: I872a839360382e67c967ccdbf430820d60ae9216
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4955094
Auto-Submit: Kent Tamura <tkent@chromium.org>
Reviewed-by: Morten Stenshorne <mstensho@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1212595}
  • Loading branch information
tkent-google authored and Chromium LUCI CQ committed Oct 20, 2023
1 parent 812f9ec commit cd93f00
Show file tree
Hide file tree
Showing 97 changed files with 504 additions and 500 deletions.
20 changes: 10 additions & 10 deletions third_party/blink/renderer/core/editing/element_inner_text.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class ElementInnerTextCollector final {
static bool IsBeingRendered(const Node& node);
// Returns true if used value of "display" is block-level.
static bool IsDisplayBlockLevel(const Node&);
static bool ShouldEmitNewlineForTableRow(const LayoutNGTableRow& table_row);
static bool ShouldEmitNewlineForTableRow(const LayoutTableRow& table_row);

const NGOffsetMapping* GetOffsetMapping(const LayoutText& layout_text);
void ProcessChildren(const Node& node);
Expand Down Expand Up @@ -150,7 +150,7 @@ bool ElementInnerTextCollector::IsDisplayBlockLevel(const Node& node) {
if (!layout_object)
return false;
if (layout_object->IsTableSection()) {
// Note: |LayoutNGTableSection::IsInline()| returns false, but it is not
// Note: |LayoutTableSection::IsInline()| returns false, but it is not
// block-level.
return false;
}
Expand All @@ -170,29 +170,29 @@ bool ElementInnerTextCollector::IsDisplayBlockLevel(const Node& node) {
// e.g. <ruby>abc<rt>def</rt>.innerText == "abcdef"
return false;
}
// Note: CAPTION is associated to |LayoutNGTableCaption| in LayoutNG or
// Note: CAPTION is associated to |LayoutTableCaption| in LayoutNG or
// |LayoutBlockFlow| in legacy layout.
return true;
}

// static
bool ElementInnerTextCollector::ShouldEmitNewlineForTableRow(
const LayoutNGTableRow& table_row) {
const LayoutNGTable* const table = table_row.Table();
const LayoutTableRow& table_row) {
const LayoutTable* const table = table_row.Table();
if (!table)
return false;
if (table_row.NextRow()) {
return true;
}
// For TABLE contains TBODY, TFOOTER, THEAD.
const LayoutNGTableSection* table_section = table_row.Section();
const LayoutTableSection* table_section = table_row.Section();
if (!table_section)
return false;
// See |LayoutNGTable::NextSection()| and
// |PreviousSection()| for traversing |LayoutNGTableSection|.
// See |LayoutTable::NextSection()| and
// |PreviousSection()| for traversing |LayoutTableSection|.
for (const LayoutObject* runner = table_section->NextSibling(); runner;
runner = runner->NextSibling()) {
const auto* section = DynamicTo<LayoutNGTableSection>(runner);
const auto* section = DynamicTo<LayoutTableSection>(runner);
if (section && section->NumRows() > 0) {
return true;
}
Expand Down Expand Up @@ -329,7 +329,7 @@ void ElementInnerTextCollector::ProcessNode(const Node& node) {
if (style->Display() == EDisplay::kTableRow) {
ProcessChildren(node);
if (layout_object.IsTableRow() &&
ShouldEmitNewlineForTableRow(To<LayoutNGTableRow>(layout_object))) {
ShouldEmitNewlineForTableRow(To<LayoutTableRow>(layout_object))) {
result_.EmitNewline();
}
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -603,8 +603,8 @@ bool TextIteratorAlgorithm<Strategy>::ShouldEmitTabBeforeNode(
return false;

// Want a tab before every cell other than the first one
const auto* rc = To<LayoutNGTableCell>(r);
const LayoutNGTable* t = rc->Table();
const auto* rc = To<LayoutTableCell>(r);
const LayoutTable* t = rc->Table();
return t && !t->IsFirstCell(*rc);
}

Expand Down Expand Up @@ -662,7 +662,7 @@ static bool ShouldEmitNewlinesBeforeAndAfterNode(const Node& node) {
// Need to make an exception for table row elements, because they are neither
// "inline" or "LayoutBlock", but we want newlines for them.
if (r->IsTableRow()) {
const LayoutNGTable* t = To<LayoutNGTableRow>(r)->Table();
const LayoutTable* t = To<LayoutTableRow>(r)->Table();
if (t && !t->IsInline()) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void HTMLTableCellElement::ParseAttribute(
const AttributeModificationParams& params) {
if (params.name == html_names::kRowspanAttr ||
params.name == html_names::kColspanAttr) {
if (auto* cell = DynamicTo<LayoutNGTableCell>(GetLayoutObject())) {
if (auto* cell = DynamicTo<LayoutTableCell>(GetLayoutObject())) {
cell->ColSpanOrRowSpanChanged();
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion third_party/blink/renderer/core/layout/layout_box.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2648,7 +2648,7 @@ void LayoutBox::SetCachedLayoutResult(const NGLayoutResult* result,
if (measure_result_)
InvalidateItems(*measure_result_);
if (IsTableCell()) {
To<LayoutNGTableCell>(this)->InvalidateLayoutResultCacheAfterMeasure();
To<LayoutTableCell>(this)->InvalidateLayoutResultCacheAfterMeasure();
}
measure_result_ = result;
} else {
Expand Down
16 changes: 8 additions & 8 deletions third_party/blink/renderer/core/layout/layout_object.cc
Original file line number Diff line number Diff line change
Expand Up @@ -464,20 +464,20 @@ LayoutObject* LayoutObject::CreateObject(Element* element,
return CreateBlockFlowOrListItem(element, style);
case EDisplay::kTable:
case EDisplay::kInlineTable:
return MakeGarbageCollected<LayoutNGTable>(element);
return MakeGarbageCollected<LayoutTable>(element);
case EDisplay::kTableRowGroup:
case EDisplay::kTableHeaderGroup:
case EDisplay::kTableFooterGroup:
return MakeGarbageCollected<LayoutNGTableSection>(element);
return MakeGarbageCollected<LayoutTableSection>(element);
case EDisplay::kTableRow:
return MakeGarbageCollected<LayoutNGTableRow>(element);
return MakeGarbageCollected<LayoutTableRow>(element);
case EDisplay::kTableColumnGroup:
case EDisplay::kTableColumn:
return MakeGarbageCollected<LayoutNGTableColumn>(element);
return MakeGarbageCollected<LayoutTableColumn>(element);
case EDisplay::kTableCell:
return MakeGarbageCollected<LayoutNGTableCell>(element);
return MakeGarbageCollected<LayoutTableCell>(element);
case EDisplay::kTableCaption:
return MakeGarbageCollected<LayoutNGTableCaption>(element);
return MakeGarbageCollected<LayoutTableCaption>(element);
case EDisplay::kWebkitBox:
case EDisplay::kWebkitInlineBox:
if (style.IsDeprecatedWebkitBoxWithVerticalLineClamp()) {
Expand Down Expand Up @@ -734,7 +734,7 @@ void LayoutObject::AddChild(LayoutObject* new_child,
!after_child->IsBeforeContent()) {
table = after_child;
} else {
table = LayoutNGTable::CreateAnonymousWithParent(*this);
table = LayoutTable::CreateAnonymousWithParent(*this);
children->InsertChildNode(this, table, before_child);
}
table->AddChild(new_child);
Expand Down Expand Up @@ -1715,7 +1715,7 @@ inline void LayoutObject::InvalidateContainerIntrinsicLogicalWidths() {
// rather than from their parents (sections or rows). Skip these when
// invalidating.
if (current->IsTableCell()) {
return To<LayoutNGTableCell>(current)->Table();
return To<LayoutTableCell>(current)->Table();
}
return current->Container();
};
Expand Down
6 changes: 3 additions & 3 deletions third_party/blink/renderer/core/layout/layout_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ struct RecalcLayoutOverflowResult {
// Some LayoutObjects don't have an associated Node and are called "anonymous"
// (see the constructor below). Anonymous LayoutObjects exist for several
// purposes but are usually required by CSS. A good example is anonymous table
// parts (see LayoutNGTable for the expected structure). Anonymous LayoutObjects
// parts (see LayoutTable for the expected structure). Anonymous LayoutObjects
// are generated when a new child is added to the tree in addChild(). See the
// function for some important information on this.
//
Expand Down Expand Up @@ -581,7 +581,7 @@ class CORE_EXPORT LayoutObject : public GarbageCollected<LayoutObject>,
// from a structure of a flat tree if Shadow DOM is used.
// See LayoutTreeBuilderTraversal and FlatTreeTraversal.
//
// See LayoutNGTable::AddChild and LayoutBlockFlow::AddChild.
// See LayoutTable::AddChild and LayoutBlockFlow::AddChild.
// TODO(jchaffraix): |newChild| cannot be nullptr and should be a reference.
virtual void AddChild(LayoutObject* new_child,
LayoutObject* before_child = nullptr);
Expand Down Expand Up @@ -847,7 +847,7 @@ class CORE_EXPORT LayoutObject : public GarbageCollected<LayoutObject>,
// For renderer creation, the inline-* values create the same renderer
// as the non-inline version. The difference is that inline-* sets
// is_inline_ during initialization. This means that
// "display: inline-table" creates a LayoutNGTable, like "display: table".
// "display: inline-table" creates a LayoutTable, like "display: table".
//
// Ideally every Element::createLayoutObject would call this function to
// respond to 'display' but there are deep rooted assumptions about
Expand Down
18 changes: 9 additions & 9 deletions third_party/blink/renderer/core/layout/layout_table_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ namespace {

class LayoutTableTest : public RenderingTest {
protected:
LayoutNGTable* GetTableByElementId(const char* id) {
return To<LayoutNGTable>(GetLayoutObjectByElementId(id));
LayoutTable* GetTableByElementId(const char* id) {
return To<LayoutTable>(GetLayoutObjectByElementId(id));
}
};

Expand Down Expand Up @@ -267,9 +267,9 @@ TEST_F(LayoutTableTest, OutOfOrderHeadAndBody) {
)HTML");
auto* table = GetTableByElementId("table");
auto* head_section =
To<LayoutNGTableSection>(GetLayoutObjectByElementId("head"));
To<LayoutTableSection>(GetLayoutObjectByElementId("head"));
auto* body_section =
To<LayoutNGTableSection>(GetLayoutObjectByElementId("body"));
To<LayoutTableSection>(GetLayoutObjectByElementId("body"));
ASSERT_TRUE(table);
ASSERT_TRUE(head_section);
ASSERT_TRUE(body_section);
Expand Down Expand Up @@ -298,9 +298,9 @@ TEST_F(LayoutTableTest, OutOfOrderFootAndBody) {
)HTML");
auto* table = GetTableByElementId("table");
auto* body_section =
To<LayoutNGTableSection>(GetLayoutObjectByElementId("body"));
To<LayoutTableSection>(GetLayoutObjectByElementId("body"));
auto* foot_section =
To<LayoutNGTableSection>(GetLayoutObjectByElementId("foot"));
To<LayoutTableSection>(GetLayoutObjectByElementId("foot"));
ASSERT_TRUE(table);
ASSERT_TRUE(body_section);
ASSERT_TRUE(foot_section);
Expand Down Expand Up @@ -330,11 +330,11 @@ TEST_F(LayoutTableTest, OutOfOrderHeadFootAndBody) {
)HTML");
auto* table = GetTableByElementId("table");
auto* head_section =
To<LayoutNGTableSection>(GetLayoutObjectByElementId("head"));
To<LayoutTableSection>(GetLayoutObjectByElementId("head"));
auto* body_section =
To<LayoutNGTableSection>(GetLayoutObjectByElementId("body"));
To<LayoutTableSection>(GetLayoutObjectByElementId("body"));
auto* foot_section =
To<LayoutNGTableSection>(GetLayoutObjectByElementId("foot"));
To<LayoutTableSection>(GetLayoutObjectByElementId("foot"));
ASSERT_TRUE(table);
ASSERT_TRUE(head_section);
ASSERT_TRUE(body_section);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ void LayoutTreeAsText::WriteLayoutObject(WTF::TextStream& ts,
}

if (o.IsTableCell()) {
const auto& c = To<LayoutNGTableCell>(o);
const auto& c = To<LayoutTableCell>(o);
ts << " [r=" << c.RowIndex() << " c=" << c.AbsoluteColumnIndex()
<< " rs=" << c.ResolvedRowSpan() << " cs=" << c.ColSpan() << "]";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace blink {

LayoutTableCellWithAnonymousMrow::LayoutTableCellWithAnonymousMrow(
Element* element)
: LayoutNGTableCell(element) {
: LayoutTableCell(element) {
DCHECK(element);
}

Expand All @@ -18,7 +18,7 @@ void LayoutTableCellWithAnonymousMrow::AddChild(LayoutObject* new_child,
if (!anonymous_mrow) {
anonymous_mrow = LayoutBlock::CreateAnonymousWithParentAndDisplay(
this, EDisplay::kBlockMath);
LayoutNGTableCell::AddChild(anonymous_mrow);
LayoutTableCell::AddChild(anonymous_mrow);
}
anonymous_mrow->AddChild(new_child, before_child);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace blink {

class LayoutTableCellWithAnonymousMrow : public LayoutNGTableCell {
class LayoutTableCellWithAnonymousMrow : public LayoutTableCell {
public:
explicit LayoutTableCellWithAnonymousMrow(Element*);

Expand Down
7 changes: 4 additions & 3 deletions third_party/blink/renderer/core/layout/ng/ng_block_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,11 @@ bool CanUseCachedIntrinsicInlineSizes(const NGConstraintSpace& constraint_space,
return false;
}

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

// We may have something like:
// "grid-template-columns: repeat(auto-fill, 50px); min-width: 50%;"
Expand Down Expand Up @@ -1034,7 +1035,7 @@ MinMaxSizesResult NGBlockNode::ComputeMinMaxSizes(
result.depends_on_block_constraints, result.sizes);

if (IsNGTableCell()) {
To<LayoutNGTableCell>(box_.Get())
To<LayoutTableCell>(box_.Get())
->SetIntrinsicLogicalWidthsBorderSizes(
constraint_space.TableCellBorders());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,22 @@ bool NGLayoutInputNode::IsSvgText() const {

bool NGLayoutInputNode::IsEmptyTableSection() const {
return box_->IsTableSection() &&
To<LayoutNGTableSection>(box_.Get())->IsEmpty();
To<LayoutTableSection>(box_.Get())->IsEmpty();
}

wtf_size_t NGLayoutInputNode::TableColumnSpan() const {
DCHECK(IsTableCol() || IsTableColgroup());
return To<LayoutNGTableColumn>(box_.Get())->Span();
return To<LayoutTableColumn>(box_.Get())->Span();
}

wtf_size_t NGLayoutInputNode::TableCellColspan() const {
DCHECK(box_->IsTableCell());
return To<LayoutNGTableCell>(box_.Get())->ColSpan();
return To<LayoutTableCell>(box_.Get())->ColSpan();
}

wtf_size_t NGLayoutInputNode::TableCellRowspan() const {
DCHECK(box_->IsTableCell());
return To<LayoutNGTableCell>(box_.Get())->ComputedRowSpan();
return To<LayoutTableCell>(box_.Get())->ComputedRowSpan();
}

bool NGLayoutInputNode::IsTextControlPlaceholder() const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,7 @@ PhysicalRect NGPhysicalBoxFragment::ComputeSelfInkOverflow() const {
if (!child_fragment.IsTableNGCell())
continue;
const auto* child_layout_object =
To<LayoutNGTableCell>(child_fragment.GetLayoutObject());
To<LayoutTableCell>(child_fragment.GetLayoutObject());
if (child_layout_object->ComputedRowSpan() == 1)
continue;
PhysicalRect child_rect;
Expand Down

0 comments on commit cd93f00

Please sign in to comment.