• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
firstChild()41     RenderObject* firstChild() const { ASSERT(children() == virtualChildren()); return children()->firstChild(); }
lastChild()42     RenderObject* lastChild() const { ASSERT(children() == virtualChildren()); return children()->lastChild(); }
43 
44     // If you have a RenderTableCol, use firstChild or lastChild instead.
45     void slowFirstChild() const WTF_DELETED_FUNCTION;
46     void slowLastChild() const WTF_DELETED_FUNCTION;
47 
children()48     const RenderObjectChildList* children() const { return &m_children; }
children()49     RenderObjectChildList* children() { return &m_children; }
50 
51     void clearPreferredLogicalWidthsDirtyBits();
52 
span()53     unsigned span() const { return m_span; }
setSpan(unsigned span)54     void setSpan(unsigned span) { m_span = span; }
55 
isTableColumnGroupWithColumnChildren()56     bool isTableColumnGroupWithColumnChildren() { return firstChild(); }
isTableColumn()57     bool isTableColumn() const { return style()->display() == TABLE_COLUMN; }
isTableColumnGroup()58     bool isTableColumnGroup() const { return style()->display() == TABLE_COLUMN_GROUP; }
59 
60     RenderTableCol* enclosingColumnGroup() const;
enclosingColumnGroupIfAdjacentBefore()61     RenderTableCol* enclosingColumnGroupIfAdjacentBefore() const
62     {
63         if (previousSibling())
64             return 0;
65         return enclosingColumnGroup();
66     }
67 
enclosingColumnGroupIfAdjacentAfter()68     RenderTableCol* enclosingColumnGroupIfAdjacentAfter() const
69     {
70         if (nextSibling())
71             return 0;
72         return enclosingColumnGroup();
73     }
74 
75 
76     // Returns the next column or column-group.
77     RenderTableCol* nextColumn() const;
78 
79     const BorderValue& borderAdjoiningCellStartBorder(const RenderTableCell*) const;
80     const BorderValue& borderAdjoiningCellEndBorder(const RenderTableCell*) const;
81     const BorderValue& borderAdjoiningCellBefore(const RenderTableCell*) const;
82     const BorderValue& borderAdjoiningCellAfter(const RenderTableCell*) const;
83 
84 private:
virtualChildren()85     virtual RenderObjectChildList* virtualChildren() OVERRIDE { return children(); }
virtualChildren()86     virtual const RenderObjectChildList* virtualChildren() const OVERRIDE { return children(); }
87 
renderName()88     virtual const char* renderName() const OVERRIDE { return "RenderTableCol"; }
isRenderTableCol()89     virtual bool isRenderTableCol() const OVERRIDE { return true; }
90     virtual void updateFromElement() OVERRIDE;
computePreferredLogicalWidths()91     virtual void computePreferredLogicalWidths() OVERRIDE { ASSERT_NOT_REACHED(); }
92 
93     virtual void insertedIntoTree() OVERRIDE;
94     virtual void willBeRemovedFromTree() OVERRIDE;
95 
96     virtual bool isChildAllowed(RenderObject*, RenderStyle*) const OVERRIDE;
97     virtual bool canHaveChildren() const OVERRIDE;
layerTypeRequired()98     virtual LayerType layerTypeRequired() const OVERRIDE { return NoLayer; }
99 
100     virtual LayoutRect clippedOverflowRectForPaintInvalidation(const RenderLayerModelObject* paintInvalidationContainer, const PaintInvalidationState* = 0) const OVERRIDE;
101     virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) OVERRIDE;
102 
103     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OVERRIDE;
104 
105     RenderTable* table() const;
106 
107     RenderObjectChildList m_children;
108     unsigned m_span;
109 };
110 
111 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderTableCol, isRenderTableCol());
112 
113 }
114 
115 #endif
116