]>
git.saurik.com Git - iphone-api.git/blob - WebCore/RenderTableCell.h
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.
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.
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.
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.
25 #ifndef RenderTableCell_h
26 #define RenderTableCell_h
28 #include "RenderTableSection.h"
32 class RenderTableCell
: public RenderBlock
{
34 RenderTableCell(Node
*);
36 virtual const char* renderName() const { return isAnonymous() ? "RenderTableCell (anonymous)" : "RenderTableCell"; }
38 virtual bool isTableCell() const { return true; }
40 virtual void destroy();
42 // FIXME: need to implement cellIndex
43 int cellIndex() const { return 0; }
44 void setCellIndex(int) { }
46 int colSpan() const { return m_columnSpan
; }
47 void setColSpan(int c
) { m_columnSpan
= c
; }
49 int rowSpan() const { return m_rowSpan
; }
50 void setRowSpan(int r
) { m_rowSpan
= r
; }
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
; }
57 RenderTableSection
* section() const { return static_cast<RenderTableSection
*>(parent()->parent()); }
58 RenderTable
* table() const { return static_cast<RenderTable
*>(parent()->parent()->parent()); }
60 Length
styleOrColWidth() const;
62 virtual bool requiresLayer() const { return isPositioned() || isTransparent() || hasOverflowClip() || hasTransform() || hasMask() || hasReflection(); }
64 virtual void calcPrefWidths();
65 virtual void calcWidth();
66 void updateWidth(int);
68 int borderLeft() const;
69 int borderRight() const;
70 int borderTop() const;
71 int borderBottom() const;
73 int borderHalfLeft(bool outer
) const;
74 int borderHalfRight(bool outer
) const;
75 int borderHalfTop(bool outer
) const;
76 int borderHalfBottom(bool outer
) const;
78 CollapsedBorderValue
collapsedLeftBorder(bool rtl
) const;
79 CollapsedBorderValue
collapsedRightBorder(bool rtl
) const;
80 CollapsedBorderValue
collapsedTopBorder() const;
81 CollapsedBorderValue
collapsedBottomBorder() const;
83 typedef Vector
<CollapsedBorderValue
, 100> CollapsedBorderStyles
;
84 void collectBorderStyles(CollapsedBorderStyles
&) const;
85 static void sortBorderStyles(CollapsedBorderStyles
&);
87 virtual void updateFromElement();
89 virtual void layout();
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
);
97 virtual IntRect
clippedOverflowRectForRepaint(RenderBox
* repaintContainer
);
98 virtual void computeRectForRepaint(RenderBox
* repaintContainer
, IntRect
&, bool fixed
= false);
100 virtual int baselinePosition(bool firstLine
= false, bool isRootLineBox
= false) const;
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); }
107 int intrinsicPaddingTop() const { return m_intrinsicPaddingTop
; }
108 int intrinsicPaddingBottom() const { return m_intrinsicPaddingBottom
; }
110 virtual int paddingTop(bool includeIntrinsicPadding
= true) const;
111 virtual int paddingBottom(bool includeIntrinsicPadding
= true) const;
113 virtual void setOverrideSize(int);
116 virtual void styleWillChange(StyleDifference
, const RenderStyle
* newStyle
);
117 virtual void styleDidChange(StyleDifference
, const RenderStyle
* oldStyle
);
119 virtual void mapLocalToContainer(RenderBox
* repaintContainer
, bool useTransforms
, bool fixed
, TransformState
&) const;
120 virtual void mapAbsoluteToLocalPoint(bool fixed
, bool useTransforms
, TransformState
&) const;
127 int m_intrinsicPaddingTop
;
128 int m_intrinsicPaddingBottom
;
129 int m_percentageHeight
;
132 } // namespace WebCore
134 #endif // RenderTableCell_h