Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / core / layout / LayoutTableCol.h
blob081b432c31c465404ea9ec55bd1526bb77b3e986
1 /*
2 * Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 * (C) 1997 Torben Weis (weis@kde.org)
4 * (C) 1998 Waldo Bastian (bastian@kde.org)
5 * (C) 1999 Lars Knoll (knoll@kde.org)
6 * (C) 1999 Antti Koivisto (koivisto@kde.org)
7 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved.
8 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Library General Public
12 * License as published by the Free Software Foundation; either
13 * version 2 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Library General Public License for more details.
20 * You should have received a copy of the GNU Library General Public License
21 * along with this library; see the file COPYING.LIB. If not, write to
22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 * Boston, MA 02110-1301, USA.
26 #ifndef LayoutTableCol_h
27 #define LayoutTableCol_h
29 #include "core/layout/LayoutBox.h"
31 namespace blink {
33 class LayoutTable;
34 class LayoutTableCell;
36 // LayoutTableCol is used to represent table column or column groups
37 // (display: table-column and display: table-column-group).
39 // The reason to use the same LayoutObject is that both objects behave in a very
40 // similar way. The main difference between the 2 is that table-column-group
41 // allows table-column children, when table-column don't.
42 // Note that this matches how <col> and <colgroup> map to the same class:
43 // HTMLTableColElement.
45 // In HTML and CSS, table columns and colgroups don't own the cells, they are
46 // descendants of the rows.
47 // As such table columns and colgroups have a very limited scope in the table:
48 // - column / cell sizing (the 'width' property)
49 // - background painting (the 'background' property).
50 // - border collapse resolution
51 // (http://www.w3.org/TR/CSS21/tables.html#border-conflict-resolution)
53 // See http://www.w3.org/TR/CSS21/tables.html#columns for the standard.
54 // Note that we don't implement the "visibility: collapse" inheritance to the
55 // cells.
57 // Because table columns and column groups are placeholder elements (see
58 // previous paragraph), they are never laid out and layout() should not be
59 // called on them.
60 class LayoutTableCol final : public LayoutBox {
61 public:
62 explicit LayoutTableCol(Element*);
64 LayoutObject* firstChild() const { ASSERT(children() == virtualChildren()); return children()->firstChild(); }
66 // If you have a LayoutTableCol, use firstChild or lastChild instead.
67 void slowFirstChild() const = delete;
68 void slowLastChild() const = delete;
70 const LayoutObjectChildList* children() const { return &m_children; }
71 LayoutObjectChildList* children() { return &m_children; }
73 void clearPreferredLogicalWidthsDirtyBits();
75 // The 'span' attribute in HTML.
76 // For CSS table columns or colgroups, this is always 1.
77 unsigned span() const { return m_span; }
79 bool isTableColumnGroupWithColumnChildren() { return firstChild(); }
80 bool isTableColumn() const { return style()->display() == TABLE_COLUMN; }
81 bool isTableColumnGroup() const { return style()->display() == TABLE_COLUMN_GROUP; }
83 LayoutTableCol* enclosingColumnGroup() const;
84 LayoutTableCol* enclosingColumnGroupIfAdjacentBefore() const
86 if (previousSibling())
87 return nullptr;
88 return enclosingColumnGroup();
91 LayoutTableCol* enclosingColumnGroupIfAdjacentAfter() const
93 if (nextSibling())
94 return nullptr;
95 return enclosingColumnGroup();
99 // Returns the next column or column-group.
100 LayoutTableCol* nextColumn() const;
102 const BorderValue& borderAdjoiningCellStartBorder(const LayoutTableCell*) const;
103 const BorderValue& borderAdjoiningCellEndBorder(const LayoutTableCell*) const;
104 const BorderValue& borderAdjoiningCellBefore(const LayoutTableCell*) const;
105 const BorderValue& borderAdjoiningCellAfter(const LayoutTableCell*) const;
107 const char* name() const override { return "LayoutTableCol"; }
109 private:
110 LayoutObjectChildList* virtualChildren() override { return children(); }
111 const LayoutObjectChildList* virtualChildren() const override { return children(); }
113 bool isOfType(LayoutObjectType type) const override { return type == LayoutObjectLayoutTableCol || LayoutBox::isOfType(type); }
114 void updateFromElement() override;
115 void computePreferredLogicalWidths() override { ASSERT_NOT_REACHED(); }
117 void insertedIntoTree() override;
118 void willBeRemovedFromTree() override;
120 bool isChildAllowed(LayoutObject*, const ComputedStyle&) const override;
121 bool canHaveChildren() const override;
122 DeprecatedPaintLayerType layerTypeRequired() const override { return NoDeprecatedPaintLayer; }
124 LayoutRect clippedOverflowRectForPaintInvalidation(const LayoutBoxModelObject* paintInvalidationContainer, const PaintInvalidationState* = nullptr) const override;
125 void imageChanged(WrappedImagePtr, const IntRect* = nullptr) override;
127 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override;
129 LayoutTable* table() const;
131 LayoutObjectChildList m_children;
132 unsigned m_span;
135 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTableCol, isLayoutTableCol());
139 #endif