Fix the issue that Web Audio test case fails on PR3.
[framework/web/webkit-efl.git] / Source / WebCore / rendering / RenderTableRow.h
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
30 namespace WebCore {
31
32 static const unsigned unsetRowIndex = 0x7FFFFFFF;
33 static const unsigned maxRowIndex = 0x7FFFFFFE; // 2,147,483,646
34
35 class RenderTableRow : public RenderBox {
36 public:
37     explicit RenderTableRow(Node*);
38
39     const RenderObjectChildList* children() const { return &m_children; }
40     RenderObjectChildList* children() { return &m_children; }
41
42     RenderTableSection* section() const { return toRenderTableSection(parent()); }
43     RenderTable* table() const { return toRenderTable(parent()->parent()); }
44
45     void updateBeforeAndAfterContent();
46     void paintOutlineForRowIfNeeded(PaintInfo&, const LayoutPoint&);
47
48     static RenderTableRow* createAnonymousWithParentRenderer(const RenderObject*);
49     virtual RenderBox* createAnonymousBoxWithSameTypeAs(const RenderObject* parent) const OVERRIDE
50     {
51         return createAnonymousWithParentRenderer(parent);
52     }
53
54     void setRowIndex(unsigned rowIndex)
55     {
56         if (UNLIKELY(rowIndex > maxRowIndex))
57             CRASH();
58
59         m_rowIndex = rowIndex;
60     }
61
62     bool rowIndexWasSet() const { return m_rowIndex != unsetRowIndex; }
63     unsigned rowIndex() const
64     {
65         ASSERT(rowIndexWasSet());
66         return m_rowIndex;
67     }
68
69     const BorderValue& borderAdjoiningTableStart() const
70     {
71         if (section()->hasSameDirectionAsTable())
72             return style()->borderStart();
73
74         return style()->borderEnd();
75     }
76
77     const BorderValue& borderAdjoiningTableEnd() const
78     {
79         if (section()->hasSameDirectionAsTable())
80             return style()->borderEnd();
81
82         return style()->borderStart();
83     }
84
85 private:
86     virtual RenderObjectChildList* virtualChildren() { return children(); }
87     virtual const RenderObjectChildList* virtualChildren() const { return children(); }
88
89     virtual const char* renderName() const { return isAnonymous() ? "RenderTableRow (anonymous)" : "RenderTableRow"; }
90
91     virtual bool isTableRow() const { return true; }
92
93     virtual void willBeDestroyed();
94
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;
99
100     virtual bool requiresLayer() const OVERRIDE { return isTransparent() || hasClipPath() || hasOverflowClip() || hasTransform() || hasHiddenBackface() || hasMask() || hasFilter(); }
101
102     virtual void paint(PaintInfo&, const LayoutPoint&);
103
104     virtual void imageChanged(WrappedImagePtr, const IntRect* = 0);
105
106     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
107
108     RenderObjectChildList m_children;
109     unsigned m_rowIndex : 31;
110 };
111
112 inline RenderTableRow* toRenderTableRow(RenderObject* object)
113 {
114     ASSERT(!object || object->isTableRow());
115     return static_cast<RenderTableRow*>(object);
116 }
117
118 inline const RenderTableRow* toRenderTableRow(const RenderObject* object)
119 {
120     ASSERT(!object || object->isTableRow());
121     return static_cast<const RenderTableRow*>(object);
122 }
123
124 // This will catch anyone doing an unnecessary cast.
125 void toRenderTableRow(const RenderTableRow*);
126
127 } // namespace WebCore
128
129 #endif // RenderTableRow_h