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 final : public RenderBox {
37 RenderTableRow(Element&, RenderStyle&&);
38 RenderTableRow(Document&, RenderStyle&&);
40 RenderTableRow* nextRow() const;
41 RenderTableRow* previousRow() const;
43 RenderTableCell* firstCell() const;
44 RenderTableCell* lastCell() const;
46 RenderTable* table() const;
48 void paintOutlineForRowIfNeeded(PaintInfo&, const LayoutPoint&);
50 static RenderTableRow* createAnonymousWithParentRenderer(const RenderObject*);
51 RenderBox* createAnonymousBoxWithSameTypeAs(const RenderObject* parent) const override { return createAnonymousWithParentRenderer(parent); }
53 void setRowIndex(unsigned);
54 bool rowIndexWasSet() const { return m_rowIndex != unsetRowIndex; }
55 unsigned rowIndex() const;
57 const BorderValue& borderAdjoiningTableStart() const;
58 const BorderValue& borderAdjoiningTableEnd() const;
59 const BorderValue& borderAdjoiningStartCell(const RenderTableCell&) const;
60 const BorderValue& borderAdjoiningEndCell(const RenderTableCell&) const;
62 void addChild(RenderObject* child, RenderObject* beforeChild = 0) override;
64 bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override;
67 const char* renderName() const override { return (isAnonymous() || isPseudoElement()) ? "RenderTableRow (anonymous)" : "RenderTableRow"; }
69 bool isTableRow() const override { return true; }
71 bool canHaveChildren() const override { return true; }
72 void willBeRemovedFromTree() override;
74 void layout() override;
75 LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const override;
77 bool requiresLayer() const override { return hasOverflowClip() || hasTransformRelatedProperty() || hasHiddenBackface() || hasClipPath() || createsGroup() || isStickyPositioned(); }
79 void paint(PaintInfo&, const LayoutPoint&) override;
81 void imageChanged(WrappedImagePtr, const IntRect* = 0) override;
83 void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
85 RenderTableSection* section() const { return downcast<RenderTableSection>(parent()); }
87 void firstChild() const = delete;
88 void lastChild() const = delete;
89 void nextSibling() const = delete;
90 void previousSibling() const = delete;
92 unsigned m_rowIndex : 31;
95 inline void RenderTableRow::setRowIndex(unsigned rowIndex)
97 if (UNLIKELY(rowIndex > maxRowIndex))
99 m_rowIndex = rowIndex;
102 inline unsigned RenderTableRow::rowIndex() const
104 ASSERT(rowIndexWasSet());
108 inline const BorderValue& RenderTableRow::borderAdjoiningTableStart() const
110 RenderTableSection* section = this->section();
111 if (section && section->hasSameDirectionAs(table()))
112 return style().borderStart();
113 return style().borderEnd();
116 inline const BorderValue& RenderTableRow::borderAdjoiningTableEnd() const
118 RenderTableSection* section = this->section();
119 if (section && section->hasSameDirectionAs(table()))
120 return style().borderEnd();
121 return style().borderStart();
124 inline RenderTable* RenderTableRow::table() const
126 RenderTableSection* section = this->section();
129 return downcast<RenderTable>(section->parent());
132 inline RenderTableRow* RenderTableRow::nextRow() const
134 return downcast<RenderTableRow>(RenderBox::nextSibling());
137 inline RenderTableRow* RenderTableRow::previousRow() const
139 return downcast<RenderTableRow>(RenderBox::previousSibling());
142 inline RenderTableRow* RenderTableSection::firstRow() const
144 return downcast<RenderTableRow>(RenderBox::firstChild());
147 inline RenderTableRow* RenderTableSection::lastRow() const
149 return downcast<RenderTableRow>(RenderBox::lastChild());
152 } // namespace WebCore
154 SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderTableRow, isTableRow())
156 #endif // RenderTableRow_h