1 // Copyright 2019 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_TABLE_LAYOUT_NG_TABLE_INTERFACE_H_ 6 #define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_TABLE_LAYOUT_NG_TABLE_INTERFACE_H_ 7 8 #include "third_party/blink/renderer/core/layout/ng/table/interface_casting.h" 9 10 namespace blink { 11 12 class LayoutNGTableCellInterface; 13 class LayoutNGTableSectionInterface; 14 class LayoutUnit; 15 16 // Abstract class defining table methods. 17 // Used for Legacy/NG interoperability. 18 enum SkipEmptySectionsValue { kDoNotSkipEmptySections, kSkipEmptySections }; 19 20 class LayoutNGTableInterface { 21 public: 22 virtual const LayoutObject* ToLayoutObject() const = 0; 23 // Non-const version required by TextAutosizer, AXLayoutObject. 24 virtual LayoutObject* ToMutableLayoutObject() = 0; 25 virtual bool ShouldCollapseBorders() const = 0; 26 // TODO(crbug.com/1081425) Method not used by NG, should be removed. 27 virtual bool HasCollapsedBorders() const = 0; 28 virtual bool IsFixedTableLayout() const = 0; 29 virtual int16_t HBorderSpacing() const = 0; 30 virtual int16_t VBorderSpacing() const = 0; 31 // TODO(crbug.com/1081425) Method not used by NG, should be removed. 32 virtual bool HasColElements() const = 0; 33 virtual unsigned AbsoluteColumnToEffectiveColumn( 34 unsigned absolute_column_index) const = 0; 35 virtual void RecalcSectionsIfNeeded() const = 0; 36 virtual void ForceSectionsRecalc() = 0; 37 // TODO(crbug.com/1081425) Method not used by NG, should be removed. 38 virtual LayoutUnit RowOffsetFromRepeatingFooter() const = 0; 39 // TODO(crbug.com/1081425) Method not used by NG, should be removed. 40 virtual LayoutUnit RowOffsetFromRepeatingHeader() const = 0; 41 virtual LayoutNGTableSectionInterface* FirstBodyInterface() const = 0; 42 virtual LayoutNGTableSectionInterface* TopSectionInterface() const = 0; 43 // TODO(crbug.com/1081425) Method not used by NG, should be removed. 44 virtual LayoutNGTableSectionInterface* TopNonEmptySectionInterface() 45 const = 0; 46 // TODO(crbug.com/1081425) Method not used by NG, should be removed. 47 virtual LayoutNGTableSectionInterface* BottomSectionInterface() const = 0; 48 virtual LayoutNGTableSectionInterface* BottomNonEmptySectionInterface() 49 const = 0; 50 virtual LayoutNGTableSectionInterface* SectionBelowInterface( 51 const LayoutNGTableSectionInterface*, 52 SkipEmptySectionsValue) const = 0; 53 virtual bool IsFirstCell(const LayoutNGTableCellInterface&) const = 0; 54 }; 55 56 template <> 57 struct InterfaceDowncastTraits<LayoutNGTableInterface> { 58 static bool AllowFrom(const LayoutObject& object) { return object.IsTable(); } 59 static const LayoutNGTableInterface& ConvertFrom(const LayoutObject& object) { 60 return *object.ToLayoutNGTableInterface(); 61 } 62 }; 63 64 } // namespace blink 65 #endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_TABLE_LAYOUT_NG_TABLE_INTERFACE_H_ 66