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, 2009 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 RenderTableRow_h
26#define RenderTableRow_h
27
28#include "RenderTableSection.h"
29
30namespace WebCore {
31
32class RenderTableRow : public RenderBox {
33public:
34    explicit RenderTableRow(Node*);
35
36    const RenderObjectChildList* children() const { return &m_children; }
37    RenderObjectChildList* children() { return &m_children; }
38
39    RenderTableSection* section() const { return toRenderTableSection(parent()); }
40    RenderTable* table() const { return toRenderTable(parent()->parent()); }
41
42    void updateBeforeAndAfterContent();
43
44private:
45    virtual RenderObjectChildList* virtualChildren() { return children(); }
46    virtual const RenderObjectChildList* virtualChildren() const { return children(); }
47
48    virtual const char* renderName() const { return isAnonymous() ? "RenderTableRow (anonymous)" : "RenderTableRow"; }
49
50    virtual bool isTableRow() const { return true; }
51
52    virtual void destroy();
53
54    virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0);
55    virtual void layout();
56    virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer);
57    virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
58
59    // The only time rows get a layer is when they have transparency.
60    virtual bool requiresLayer() const { return isTransparent() || hasOverflowClip() || hasTransform() || hasMask(); }
61
62    virtual void paint(PaintInfo&, int tx, int ty);
63
64    virtual void imageChanged(WrappedImagePtr, const IntRect* = 0);
65
66    virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);
67    virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
68
69    RenderObjectChildList m_children;
70};
71
72inline RenderTableRow* toRenderTableRow(RenderObject* object)
73{
74    ASSERT(!object || object->isTableRow());
75    return static_cast<RenderTableRow*>(object);
76}
77
78inline const RenderTableRow* toRenderTableRow(const RenderObject* object)
79{
80    ASSERT(!object || object->isTableRow());
81    return static_cast<const RenderTableRow*>(object);
82}
83
84// This will catch anyone doing an unnecessary cast.
85void toRenderTableRow(const RenderTableRow*);
86
87} // namespace WebCore
88
89#endif // RenderTableRow_h
90