summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/layout/ng/table/layout_ng_table_interface.h
blob: f600a05afc924f15dc777c9fca8cb3000a118140 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_TABLE_LAYOUT_NG_TABLE_INTERFACE_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_TABLE_LAYOUT_NG_TABLE_INTERFACE_H_

#include "third_party/blink/renderer/core/layout/ng/table/interface_casting.h"

namespace blink {

class LayoutNGTableCellInterface;
class LayoutNGTableSectionInterface;
class LayoutUnit;

// Abstract class defining table methods.
// Used for Legacy/NG interoperability.
enum SkipEmptySectionsValue { kDoNotSkipEmptySections, kSkipEmptySections };

class LayoutNGTableInterface {
 public:
  virtual const LayoutObject* ToLayoutObject() const = 0;
  // Non-const version required by TextAutosizer, AXLayoutObject.
  virtual LayoutObject* ToMutableLayoutObject() = 0;
  virtual bool ShouldCollapseBorders() const = 0;
  // TODO(crbug.com/1081425) Method not used by NG, should be removed.
  virtual bool HasCollapsedBorders() const = 0;
  virtual bool IsFixedTableLayout() const = 0;
  virtual int16_t HBorderSpacing() const = 0;
  virtual int16_t VBorderSpacing() const = 0;
  // TODO(crbug.com/1081425) Method not used by NG, should be removed.
  virtual bool HasColElements() const = 0;
  virtual unsigned AbsoluteColumnToEffectiveColumn(
      unsigned absolute_column_index) const = 0;
  virtual void RecalcSectionsIfNeeded() const = 0;
  virtual void ForceSectionsRecalc() = 0;
  // TODO(crbug.com/1081425) Method not used by NG, should be removed.
  virtual LayoutUnit RowOffsetFromRepeatingFooter() const = 0;
  // TODO(crbug.com/1081425) Method not used by NG, should be removed.
  virtual LayoutUnit RowOffsetFromRepeatingHeader() const = 0;
  virtual LayoutNGTableSectionInterface* FirstBodyInterface() const = 0;
  virtual LayoutNGTableSectionInterface* TopSectionInterface() const = 0;
  // TODO(crbug.com/1081425) Method not used by NG, should be removed.
  virtual LayoutNGTableSectionInterface* TopNonEmptySectionInterface()
      const = 0;
  // TODO(crbug.com/1081425) Method not used by NG, should be removed.
  virtual LayoutNGTableSectionInterface* BottomSectionInterface() const = 0;
  virtual LayoutNGTableSectionInterface* BottomNonEmptySectionInterface()
      const = 0;
  virtual LayoutNGTableSectionInterface* SectionBelowInterface(
      const LayoutNGTableSectionInterface*,
      SkipEmptySectionsValue) const = 0;
  virtual bool IsFirstCell(const LayoutNGTableCellInterface&) const = 0;
};

template <>
struct InterfaceDowncastTraits<LayoutNGTableInterface> {
  static bool AllowFrom(const LayoutObject& object) { return object.IsTable(); }
  static const LayoutNGTableInterface& ConvertFrom(const LayoutObject& object) {
    return *object.ToLayoutNGTableInterface();
  }
};

}  // namespace blink
#endif  // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_TABLE_LAYOUT_NG_TABLE_INTERFACE_H_