Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / rendering / RenderTableCol.h
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)
9  *
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.
14  *
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.
19  *
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.
24  */
25
26 #ifndef RenderTableCol_h
27 #define RenderTableCol_h
28
29 #include "core/rendering/RenderBox.h"
30
31 namespace blink {
32
33 class RenderTable;
34 class RenderTableCell;
35
36 class RenderTableCol final : public RenderBox {
37 public:
38     explicit RenderTableCol(Element*);
39     virtual void trace(Visitor*) override;
40
41     RenderObject* firstChild() const { ASSERT(children() == virtualChildren()); return children()->firstChild(); }
42
43     // If you have a RenderTableCol, use firstChild or lastChild instead.
44     void slowFirstChild() const WTF_DELETED_FUNCTION;
45     void slowLastChild() const WTF_DELETED_FUNCTION;
46
47     const RenderObjectChildList* children() const { return &m_children; }
48     RenderObjectChildList* children() { return &m_children; }
49
50     void clearPreferredLogicalWidthsDirtyBits();
51
52     unsigned span() const { return m_span; }
53
54     bool isTableColumnGroupWithColumnChildren() { return firstChild(); }
55     bool isTableColumn() const { return style()->display() == TABLE_COLUMN; }
56     bool isTableColumnGroup() const { return style()->display() == TABLE_COLUMN_GROUP; }
57
58     RenderTableCol* enclosingColumnGroup() const;
59     RenderTableCol* enclosingColumnGroupIfAdjacentBefore() const
60     {
61         if (previousSibling())
62             return 0;
63         return enclosingColumnGroup();
64     }
65
66     RenderTableCol* enclosingColumnGroupIfAdjacentAfter() const
67     {
68         if (nextSibling())
69             return 0;
70         return enclosingColumnGroup();
71     }
72
73
74     // Returns the next column or column-group.
75     RenderTableCol* nextColumn() const;
76
77     const BorderValue& borderAdjoiningCellStartBorder(const RenderTableCell*) const;
78     const BorderValue& borderAdjoiningCellEndBorder(const RenderTableCell*) const;
79     const BorderValue& borderAdjoiningCellBefore(const RenderTableCell*) const;
80     const BorderValue& borderAdjoiningCellAfter(const RenderTableCell*) const;
81
82 private:
83     virtual RenderObjectChildList* virtualChildren() override { return children(); }
84     virtual const RenderObjectChildList* virtualChildren() const override { return children(); }
85
86     virtual const char* renderName() const override { return "RenderTableCol"; }
87     virtual bool isOfType(RenderObjectType type) const override { return type == RenderObjectRenderTableCol || RenderBox::isOfType(type); }
88     virtual void updateFromElement() override;
89     virtual void computePreferredLogicalWidths() override { ASSERT_NOT_REACHED(); }
90
91     virtual void insertedIntoTree() override;
92     virtual void willBeRemovedFromTree() override;
93
94     virtual bool isChildAllowed(RenderObject*, RenderStyle*) const override;
95     virtual bool canHaveChildren() const override;
96     virtual LayerType layerTypeRequired() const override { return NoLayer; }
97
98     virtual LayoutRect clippedOverflowRectForPaintInvalidation(const RenderLayerModelObject* paintInvalidationContainer, const PaintInvalidationState* = 0) const override;
99     virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) override;
100
101     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
102
103     RenderTable* table() const;
104
105     RenderObjectChildList m_children;
106     unsigned m_span;
107 };
108
109 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderTableCol, isRenderTableCol());
110
111 }
112
113 #endif