]> git.saurik.com Git - iphone-api.git/blob - WebCore/RenderTableSection.h
Add support for new WinterBoard Settings features.
[iphone-api.git] / WebCore / RenderTableSection.h
1 /*
2 * This file is part of the DOM implementation for KDE.
3 *
4 * Copyright (C) 1997 Martin Jones (mjones@kde.org)
5 * (C) 1997 Torben Weis (weis@kde.org)
6 * (C) 1998 Waldo Bastian (bastian@kde.org)
7 * (C) 1999 Lars Knoll (knoll@kde.org)
8 * (C) 1999 Antti Koivisto (koivisto@kde.org)
9 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
20 *
21 * You should have received a copy of the GNU Library General Public License
22 * along with this library; see the file COPYING.LIB. If not, write to
23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 * Boston, MA 02110-1301, USA.
25 */
26
27 #ifndef RenderTableSection_h
28 #define RenderTableSection_h
29
30 #include "RenderTable.h"
31 #include <wtf/Vector.h>
32
33 namespace WebCore {
34
35 class RenderTableCell;
36 class RenderTableRow;
37
38 class RenderTableSection : public RenderContainer {
39 public:
40 RenderTableSection(Node*);
41 ~RenderTableSection();
42
43 virtual const char* renderName() const { return isAnonymous() ? "RenderTableSection (anonymous)" : "RenderTableSection"; }
44
45 virtual bool isTableSection() const { return true; }
46
47 virtual void destroy();
48
49 virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0);
50
51 virtual int getBaselineOfFirstLineBox() const;
52
53 void addCell(RenderTableCell*, RenderTableRow* row);
54
55 void setCellWidths();
56 int calcRowHeight();
57 int layoutRows(int height);
58
59 RenderTable* table() const { return static_cast<RenderTable*>(parent()); }
60
61 struct CellStruct {
62 RenderTableCell* cell;
63 bool inColSpan; // true for columns after the first in a colspan
64 };
65
66 typedef Vector<CellStruct> Row;
67
68 struct RowStruct {
69 Row* row;
70 RenderTableRow* rowRenderer;
71 int baseline;
72 Length height;
73 };
74
75 CellStruct& cellAt(int row, int col) { return (*m_grid[row].row)[col]; }
76 const CellStruct& cellAt(int row, int col) const { return (*m_grid[row].row)[col]; }
77
78 void appendColumn(int pos);
79 void splitColumn(int pos, int newSize);
80
81 virtual int overflowWidth(bool includeInterior = true) const { return (!includeInterior && hasOverflowClip()) ? width() : m_overflowWidth; }
82 virtual int overflowLeft(bool includeInterior = true) const { return (!includeInterior && hasOverflowClip()) ? 0 : m_overflowLeft; }
83 virtual int overflowHeight(bool includeInterior = true) const { return (!includeInterior && hasOverflowClip()) ? height() : m_overflowHeight; }
84 virtual int overflowTop(bool includeInterior = true) const { return (!includeInterior && hasOverflowClip()) ? 0 : m_overflowTop; }
85
86 virtual int lowestPosition(bool includeOverflowInterior, bool includeSelf) const;
87 virtual int rightmostPosition(bool includeOverflowInterior, bool includeSelf) const;
88 virtual int leftmostPosition(bool includeOverflowInterior, bool includeSelf) const;
89
90 int calcOuterBorderTop() const;
91 int calcOuterBorderBottom() const;
92 int calcOuterBorderLeft(bool rtl) const;
93 int calcOuterBorderRight(bool rtl) const;
94 void recalcOuterBorder();
95
96 int outerBorderTop() const { return m_outerBorderTop; }
97 int outerBorderBottom() const { return m_outerBorderBottom; }
98 int outerBorderLeft() const { return m_outerBorderLeft; }
99 int outerBorderRight() const { return m_outerBorderRight; }
100
101 virtual void paint(PaintInfo&, int tx, int ty);
102 virtual void paintObject(PaintInfo&, int tx, int ty);
103
104 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0);
105
106 int numRows() const { return m_gridRows; }
107 int numColumns() const;
108 void recalcCells();
109 void recalcCellsIfNeeded()
110 {
111 if (m_needsCellRecalc)
112 recalcCells();
113 }
114
115 bool needsCellRecalc() const { return m_needsCellRecalc; }
116 void setNeedsCellRecalc()
117 {
118 m_needsCellRecalc = true;
119 table()->setNeedsSectionRecalc();
120 }
121
122 int getBaseline(int row) { return m_grid[row].baseline; }
123
124 virtual RenderObject* removeChildNode(RenderObject*, bool fullRemove = true);
125
126 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
127
128 private:
129 virtual int lineHeight(bool, bool) const { return 0; }
130 virtual void position(InlineBox*) { }
131
132 bool ensureRows(int);
133 void clearGrid();
134
135 Vector<RowStruct> m_grid;
136 int m_gridRows;
137 Vector<int> m_rowPos;
138
139 // the current insertion position
140 int m_cCol;
141 int m_cRow;
142 bool m_needsCellRecalc;
143
144 int m_outerBorderLeft;
145 int m_outerBorderRight;
146 int m_outerBorderTop;
147 int m_outerBorderBottom;
148 int m_overflowLeft;
149 int m_overflowWidth;
150 int m_overflowTop;
151 int m_overflowHeight;
152 bool m_hasOverflowingCell;
153 };
154
155 } // namespace WebCore
156
157 #endif // RenderTableSection_h