Commit 37e0b5b5 authored by Aleks Totic's avatar Aleks Totic Committed by Commit Bot

[TablesNG] NOT_DESTROYED compliance

TablesNG code did not get moved over automatically.

Bug: 958381
Change-Id: Ib18854483effb0c1ed547e3f531db0926977cbc4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2522503Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#824719}
parent b22f49ea
......@@ -39,6 +39,7 @@ LayoutNGTable::LayoutNGTable(Element* element)
: LayoutNGMixin<LayoutBlock>(element) {}
wtf_size_t LayoutNGTable::ColumnCount() const {
NOT_DESTROYED();
const NGLayoutResult* cached_layout_result = GetCachedLayoutResult();
if (!cached_layout_result)
return 0;
......@@ -47,10 +48,12 @@ wtf_size_t LayoutNGTable::ColumnCount() const {
void LayoutNGTable::SetCachedTableBorders(
scoped_refptr<const NGTableBorders> table_borders) {
NOT_DESTROYED();
cached_table_borders_ = std::move(table_borders);
}
void LayoutNGTable::InvalidateCachedTableBorders() {
NOT_DESTROYED();
// TODO(layout-dev) When cached borders are invalidated, we could do a
// special kind of relayout where fragments can replace only TableBorders,
// keep the geometry, and repaint.
......@@ -58,6 +61,7 @@ void LayoutNGTable::InvalidateCachedTableBorders() {
}
const NGTableTypes::Columns* LayoutNGTable::GetCachedTableColumnConstraints() {
NOT_DESTROYED();
if (IsTableColumnsConstraintsDirty())
cached_table_columns_.reset();
return cached_table_columns_.get();
......@@ -65,6 +69,7 @@ const NGTableTypes::Columns* LayoutNGTable::GetCachedTableColumnConstraints() {
void LayoutNGTable::SetCachedTableColumnConstraints(
scoped_refptr<const NGTableTypes::Columns> columns) {
NOT_DESTROYED();
cached_table_columns_ = std::move(columns);
SetTableColumnConstraintDirty(false);
}
......@@ -78,10 +83,12 @@ void LayoutNGTable::GridBordersChanged() {
}
void LayoutNGTable::TableGridStructureChanged() {
NOT_DESTROYED();
InvalidateCachedTableBorders();
}
void LayoutNGTable::UpdateBlockLayout(bool relayout_children) {
NOT_DESTROYED();
LayoutAnalyzer::BlockScope analyzer(*this);
if (IsOutOfFlowPositioned()) {
......@@ -92,6 +99,7 @@ void LayoutNGTable::UpdateBlockLayout(bool relayout_children) {
}
void LayoutNGTable::AddChild(LayoutObject* child, LayoutObject* before_child) {
NOT_DESTROYED();
TableGridStructureChanged();
bool wrap_in_anonymous_section = !child->IsTableCaption() &&
!child->IsLayoutTableCol() &&
......@@ -143,6 +151,7 @@ void LayoutNGTable::AddChild(LayoutObject* child, LayoutObject* before_child) {
}
void LayoutNGTable::RemoveChild(LayoutObject* child) {
NOT_DESTROYED();
TableGridStructureChanged();
LayoutNGMixin<LayoutBlock>::RemoveChild(child);
}
......@@ -165,6 +174,7 @@ void LayoutNGTable::StyleDidChange(StyleDifference diff,
LayoutBox* LayoutNGTable::CreateAnonymousBoxWithSameTypeAs(
const LayoutObject* parent) const {
NOT_DESTROYED();
return LayoutObjectFactory::CreateAnonymousTableWithParent(*parent);
}
......@@ -290,6 +300,7 @@ LayoutUnit LayoutNGTable::BorderBottom() const {
}
LayoutRectOutsets LayoutNGTable::BorderBoxOutsets() const {
NOT_DESTROYED();
// DCHECK(cached_table_borders_.get())
// ScrollAnchoring fails this DCHECK.
if (PhysicalFragmentCount() > 0) {
......@@ -300,6 +311,7 @@ LayoutRectOutsets LayoutNGTable::BorderBoxOutsets() const {
}
bool LayoutNGTable::IsFirstCell(const LayoutNGTableCellInterface& cell) const {
NOT_DESTROYED();
const LayoutNGTableRowInterface* row = cell.RowInterface();
if (row->FirstCellInterface() != &cell)
return false;
......@@ -316,6 +328,7 @@ bool LayoutNGTable::IsFirstCell(const LayoutNGTableCellInterface& cell) const {
// Only called from AXLayoutObject::IsDataTable()
LayoutNGTableSectionInterface* LayoutNGTable::FirstBodyInterface() const {
NOT_DESTROYED();
for (LayoutObject* child = FirstChild(); child;
child = child->NextSibling()) {
if (child->StyleRef().Display() == EDisplay::kTableRowGroup)
......@@ -326,6 +339,7 @@ LayoutNGTableSectionInterface* LayoutNGTable::FirstBodyInterface() const {
// Called from many AXLayoutObject methods.
LayoutNGTableSectionInterface* LayoutNGTable::TopSectionInterface() const {
NOT_DESTROYED();
NGTableGroupedChildren grouped_children(
NGBlockNode(const_cast<LayoutNGTable*>(this)));
auto first_section = grouped_children.begin();
......@@ -340,6 +354,7 @@ LayoutNGTableSectionInterface* LayoutNGTable::TopSectionInterface() const {
LayoutNGTableSectionInterface* LayoutNGTable::SectionBelowInterface(
const LayoutNGTableSectionInterface* target,
SkipEmptySectionsValue skip) const {
NOT_DESTROYED();
NGTableGroupedChildren grouped_children(
NGBlockNode(const_cast<LayoutNGTable*>(this)));
bool found = false;
......
......@@ -38,6 +38,7 @@ class CORE_EXPORT LayoutNGTable : public LayoutNGMixin<LayoutBlock>,
// TODO(atotic) Replace all H/VBorderSpacing with BorderSpacing?
LogicalSize BorderSpacing() const {
NOT_DESTROYED();
if (ShouldCollapseBorders())
return LogicalSize();
return LogicalSize(LayoutUnit(HBorderSpacing()),
......@@ -47,6 +48,7 @@ class CORE_EXPORT LayoutNGTable : public LayoutNGMixin<LayoutBlock>,
wtf_size_t ColumnCount() const;
const NGTableBorders* GetCachedTableBorders() const {
NOT_DESTROYED();
return cached_table_borders_.get();
}
......@@ -66,7 +68,10 @@ class CORE_EXPORT LayoutNGTable : public LayoutNGMixin<LayoutBlock>,
// LayoutBlock methods start.
const char* GetName() const override { return "LayoutNGTable"; }
const char* GetName() const override {
NOT_DESTROYED();
return "LayoutNGTable";
}
void UpdateBlockLayout(bool relayout_children) override;
......@@ -108,15 +113,23 @@ class CORE_EXPORT LayoutNGTable : public LayoutNGMixin<LayoutBlock>,
// LayoutNGTableInterface methods start.
const LayoutNGTableInterface* ToLayoutNGTableInterface() const final {
NOT_DESTROYED();
return this;
}
const LayoutObject* ToLayoutObject() const final { return this; }
const LayoutObject* ToLayoutObject() const final {
NOT_DESTROYED();
return this;
}
// Non-const version required by TextAutosizer, AXLayoutObject.
LayoutObject* ToMutableLayoutObject() final { return this; }
LayoutObject* ToMutableLayoutObject() final {
NOT_DESTROYED();
return this;
}
bool ShouldCollapseBorders() const final {
NOT_DESTROYED();
return StyleRef().BorderCollapse() == EBorderCollapse::kCollapse;
}
......@@ -132,13 +145,16 @@ class CORE_EXPORT LayoutNGTable : public LayoutNGMixin<LayoutBlock>,
}
bool IsFixedTableLayout() const final {
NOT_DESTROYED();
return StyleRef().TableLayout() == ETableLayout::kFixed &&
!StyleRef().LogicalWidth().IsAuto();
}
int16_t HBorderSpacing() const final {
NOT_DESTROYED();
return ShouldCollapseBorders() ? 0 : StyleRef().HorizontalBorderSpacing();
}
int16_t VBorderSpacing() const final {
NOT_DESTROYED();
return ShouldCollapseBorders() ? 0 : StyleRef().VerticalBorderSpacing();
}
......@@ -147,14 +163,15 @@ class CORE_EXPORT LayoutNGTable : public LayoutNGMixin<LayoutBlock>,
// Because NG does not compress columns, absolute and effective are the same.
unsigned AbsoluteColumnToEffectiveColumn(
unsigned absolute_column_index) const final {
NOT_DESTROYED();
return absolute_column_index;
}
// Legacy caches sections. Might not be needed by NG.
void RecalcSectionsIfNeeded() const final {}
void RecalcSectionsIfNeeded() const final { NOTIMPLEMENTED(); }
// Legacy caches sections. Might not be needed by NG.
void ForceSectionsRecalc() final {}
void ForceSectionsRecalc() final { NOTIMPLEMENTED(); }
// Used in paint for printing. Should not be needed by NG.
LayoutUnit RowOffsetFromRepeatingFooter() const final {
......@@ -197,6 +214,7 @@ class CORE_EXPORT LayoutNGTable : public LayoutNGMixin<LayoutBlock>,
protected:
bool IsOfType(LayoutObjectType type) const override {
NOT_DESTROYED();
return type == kLayoutObjectTable ||
LayoutNGMixin<LayoutBlock>::IsOfType(type);
}
......
......@@ -24,6 +24,7 @@ LayoutNGTableCaption::LayoutNGTableCaption(Element* element)
void LayoutNGTableCaption::CalculateAndSetMargins(
const NGConstraintSpace& constraint_space,
const NGPhysicalFragment& physical_fragment) {
NOT_DESTROYED();
const ComputedStyle& containing_block_style = ContainingBlock()->StyleRef();
NGBoxFragment box_fragment(containing_block_style.GetWritingDirection(),
......@@ -52,6 +53,7 @@ void LayoutNGTableCaption::CalculateAndSetMargins(
}
void LayoutNGTableCaption::InsertedIntoTree() {
NOT_DESTROYED();
LayoutBlockFlow::InsertedIntoTree();
LayoutNGTableInterface* table_interface = TableInterface();
......@@ -60,6 +62,7 @@ void LayoutNGTableCaption::InsertedIntoTree() {
}
void LayoutNGTableCaption::WillBeRemovedFromTree() {
NOT_DESTROYED();
LayoutBlockFlow::WillBeRemovedFromTree();
LayoutNGTableInterface* table_interface = TableInterface();
......@@ -70,6 +73,7 @@ void LayoutNGTableCaption::WillBeRemovedFromTree() {
}
void LayoutNGTableCaption::UpdateBlockLayout(bool relayout_children) {
NOT_DESTROYED();
LayoutAnalyzer::BlockScope analyzer(*this);
DCHECK(!IsOutOfFlowPositioned()) << "Out of flow captions are blockified.";
......@@ -90,6 +94,7 @@ void LayoutNGTableCaption::UpdateBlockLayout(bool relayout_children) {
}
LayoutNGTableInterface* LayoutNGTableCaption::TableInterface() const {
NOT_DESTROYED();
return ToInterface<LayoutNGTableInterface>(Parent());
}
......
......@@ -24,6 +24,7 @@ LayoutNGTableCell::LayoutNGTableCell(Element* element)
}
void LayoutNGTableCell::InvalidateLayoutResultCacheAfterMeasure() const {
NOT_DESTROYED();
if (LayoutBox* row = ParentBox()) {
DCHECK(row->IsTableRow());
row->ClearLayoutResults();
......@@ -81,6 +82,7 @@ LayoutUnit LayoutNGTableCell::BorderRight() const {
}
LayoutNGTable* LayoutNGTableCell::Table() const {
NOT_DESTROYED();
if (LayoutObject* parent = Parent()) {
if (LayoutObject* grandparent = parent->Parent()) {
return To<LayoutNGTable>(grandparent->Parent());
......@@ -90,6 +92,7 @@ LayoutNGTable* LayoutNGTableCell::Table() const {
}
void LayoutNGTableCell::UpdateBlockLayout(bool relayout_children) {
NOT_DESTROYED();
LayoutAnalyzer::BlockScope analyzer(*this);
if (IsOutOfFlowPositioned()) {
......@@ -113,6 +116,7 @@ void LayoutNGTableCell::StyleDidChange(StyleDifference diff,
}
void LayoutNGTableCell::ColSpanOrRowSpanChanged() {
NOT_DESTROYED();
// TODO(atotic) Invalidate layout?
UpdateColAndRowSpanFlags();
if (LayoutNGTable* table = Table())
......@@ -121,6 +125,7 @@ void LayoutNGTableCell::ColSpanOrRowSpanChanged() {
LayoutBox* LayoutNGTableCell::CreateAnonymousBoxWithSameTypeAs(
const LayoutObject* parent) const {
NOT_DESTROYED();
return LayoutObjectFactory::CreateAnonymousTableCellWithParent(*parent);
}
......@@ -137,6 +142,7 @@ bool LayoutNGTableCell::BackgroundIsKnownToBeOpaqueInRect(
}
Length LayoutNGTableCell::StyleOrColLogicalWidth() const {
NOT_DESTROYED();
// TODO(atotic) TablesNG cannot easily get col width before layout.
return StyleRef().LogicalWidth();
}
......@@ -144,16 +150,19 @@ Length LayoutNGTableCell::StyleOrColLogicalWidth() const {
// TODO(crbug.com/1079133): Used by AXLayoutObject::RowIndex,
// verify behaviour is correct.
unsigned LayoutNGTableCell::RowIndex() const {
NOT_DESTROYED();
return To<LayoutNGTableRow>(Parent())->RowIndex();
}
// TODO(crbug.com/1079133): Used by AXLayoutObject::CellForColumnAndRow,
// verify behaviour is correct.
unsigned LayoutNGTableCell::ResolvedRowSpan() const {
NOT_DESTROYED();
return ParsedRowSpan();
}
unsigned LayoutNGTableCell::AbsoluteColumnIndex() const {
NOT_DESTROYED();
if (PhysicalFragmentCount() > 0) {
return GetPhysicalFragment(0)->TableCellColumnIndex();
}
......@@ -162,12 +171,14 @@ unsigned LayoutNGTableCell::AbsoluteColumnIndex() const {
}
unsigned LayoutNGTableCell::ColSpan() const {
NOT_DESTROYED();
if (!has_col_span_)
return 1;
return ParseColSpanFromDOM();
}
unsigned LayoutNGTableCell::ParseColSpanFromDOM() const {
NOT_DESTROYED();
if (const auto* cell_element = DynamicTo<HTMLTableCellElement>(GetNode())) {
unsigned span = cell_element->colSpan();
DCHECK_GE(span, kMinColSpan);
......@@ -178,6 +189,7 @@ unsigned LayoutNGTableCell::ParseColSpanFromDOM() const {
}
unsigned LayoutNGTableCell::ParseRowSpanFromDOM() const {
NOT_DESTROYED();
if (const auto* cell_element = DynamicTo<HTMLTableCellElement>(GetNode())) {
unsigned span = cell_element->rowSpan();
DCHECK_GE(span, kMinRowSpan);
......@@ -188,29 +200,35 @@ unsigned LayoutNGTableCell::ParseRowSpanFromDOM() const {
}
void LayoutNGTableCell::UpdateColAndRowSpanFlags() {
NOT_DESTROYED();
// Colspan or rowspan are rare, so we keep the values in DOM.
has_col_span_ = ParseColSpanFromDOM() != kDefaultColSpan;
has_rowspan_ = ParseRowSpanFromDOM() != kDefaultRowSpan;
}
LayoutNGTableInterface* LayoutNGTableCell::TableInterface() const {
NOT_DESTROYED();
return ToInterface<LayoutNGTableInterface>(Parent()->Parent()->Parent());
}
LayoutNGTableCellInterface* LayoutNGTableCell::NextCellInterface() const {
NOT_DESTROYED();
return ToInterface<LayoutNGTableCellInterface>(LayoutObject::NextSibling());
}
LayoutNGTableCellInterface* LayoutNGTableCell::PreviousCellInterface() const {
NOT_DESTROYED();
return ToInterface<LayoutNGTableCellInterface>(
LayoutObject::PreviousSibling());
}
LayoutNGTableRowInterface* LayoutNGTableCell::RowInterface() const {
NOT_DESTROYED();
return ToInterface<LayoutNGTableRowInterface>(Parent());
}
LayoutNGTableSectionInterface* LayoutNGTableCell::SectionInterface() const {
NOT_DESTROYED();
return ToInterface<LayoutNGTableSectionInterface>(Parent()->Parent());
}
......
......@@ -23,6 +23,7 @@ class CORE_EXPORT LayoutNGTableCell
// NOTE: Rowspan might overflow section boundaries.
unsigned ComputedRowSpan() const {
NOT_DESTROYED();
if (!has_rowspan_)
return 1;
unsigned rowspan = ParseRowSpanFromDOM();
......@@ -32,10 +33,12 @@ class CORE_EXPORT LayoutNGTableCell
}
const NGBoxStrut& IntrinsicLogicalWidthsBorderSizes() const {
NOT_DESTROYED();
return intrinsical_logical_widths_border_sizes_;
}
void SetIntrinsicLogicalWidthsBorderSizes(const NGBoxStrut& border_sizes) {
NOT_DESTROYED();
intrinsical_logical_widths_border_sizes_ = border_sizes;
}
......@@ -69,9 +72,15 @@ class CORE_EXPORT LayoutNGTableCell
// TODO(atotic) Remove "New" from name.
// Currently, LayoutNGTableCellLegacy is named LayoutNGTableCell for test
// compat.
const char* GetName() const final { return "LayoutNGTableCellNew"; }
const char* GetName() const final {
NOT_DESTROYED();
return "LayoutNGTableCellNew";
}
bool CreatesNewFormattingContext() const final { return true; }
bool CreatesNewFormattingContext() const final {
NOT_DESTROYED();
return true;
}
bool BackgroundIsKnownToBeOpaqueInRect(const PhysicalRect&) const override;
......@@ -88,11 +97,18 @@ class CORE_EXPORT LayoutNGTableCell
}
const LayoutNGTableCellInterface* ToLayoutNGTableCellInterface() const final {
NOT_DESTROYED();
return this;
}
const LayoutObject* ToLayoutObject() const final {
NOT_DESTROYED();
return this;
}
const LayoutObject* ToLayoutObject() const final { return this; }
LayoutObject* ToMutableLayoutObject() final { return this; }
LayoutObject* ToMutableLayoutObject() final {
NOT_DESTROYED();
return this;
}
LayoutNGTableInterface* TableInterface() const final;
......@@ -101,9 +117,15 @@ class CORE_EXPORT LayoutNGTableCell
Length StyleOrColLogicalWidth() const final;
// Not used in LayoutNG.
int IntrinsicPaddingBefore() const final { return 0; }
int IntrinsicPaddingBefore() const final {
NOT_DESTROYED();
return 0;
}
// Not used in LayoutNG.
int IntrinsicPaddingAfter() const final { return 0; }
int IntrinsicPaddingAfter() const final {
NOT_DESTROYED();
return 0;
}
unsigned RowIndex() const final;
......@@ -126,6 +148,7 @@ class CORE_EXPORT LayoutNGTableCell
protected:
bool IsOfType(LayoutObjectType type) const final {
NOT_DESTROYED();
return type == kLayoutObjectTableCell ||
LayoutNGBlockFlowMixin<LayoutBlockFlow>::IsOfType(type);
}
......@@ -138,6 +161,7 @@ class CORE_EXPORT LayoutNGTableCell
unsigned ParseColSpanFromDOM() const;
// Use ComputedRowSpan instead
unsigned ParsedRowSpan() const {
NOT_DESTROYED();
if (!has_rowspan_)
return 1;
return ParseRowSpanFromDOM();
......
......@@ -19,6 +19,7 @@ LayoutNGTableCellLegacy::LayoutNGTableCellLegacy(Element* element)
: LayoutNGBlockFlowMixin<LayoutTableCell>(element) {}
void LayoutNGTableCellLegacy::UpdateBlockLayout(bool relayout_children) {
NOT_DESTROYED();
LayoutAnalyzer::BlockScope analyzer(*this);
SetOverrideLogicalWidth(LogicalWidth().ClampNegativeToZero());
......
......@@ -29,6 +29,7 @@ class CORE_EXPORT LayoutNGTableCellLegacy final
protected:
bool IsOfType(LayoutObjectType type) const final {
NOT_DESTROYED();
return type == kLayoutObjectTableCellLegacy ||
LayoutNGBlockFlowMixin<LayoutTableCell>::IsOfType(type);
}
......
......@@ -16,10 +16,12 @@ LayoutNGTableRow::LayoutNGTableRow(Element* element)
: LayoutNGMixin<LayoutBlock>(element) {}
bool LayoutNGTableRow::IsEmpty() const {
NOT_DESTROYED();
return !FirstChild();
}
LayoutNGTable* LayoutNGTableRow::Table() const {
NOT_DESTROYED();
if (LayoutObject* section = Parent()) {
if (LayoutObject* table = section->Parent())
return To<LayoutNGTable>(table);
......@@ -29,6 +31,7 @@ LayoutNGTable* LayoutNGTableRow::Table() const {
void LayoutNGTableRow::AddChild(LayoutObject* child,
LayoutObject* before_child) {
NOT_DESTROYED();
if (LayoutNGTable* table = Table())
table->TableGridStructureChanged();
......@@ -77,6 +80,7 @@ void LayoutNGTableRow::AddChild(LayoutObject* child,
}
void LayoutNGTableRow::RemoveChild(LayoutObject* child) {
NOT_DESTROYED();
if (LayoutNGTable* table = Table())
table->TableGridStructureChanged();
LayoutNGMixin<LayoutBlock>::RemoveChild(child);
......@@ -97,6 +101,7 @@ void LayoutNGTableRow::StyleDidChange(StyleDifference diff,
LayoutBox* LayoutNGTableRow::CreateAnonymousBoxWithSameTypeAs(
const LayoutObject* parent) const {
NOT_DESTROYED();
return LayoutObjectFactory::CreateAnonymousTableRowWithParent(*parent);
}
......@@ -118,6 +123,7 @@ void LayoutNGTableRow::AddVisualOverflowFromBlockChildren() {
}
unsigned LayoutNGTableRow::RowIndex() const {
NOT_DESTROYED();
unsigned index = 0;
for (LayoutObject* child = Parent()->SlowFirstChild(); child;
child = child->NextSibling()) {
......@@ -130,26 +136,32 @@ unsigned LayoutNGTableRow::RowIndex() const {
}
LayoutNGTableCell* LayoutNGTableRow::LastCell() const {
NOT_DESTROYED();
return To<LayoutNGTableCell>(LastChild());
}
LayoutNGTableSectionInterface* LayoutNGTableRow::SectionInterface() const {
NOT_DESTROYED();
return To<LayoutNGTableSection>(Parent());
}
LayoutNGTableRowInterface* LayoutNGTableRow::PreviousRowInterface() const {
NOT_DESTROYED();
return ToInterface<LayoutNGTableRowInterface>(PreviousSibling());
}
LayoutNGTableRowInterface* LayoutNGTableRow::NextRowInterface() const {
NOT_DESTROYED();
return ToInterface<LayoutNGTableRowInterface>(NextSibling());
}
LayoutNGTableCellInterface* LayoutNGTableRow::FirstCellInterface() const {
NOT_DESTROYED();
return ToInterface<LayoutNGTableCellInterface>(FirstChild());
}
LayoutNGTableCellInterface* LayoutNGTableRow::LastCellInterface() const {
NOT_DESTROYED();
return ToInterface<LayoutNGTableCellInterface>(LastChild());
}
......
......@@ -30,7 +30,10 @@ class CORE_EXPORT LayoutNGTableRow : public LayoutNGMixin<LayoutBlock>,
void UpdateBlockLayout(bool relayout_children) override { NOTREACHED(); }
const char* GetName() const override { return "LayoutNGTableRow"; }
const char* GetName() const override {
NOT_DESTROYED();
return "LayoutNGTableRow";
}
void AddChild(LayoutObject* child,
LayoutObject* before_child = nullptr) override;
......@@ -48,10 +51,14 @@ class CORE_EXPORT LayoutNGTableRow : public LayoutNGMixin<LayoutBlock>,
// For simplicity, just conservatively assume all table rows are not opaque.
// Copied from Legacy's LayoutTableRow
bool BackgroundIsKnownToBeOpaqueInRect(const PhysicalRect&) const override {
NOT_DESTROYED();
return false;
}
bool AllowsNonVisibleOverflow() const override { return false; }
bool AllowsNonVisibleOverflow() const override {
NOT_DESTROYED();
return false;
}
void AddVisualOverflowFromBlockChildren() override;
......@@ -64,7 +71,10 @@ class CORE_EXPORT LayoutNGTableRow : public LayoutNGMixin<LayoutBlock>,
// LayoutNGTableRowInterface methods start.
const LayoutObject* ToLayoutObject() const final { return this; }
const LayoutObject* ToLayoutObject() const final {
NOT_DESTROYED();
return this;
}
const LayoutTableRow* ToLayoutTableRow() const final {
NOTREACHED();
......@@ -72,10 +82,12 @@ class CORE_EXPORT LayoutNGTableRow : public LayoutNGMixin<LayoutBlock>,
}
const LayoutNGTableRowInterface* ToLayoutNGTableRowInterface() const final {
NOT_DESTROYED();
return this;
}
LayoutNGTableInterface* TableInterface() const final {
NOT_DESTROYED();
return SectionInterface()->TableInterface();
}
......@@ -97,6 +109,7 @@ class CORE_EXPORT LayoutNGTableRow : public LayoutNGMixin<LayoutBlock>,
LayoutNGTableCell* LastCell() const;
bool IsOfType(LayoutObjectType type) const override {
NOT_DESTROYED();
return type == kLayoutObjectTableRow ||
LayoutNGMixin<LayoutBlock>::IsOfType(type);
}
......
......@@ -15,6 +15,7 @@ LayoutNGTableSection::LayoutNGTableSection(Element* element)
: LayoutNGMixin<LayoutBlock>(element) {}
bool LayoutNGTableSection::IsEmpty() const {
NOT_DESTROYED();
for (LayoutObject* child = FirstChild(); child;
child = child->NextSibling()) {
if (!To<LayoutNGTableRow>(child)->IsEmpty())
......@@ -24,11 +25,13 @@ bool LayoutNGTableSection::IsEmpty() const {
}
LayoutNGTable* LayoutNGTableSection::Table() const {
NOT_DESTROYED();
return To<LayoutNGTable>(Parent());
}
void LayoutNGTableSection::AddChild(LayoutObject* child,
LayoutObject* before_child) {
NOT_DESTROYED();
if (LayoutNGTable* table = Table())
table->TableGridStructureChanged();
......@@ -78,6 +81,7 @@ void LayoutNGTableSection::AddChild(LayoutObject* child,
}
void LayoutNGTableSection::RemoveChild(LayoutObject* child) {
NOT_DESTROYED();
if (LayoutNGTable* table = Table())
table->TableGridStructureChanged();
LayoutNGMixin<LayoutBlock>::RemoveChild(child);
......@@ -98,28 +102,34 @@ void LayoutNGTableSection::StyleDidChange(StyleDifference diff,
LayoutBox* LayoutNGTableSection::CreateAnonymousBoxWithSameTypeAs(
const LayoutObject* parent) const {
NOT_DESTROYED();
return LayoutObjectFactory::CreateAnonymousTableSectionWithParent(*parent);
}
LayoutNGTableInterface* LayoutNGTableSection::TableInterface() const {
NOT_DESTROYED();
return ToInterface<LayoutNGTableInterface>(Parent());
}
void LayoutNGTableSection::SetNeedsCellRecalc() {
NOT_DESTROYED();
SetNeedsLayout(layout_invalidation_reason::kDomChanged);
}
LayoutNGTableRowInterface* LayoutNGTableSection::FirstRowInterface() const {
NOT_DESTROYED();
return ToInterface<LayoutNGTableRowInterface>(FirstChild());
}
LayoutNGTableRowInterface* LayoutNGTableSection::LastRowInterface() const {
NOT_DESTROYED();
return ToInterface<LayoutNGTableRowInterface>(LastChild());
}
const LayoutNGTableCellInterface* LayoutNGTableSection::PrimaryCellInterfaceAt(
unsigned row,
unsigned column) const {
NOT_DESTROYED();
unsigned current_row = 0;
for (LayoutObject* layout_row = FirstChild(); layout_row;
layout_row = layout_row->NextSibling()) {
......@@ -141,12 +151,14 @@ const LayoutNGTableCellInterface* LayoutNGTableSection::PrimaryCellInterfaceAt(
// TODO(crbug.com/1079133): Used by AXLayoutObject::IsDataTable, verify
// behaviour is correct. Consider removing these methods.
unsigned LayoutNGTableSection::NumEffectiveColumns() const {
NOT_DESTROYED();
return To<LayoutNGTable>(TableInterface()->ToLayoutObject())->ColumnCount();
}
// TODO(crbug.com/1079133): Used by AXLayoutObject::IsDataTable/ColumnCount,
// verify behaviour is correct.
unsigned LayoutNGTableSection::NumCols(unsigned row) const {
NOT_DESTROYED();
unsigned current_row = 0;
for (LayoutObject* layout_row = FirstChild(); layout_row;
layout_row = layout_row->NextSibling()) {
......@@ -165,6 +177,7 @@ unsigned LayoutNGTableSection::NumCols(unsigned row) const {
// TODO(crbug.com/1079133): Used by AXLayoutObject, verify behaviour is
// correct, and if caching is required.
unsigned LayoutNGTableSection::NumRows() const {
NOT_DESTROYED();
unsigned num_rows = 0;
for (LayoutObject* layout_row = FirstChild(); layout_row;
layout_row = layout_row->NextSibling()) {
......
......@@ -29,7 +29,10 @@ class CORE_EXPORT LayoutNGTableSection : public LayoutNGMixin<LayoutBlock>,
void UpdateBlockLayout(bool relayout_children) override { NOTREACHED(); }
const char* GetName() const override { return "LayoutNGTableSection"; }
const char* GetName() const override {
NOT_DESTROYED();
return "LayoutNGTableSection";
}
void AddChild(LayoutObject* child,
LayoutObject* before_child = nullptr) override;
......@@ -42,7 +45,10 @@ class CORE_EXPORT LayoutNGTableSection : public LayoutNGMixin<LayoutBlock>,
LayoutBox* CreateAnonymousBoxWithSameTypeAs(
const LayoutObject* parent) const override;
bool AllowsNonVisibleOverflow() const override { return false; }
bool AllowsNonVisibleOverflow() const override {
NOT_DESTROYED();
return false;
}
bool BackgroundIsKnownToBeOpaqueInRect(const PhysicalRect&) const override {
NOT_DESTROYED();
......
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