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 "core/rendering/RenderTableSection.h"
32 static const unsigned unsetRowIndex = 0x7FFFFFFF;
33 static const unsigned maxRowIndex = 0x7FFFFFFE; // 2,147,483,646
35 class RenderTableRow FINAL : public RenderBox {
37 explicit RenderTableRow(Element*);
39 RenderObject* firstChild() const { ASSERT(children() == virtualChildren()); return children()->firstChild(); }
40 RenderObject* lastChild() const { ASSERT(children() == virtualChildren()); return children()->lastChild(); }
42 const RenderObjectChildList* children() const { return &m_children; }
43 RenderObjectChildList* children() { return &m_children; }
45 RenderTableSection* section() const { return toRenderTableSection(parent()); }
46 RenderTable* table() const { return toRenderTable(parent()->parent()); }
48 void paintOutlineForRowIfNeeded(PaintInfo&, const LayoutPoint&);
50 static RenderTableRow* createAnonymous(Document*);
51 static RenderTableRow* createAnonymousWithParentRenderer(const RenderObject*);
52 virtual RenderBox* createAnonymousBoxWithSameTypeAs(const RenderObject* parent) const OVERRIDE
54 return createAnonymousWithParentRenderer(parent);
57 void setRowIndex(unsigned rowIndex)
59 if (UNLIKELY(rowIndex > maxRowIndex))
62 m_rowIndex = rowIndex;
65 bool rowIndexWasSet() const { return m_rowIndex != unsetRowIndex; }
66 unsigned rowIndex() const
68 ASSERT(rowIndexWasSet());
72 const BorderValue& borderAdjoiningTableStart() const
74 if (section()->hasSameDirectionAs(table()))
75 return style()->borderStart();
77 return style()->borderEnd();
80 const BorderValue& borderAdjoiningTableEnd() const
82 if (section()->hasSameDirectionAs(table()))
83 return style()->borderEnd();
85 return style()->borderStart();
88 const BorderValue& borderAdjoiningStartCell(const RenderTableCell*) const;
89 const BorderValue& borderAdjoiningEndCell(const RenderTableCell*) const;
92 virtual RenderObjectChildList* virtualChildren() OVERRIDE { return children(); }
93 virtual const RenderObjectChildList* virtualChildren() const OVERRIDE { return children(); }
95 virtual const char* renderName() const OVERRIDE { return (isAnonymous() || isPseudoElement()) ? "RenderTableRow (anonymous)" : "RenderTableRow"; }
97 virtual bool isTableRow() const OVERRIDE { return true; }
99 virtual void willBeRemovedFromTree() OVERRIDE;
101 virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0) OVERRIDE;
102 virtual void layout() OVERRIDE;
103 virtual LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const OVERRIDE;
104 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE;
106 virtual LayerType layerTypeRequired() const OVERRIDE
108 if (hasTransform() || hasHiddenBackface() || hasClipPath() || createsGroup() || isStickyPositioned())
111 if (hasOverflowClip())
112 return OverflowClipLayer;
117 virtual void paint(PaintInfo&, const LayoutPoint&) OVERRIDE;
119 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) OVERRIDE;
121 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OVERRIDE;
123 RenderObjectChildList m_children;
124 unsigned m_rowIndex : 31;
127 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderTableRow, isTableRow());
129 } // namespace WebCore
131 #endif // RenderTableRow_h