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.
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 RenderTableRow_h
26 #define RenderTableRow_h
28 #include "RenderTableSection.h"
32 static const unsigned unsetRowIndex = 0x7FFFFFFF;
33 static const unsigned maxRowIndex = 0x7FFFFFFE; // 2,147,483,646
35 class RenderTableRow : public RenderBox {
37 explicit RenderTableRow(Node*);
39 const RenderObjectChildList* children() const { return &m_children; }
40 RenderObjectChildList* children() { return &m_children; }
42 RenderTableSection* section() const { return toRenderTableSection(parent()); }
43 RenderTable* table() const { return toRenderTable(parent()->parent()); }
45 void updateBeforeAndAfterContent();
46 void paintOutlineForRowIfNeeded(PaintInfo&, const LayoutPoint&);
48 static RenderTableRow* createAnonymousWithParentRenderer(const RenderObject*);
49 virtual RenderBox* createAnonymousBoxWithSameTypeAs(const RenderObject* parent) const OVERRIDE
51 return createAnonymousWithParentRenderer(parent);
54 void setRowIndex(unsigned rowIndex)
56 if (UNLIKELY(rowIndex > maxRowIndex))
59 m_rowIndex = rowIndex;
62 bool rowIndexWasSet() const { return m_rowIndex != unsetRowIndex; }
63 unsigned rowIndex() const
65 ASSERT(rowIndexWasSet());
69 const BorderValue& borderAdjoiningTableStart() const
71 if (section()->hasSameDirectionAsTable())
72 return style()->borderStart();
74 return style()->borderEnd();
77 const BorderValue& borderAdjoiningTableEnd() const
79 if (section()->hasSameDirectionAsTable())
80 return style()->borderEnd();
82 return style()->borderStart();
86 virtual RenderObjectChildList* virtualChildren() { return children(); }
87 virtual const RenderObjectChildList* virtualChildren() const { return children(); }
89 virtual const char* renderName() const { return isAnonymous() ? "RenderTableRow (anonymous)" : "RenderTableRow"; }
91 virtual bool isTableRow() const { return true; }
93 virtual void willBeDestroyed();
95 virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0);
96 virtual void layout();
97 virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const;
98 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE;
100 virtual bool requiresLayer() const OVERRIDE { return isTransparent() || hasClipPath() || hasOverflowClip() || hasTransform() || hasHiddenBackface() || hasMask() || hasFilter(); }
102 virtual void paint(PaintInfo&, const LayoutPoint&);
104 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0);
106 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
108 RenderObjectChildList m_children;
109 unsigned m_rowIndex : 31;
112 inline RenderTableRow* toRenderTableRow(RenderObject* object)
114 ASSERT(!object || object->isTableRow());
115 return static_cast<RenderTableRow*>(object);
118 inline const RenderTableRow* toRenderTableRow(const RenderObject* object)
120 ASSERT(!object || object->isTableRow());
121 return static_cast<const RenderTableRow*>(object);
124 // This will catch anyone doing an unnecessary cast.
125 void toRenderTableRow(const RenderTableRow*);
127 } // namespace WebCore
129 #endif // RenderTableRow_h