]>
Commit | Line | Data |
---|---|---|
a90939db JF |
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, 2007 Apple Inc. All rights reserved. | |
8 | * | |
9 | * This library is free software; you can redistribute it and/or | |
10 | * modify it under the terms of the GNU Library General Public | |
11 | * License as published by the Free Software Foundation; either | |
12 | * version 2 of the License, or (at your option) any later version. | |
13 | * | |
14 | * This library is distributed in the hope that it will be useful, | |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | * Library General Public License for more details. | |
18 | * | |
19 | * You should have received a copy of the GNU Library General Public License | |
20 | * along with this library; see the file COPYING.LIB. If not, write to | |
21 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
22 | * Boston, MA 02110-1301, USA. | |
23 | */ | |
24 | ||
25 | #ifndef RenderTableCell_h | |
26 | #define RenderTableCell_h | |
27 | ||
28 | #include "RenderTableSection.h" | |
29 | ||
30 | namespace WebCore { | |
31 | ||
32 | class RenderTableCell : public RenderBlock { | |
33 | public: | |
34 | RenderTableCell(Node*); | |
35 | ||
36 | virtual const char* renderName() const { return isAnonymous() ? "RenderTableCell (anonymous)" : "RenderTableCell"; } | |
37 | ||
38 | virtual bool isTableCell() const { return true; } | |
39 | ||
40 | virtual void destroy(); | |
41 | ||
42 | // FIXME: need to implement cellIndex | |
43 | int cellIndex() const { return 0; } | |
44 | void setCellIndex(int) { } | |
45 | ||
46 | int colSpan() const { return m_columnSpan; } | |
47 | void setColSpan(int c) { m_columnSpan = c; } | |
48 | ||
49 | int rowSpan() const { return m_rowSpan; } | |
50 | void setRowSpan(int r) { m_rowSpan = r; } | |
51 | ||
52 | int col() const { return m_column; } | |
53 | void setCol(int col) { m_column = col; } | |
54 | int row() const { return m_row; } | |
55 | void setRow(int row) { m_row = row; } | |
56 | ||
57 | RenderTableSection* section() const { return static_cast<RenderTableSection*>(parent()->parent()); } | |
58 | RenderTable* table() const { return static_cast<RenderTable*>(parent()->parent()->parent()); } | |
59 | ||
60 | Length styleOrColWidth() const; | |
61 | ||
62 | virtual bool requiresLayer() const { return isPositioned() || isTransparent() || hasOverflowClip() || hasTransform() || hasMask() || hasReflection(); } | |
63 | ||
64 | virtual void calcPrefWidths(); | |
65 | virtual void calcWidth(); | |
66 | void updateWidth(int); | |
67 | ||
68 | int borderLeft() const; | |
69 | int borderRight() const; | |
70 | int borderTop() const; | |
71 | int borderBottom() const; | |
72 | ||
73 | int borderHalfLeft(bool outer) const; | |
74 | int borderHalfRight(bool outer) const; | |
75 | int borderHalfTop(bool outer) const; | |
76 | int borderHalfBottom(bool outer) const; | |
77 | ||
78 | CollapsedBorderValue collapsedLeftBorder(bool rtl) const; | |
79 | CollapsedBorderValue collapsedRightBorder(bool rtl) const; | |
80 | CollapsedBorderValue collapsedTopBorder() const; | |
81 | CollapsedBorderValue collapsedBottomBorder() const; | |
82 | ||
83 | typedef Vector<CollapsedBorderValue, 100> CollapsedBorderStyles; | |
84 | void collectBorderStyles(CollapsedBorderStyles&) const; | |
85 | static void sortBorderStyles(CollapsedBorderStyles&); | |
86 | ||
87 | virtual void updateFromElement(); | |
88 | ||
89 | virtual void layout(); | |
90 | ||
91 | virtual void paint(PaintInfo&, int tx, int ty); | |
92 | virtual void paintBoxDecorations(PaintInfo&, int tx, int ty); | |
93 | virtual void paintMask(PaintInfo& paintInfo, int tx, int ty); | |
94 | void paintCollapsedBorder(GraphicsContext*, int x, int y, int w, int h); | |
95 | void paintBackgroundsBehindCell(PaintInfo&, int tx, int ty, RenderObject* backgroundObject); | |
96 | ||
97 | virtual IntRect clippedOverflowRectForRepaint(RenderBox* repaintContainer); | |
98 | virtual void computeRectForRepaint(RenderBox* repaintContainer, IntRect&, bool fixed = false); | |
99 | ||
100 | virtual int baselinePosition(bool firstLine = false, bool isRootLineBox = false) const; | |
101 | ||
102 | void setIntrinsicPaddingTop(int p) { m_intrinsicPaddingTop = p; } | |
103 | void setIntrinsicPaddingBottom(int p) { m_intrinsicPaddingBottom = p; } | |
104 | void setIntrinsicPadding(int top, int bottom) { setIntrinsicPaddingTop(top); setIntrinsicPaddingBottom(bottom); } | |
105 | void clearIntrinsicPadding() { setIntrinsicPadding(0, 0); } | |
106 | ||
107 | int intrinsicPaddingTop() const { return m_intrinsicPaddingTop; } | |
108 | int intrinsicPaddingBottom() const { return m_intrinsicPaddingBottom; } | |
109 | ||
110 | virtual int paddingTop(bool includeIntrinsicPadding = true) const; | |
111 | virtual int paddingBottom(bool includeIntrinsicPadding = true) const; | |
112 | ||
113 | virtual void setOverrideSize(int); | |
114 | ||
115 | protected: | |
116 | virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle); | |
117 | virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); | |
118 | ||
119 | virtual void mapLocalToContainer(RenderBox* repaintContainer, bool useTransforms, bool fixed, TransformState&) const; | |
120 | virtual void mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState&) const; | |
121 | ||
122 | private: | |
123 | int m_row; | |
124 | int m_column; | |
125 | int m_rowSpan; | |
126 | int m_columnSpan; | |
127 | int m_intrinsicPaddingTop; | |
128 | int m_intrinsicPaddingBottom; | |
129 | int m_percentageHeight; | |
130 | }; | |
131 | ||
132 | } // namespace WebCore | |
133 | ||
134 | #endif // RenderTableCell_h |