summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/layout/ng/table/layout_ng_table_section.h
blob: abc4f94c2d60a5b561c126a4e04d1a828359311f (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
// Copyright 2020 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_SECTION_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_TABLE_LAYOUT_NG_TABLE_SECTION_H_

#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/layout/layout_block.h"
#include "third_party/blink/renderer/core/layout/ng/layout_ng_mixin.h"
#include "third_party/blink/renderer/core/layout/ng/table/layout_ng_table_section_interface.h"

namespace blink {

class LayoutNGTable;

// NOTE:
// Every child of LayoutNGTableSection must be LayoutNGTableRow.
class CORE_EXPORT LayoutNGTableSection : public LayoutNGMixin<LayoutBlock>,
                                         public LayoutNGTableSectionInterface {
 public:
  explicit LayoutNGTableSection(Element*);

  bool IsEmpty() const;

  LayoutNGTable* Table() const;

  // LayoutBlock methods start.

  void UpdateBlockLayout(bool relayout_children) override { NOTREACHED(); }

  const char* GetName() const override {
    NOT_DESTROYED();
    return "LayoutNGTableSection";
  }

  void AddChild(LayoutObject* child,
                LayoutObject* before_child = nullptr) override;

  void RemoveChild(LayoutObject*) override;

  void StyleDidChange(StyleDifference diff,
                      const ComputedStyle* old_style) override;

  LayoutBox* CreateAnonymousBoxWithSameTypeAs(
      const LayoutObject* parent) const override;

  bool AllowsNonVisibleOverflow() const override {
    NOT_DESTROYED();
    return false;
  }

  bool BackgroundIsKnownToBeOpaqueInRect(const PhysicalRect&) const override {
    NOT_DESTROYED();
    return false;
  }

  bool VisualRectRespectsVisibility() const final {
    NOT_DESTROYED();
    return false;
  }

  // LayoutBlock methods end.

  // LayoutNGTableSectionInterface methods start.

  const LayoutTableSection* ToLayoutTableSection() const final {
    NOT_DESTROYED();
    DCHECK(false);
    return nullptr;
  }

  const LayoutNGTableSectionInterface* ToLayoutNGTableSectionInterface()
      const final {
    NOT_DESTROYED();
    return this;
  }

  LayoutNGTableSectionInterface* ToLayoutNGTableSectionInterface() {
    NOT_DESTROYED();
    return this;
  }

  const LayoutObject* ToLayoutObject() const final {
    NOT_DESTROYED();
    return this;
  }

  LayoutObject* ToMutableLayoutObject() final {
    NOT_DESTROYED();
    return this;
  }

  LayoutNGTableInterface* TableInterface() const final;

  void SetNeedsCellRecalc() final;

  bool IsRepeatingHeaderGroup() const final {
    NOT_DESTROYED();
    // Used in printing, not used in LayoutNG
    return false;
  }

  bool IsRepeatingFooterGroup() const final {
    NOT_DESTROYED();
    // Used in printing, not used in LayoutNG
    return false;
  }

  unsigned NumRows() const final;

  unsigned NumCols(unsigned) const final;

  unsigned NumEffectiveColumns() const final;

  LayoutNGTableRowInterface* FirstRowInterface() const final;

  LayoutNGTableRowInterface* LastRowInterface() const final;

  // LayoutNGTableSectionInterface methods end.

 protected:
  bool IsOfType(LayoutObjectType type) const override {
    NOT_DESTROYED();
    return type == kLayoutObjectTableSection ||
           LayoutNGMixin<LayoutBlock>::IsOfType(type);
  }
};

// wtf/casting.h helper.
template <>
struct DowncastTraits<LayoutNGTableSection> {
  static bool AllowFrom(const LayoutObject& object) {
    return object.IsTableSection() && object.IsLayoutNGObject();
  }
};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_TABLE_LAYOUT_NG_TABLE_SECTION_H_