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