Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: Source/core/rendering/RenderTableRow.h

Issue 294783004: Use tighter typing in table rendering code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix typo / bug and update copyrights Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 * (C) 1997 Torben Weis (weis@kde.org) 3 * (C) 1997 Torben Weis (weis@kde.org)
4 * (C) 1998 Waldo Bastian (bastian@kde.org) 4 * (C) 1998 Waldo Bastian (bastian@kde.org)
5 * (C) 1999 Lars Knoll (knoll@kde.org) 5 * (C) 1999 Lars Knoll (knoll@kde.org)
6 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 * (C) 1999 Antti Koivisto (koivisto@kde.org)
7 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2009, 2013 Apple Inc. All rights reserv ed.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
11 * License as published by the Free Software Foundation; either 11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version. 12 * version 2 of the License, or (at your option) any later version.
13 * 13 *
14 * This library is distributed in the hope that it will be useful, 14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Library General Public License for more details. 17 * Library General Public License for more details.
(...skipping 11 matching lines...) Expand all
29 29
30 namespace WebCore { 30 namespace WebCore {
31 31
32 static const unsigned unsetRowIndex = 0x7FFFFFFF; 32 static const unsigned unsetRowIndex = 0x7FFFFFFF;
33 static const unsigned maxRowIndex = 0x7FFFFFFE; // 2,147,483,646 33 static const unsigned maxRowIndex = 0x7FFFFFFE; // 2,147,483,646
34 34
35 class RenderTableRow FINAL : public RenderBox { 35 class RenderTableRow FINAL : public RenderBox {
36 public: 36 public:
37 explicit RenderTableRow(Element*); 37 explicit RenderTableRow(Element*);
38 38
39 RenderObject* firstChild() const { ASSERT(children() == virtualChildren()); return children()->firstChild(); } 39 RenderTableCell* firstCell() const;
40 RenderObject* lastChild() const { ASSERT(children() == virtualChildren()); r eturn children()->lastChild(); } 40 RenderTableCell* lastCell() const;
41
42 RenderTableRow* previousRow() const;
43 RenderTableRow* nextRow() const;
41 44
42 const RenderObjectChildList* children() const { return &m_children; } 45 const RenderObjectChildList* children() const { return &m_children; }
43 RenderObjectChildList* children() { return &m_children; } 46 RenderObjectChildList* children() { return &m_children; }
44 47
45 RenderTableSection* section() const { return toRenderTableSection(parent()); } 48 RenderTableSection* section() const { return toRenderTableSection(parent()); }
46 RenderTable* table() const { return toRenderTable(parent()->parent()); } 49 RenderTable* table() const { return toRenderTable(parent()->parent()); }
47 50
48 void paintOutlineForRowIfNeeded(PaintInfo&, const LayoutPoint&); 51 void paintOutlineForRowIfNeeded(PaintInfo&, const LayoutPoint&);
49 52
50 static RenderTableRow* createAnonymous(Document*); 53 static RenderTableRow* createAnonymous(Document*);
(...skipping 30 matching lines...) Expand all
81 { 84 {
82 if (section()->hasSameDirectionAs(table())) 85 if (section()->hasSameDirectionAs(table()))
83 return style()->borderEnd(); 86 return style()->borderEnd();
84 87
85 return style()->borderStart(); 88 return style()->borderStart();
86 } 89 }
87 90
88 const BorderValue& borderAdjoiningStartCell(const RenderTableCell*) const; 91 const BorderValue& borderAdjoiningStartCell(const RenderTableCell*) const;
89 const BorderValue& borderAdjoiningEndCell(const RenderTableCell*) const; 92 const BorderValue& borderAdjoiningEndCell(const RenderTableCell*) const;
90 93
94 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct ion) OVERRIDE;
95
91 private: 96 private:
92 virtual RenderObjectChildList* virtualChildren() OVERRIDE { return children( ); } 97 virtual RenderObjectChildList* virtualChildren() OVERRIDE { return children( ); }
93 virtual const RenderObjectChildList* virtualChildren() const OVERRIDE { retu rn children(); } 98 virtual const RenderObjectChildList* virtualChildren() const OVERRIDE { retu rn children(); }
94 99
95 virtual const char* renderName() const OVERRIDE { return (isAnonymous() || i sPseudoElement()) ? "RenderTableRow (anonymous)" : "RenderTableRow"; } 100 virtual const char* renderName() const OVERRIDE { return (isAnonymous() || i sPseudoElement()) ? "RenderTableRow (anonymous)" : "RenderTableRow"; }
96 101
97 virtual bool isTableRow() const OVERRIDE { return true; } 102 virtual bool isTableRow() const OVERRIDE { return true; }
98 103
99 virtual void willBeRemovedFromTree() OVERRIDE; 104 virtual void willBeRemovedFromTree() OVERRIDE;
100 105
101 virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0) OV ERRIDE; 106 virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0) OV ERRIDE;
102 virtual void layout() OVERRIDE; 107 virtual void layout() OVERRIDE;
103 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct ion) OVERRIDE;
104 108
105 virtual LayerType layerTypeRequired() const OVERRIDE 109 virtual LayerType layerTypeRequired() const OVERRIDE
106 { 110 {
107 if (hasTransform() || hasHiddenBackface() || hasClipPath() || createsGro up() || isStickyPositioned() || style()->shouldCompositeForCurrentAnimations()) 111 if (hasTransform() || hasHiddenBackface() || hasClipPath() || createsGro up() || isStickyPositioned() || style()->shouldCompositeForCurrentAnimations())
108 return NormalLayer; 112 return NormalLayer;
109 113
110 if (hasOverflowClip()) 114 if (hasOverflowClip())
111 return OverflowClipLayer; 115 return OverflowClipLayer;
112 116
113 return NoLayer; 117 return NoLayer;
114 } 118 }
115 119
116 virtual void paint(PaintInfo&, const LayoutPoint&) OVERRIDE; 120 virtual void paint(PaintInfo&, const LayoutPoint&) OVERRIDE;
117 121
118 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) OVERRIDE; 122 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) OVERRIDE;
119 123
120 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OV ERRIDE; 124 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OV ERRIDE;
121 125
126 void nextSibling() const WTF_DELETED_FUNCTION;
127 void previousSibling() const WTF_DELETED_FUNCTION;
128
122 RenderObjectChildList m_children; 129 RenderObjectChildList m_children;
123 unsigned m_rowIndex : 31; 130 unsigned m_rowIndex : 31;
124 }; 131 };
125 132
126 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderTableRow, isTableRow()); 133 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderTableRow, isTableRow());
127 134
135 inline RenderTableRow* RenderTableRow::previousRow() const
136 {
137 return toRenderTableRow(RenderObject::previousSibling());
138 }
139
140 inline RenderTableRow* RenderTableRow::nextRow() const
141 {
142 return toRenderTableRow(RenderObject::nextSibling());
143 }
144
145 inline RenderTableRow* RenderTableSection::firstRow() const
146 {
147 ASSERT(children() == virtualChildren());
148 return toRenderTableRow(children()->firstChild());
149 }
150
151 inline RenderTableRow* RenderTableSection::lastRow() const
152 {
153 ASSERT(children() == virtualChildren());
154 return toRenderTableRow(children()->lastChild());
155 }
156
128 } // namespace WebCore 157 } // namespace WebCore
129 158
130 #endif // RenderTableRow_h 159 #endif // RenderTableRow_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698