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

Side by Side Diff: Source/core/css/SiblingTraversalStrategies.h

Issue 34273002: Remove UnusedParam.h (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 7 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 13 matching lines...) Expand all
24 * along with this library; see the file COPYING.LIB. If not, write to 24 * along with this library; see the file COPYING.LIB. If not, write to
25 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 25 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26 * Boston, MA 02110-1301, USA. 26 * Boston, MA 02110-1301, USA.
27 */ 27 */
28 28
29 #ifndef SiblingTraversalStrategies_h 29 #ifndef SiblingTraversalStrategies_h
30 #define SiblingTraversalStrategies_h 30 #define SiblingTraversalStrategies_h
31 31
32 #include "core/dom/Element.h" 32 #include "core/dom/Element.h"
33 #include "core/rendering/style/RenderStyle.h" 33 #include "core/rendering/style/RenderStyle.h"
34 #include "wtf/UnusedParam.h"
35 34
36 namespace WebCore { 35 namespace WebCore {
37 36
38 struct DOMSiblingTraversalStrategy { 37 struct DOMSiblingTraversalStrategy {
39 bool isFirstChild(Element*) const; 38 bool isFirstChild(Element*) const;
40 bool isLastChild(Element*) const; 39 bool isLastChild(Element*) const;
41 bool isFirstOfType(Element*, const QualifiedName&) const; 40 bool isFirstOfType(Element*, const QualifiedName&) const;
42 bool isLastOfType(Element*, const QualifiedName&) const; 41 bool isLastOfType(Element*, const QualifiedName&) const;
43 42
44 int countElementsBefore(Element*) const; 43 int countElementsBefore(Element*) const;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 int countElementsOfTypeBefore(Element*, const QualifiedName&) const; 131 int countElementsOfTypeBefore(Element*, const QualifiedName&) const;
133 int countElementsOfTypeAfter(Element*, const QualifiedName&) const; 132 int countElementsOfTypeAfter(Element*, const QualifiedName&) const;
134 133
135 private: 134 private:
136 const Vector<Node*, 32>& m_siblings; 135 const Vector<Node*, 32>& m_siblings;
137 int m_nth; 136 int m_nth;
138 }; 137 };
139 138
140 inline bool ShadowDOMSiblingTraversalStrategy::isFirstChild(Element* element) co nst 139 inline bool ShadowDOMSiblingTraversalStrategy::isFirstChild(Element* element) co nst
141 { 140 {
142 UNUSED_PARAM(element);
143
144 ASSERT(element == toElement(m_siblings[m_nth])); 141 ASSERT(element == toElement(m_siblings[m_nth]));
145 142
146 for (int i = m_nth - 1; i >= 0; --i) { 143 for (int i = m_nth - 1; i >= 0; --i) {
147 if (m_siblings[i]->isElementNode()) 144 if (m_siblings[i]->isElementNode())
148 return false; 145 return false;
149 } 146 }
150 147
151 return true; 148 return true;
152 } 149 }
153 150
154 inline bool ShadowDOMSiblingTraversalStrategy::isLastChild(Element* element) con st 151 inline bool ShadowDOMSiblingTraversalStrategy::isLastChild(Element* element) con st
155 { 152 {
156 UNUSED_PARAM(element);
157
158 ASSERT(element == toElement(m_siblings[m_nth])); 153 ASSERT(element == toElement(m_siblings[m_nth]));
159 154
160 for (size_t i = m_nth + 1; i < m_siblings.size(); ++i) { 155 for (size_t i = m_nth + 1; i < m_siblings.size(); ++i) {
161 if (m_siblings[i]->isElementNode()) 156 if (m_siblings[i]->isElementNode())
162 return false; 157 return false;
163 } 158 }
164 159
165 return true; 160 return true;
166 } 161 }
167 162
168 inline bool ShadowDOMSiblingTraversalStrategy::isFirstOfType(Element* element, c onst QualifiedName& type) const 163 inline bool ShadowDOMSiblingTraversalStrategy::isFirstOfType(Element* element, c onst QualifiedName& type) const
169 { 164 {
170 UNUSED_PARAM(element);
171
172 ASSERT(element == toElement(m_siblings[m_nth])); 165 ASSERT(element == toElement(m_siblings[m_nth]));
173 166
174 for (int i = m_nth - 1; i >= 0; --i) { 167 for (int i = m_nth - 1; i >= 0; --i) {
175 if (m_siblings[i]->hasTagName(type)) 168 if (m_siblings[i]->hasTagName(type))
176 return false; 169 return false;
177 } 170 }
178 171
179 return true; 172 return true;
180 } 173 }
181 174
182 inline bool ShadowDOMSiblingTraversalStrategy::isLastOfType(Element* element, co nst QualifiedName& type) const 175 inline bool ShadowDOMSiblingTraversalStrategy::isLastOfType(Element* element, co nst QualifiedName& type) const
183 { 176 {
184 UNUSED_PARAM(element);
185
186 ASSERT(element == toElement(m_siblings[m_nth])); 177 ASSERT(element == toElement(m_siblings[m_nth]));
187 178
188 for (size_t i = m_nth + 1; i < m_siblings.size(); ++i) { 179 for (size_t i = m_nth + 1; i < m_siblings.size(); ++i) {
189 if (m_siblings[i]->hasTagName(type)) 180 if (m_siblings[i]->hasTagName(type))
190 return false; 181 return false;
191 } 182 }
192 183
193 return true; 184 return true;
194 } 185 }
195 186
196 inline int ShadowDOMSiblingTraversalStrategy::countElementsBefore(Element* eleme nt) const 187 inline int ShadowDOMSiblingTraversalStrategy::countElementsBefore(Element* eleme nt) const
197 { 188 {
198 UNUSED_PARAM(element);
199
200 ASSERT(element == toElement(m_siblings[m_nth])); 189 ASSERT(element == toElement(m_siblings[m_nth]));
201 190
202 int count = 0; 191 int count = 0;
203 for (int i = m_nth - 1; i >= 0; --i) { 192 for (int i = m_nth - 1; i >= 0; --i) {
204 if (m_siblings[i]->isElementNode()) 193 if (m_siblings[i]->isElementNode())
205 ++count; 194 ++count;
206 } 195 }
207 196
208 return count; 197 return count;
209 } 198 }
210 199
211 inline int ShadowDOMSiblingTraversalStrategy::countElementsAfter(Element* elemen t) const 200 inline int ShadowDOMSiblingTraversalStrategy::countElementsAfter(Element* elemen t) const
212 { 201 {
213 UNUSED_PARAM(element);
214
215 ASSERT(element == toElement(m_siblings[m_nth])); 202 ASSERT(element == toElement(m_siblings[m_nth]));
216 203
217 int count = 0; 204 int count = 0;
218 for (size_t i = m_nth + 1; i < m_siblings.size(); ++i) { 205 for (size_t i = m_nth + 1; i < m_siblings.size(); ++i) {
219 if (m_siblings[i]->isElementNode()) 206 if (m_siblings[i]->isElementNode())
220 return ++count; 207 return ++count;
221 } 208 }
222 209
223 return count; 210 return count;
224 } 211 }
225 212
226 inline int ShadowDOMSiblingTraversalStrategy::countElementsOfTypeBefore(Element* element, const QualifiedName& type) const 213 inline int ShadowDOMSiblingTraversalStrategy::countElementsOfTypeBefore(Element* element, const QualifiedName& type) const
227 { 214 {
228 UNUSED_PARAM(element);
229
230 ASSERT(element == toElement(m_siblings[m_nth])); 215 ASSERT(element == toElement(m_siblings[m_nth]));
231 216
232 int count = 0; 217 int count = 0;
233 for (int i = m_nth - 1; i >= 0; --i) { 218 for (int i = m_nth - 1; i >= 0; --i) {
234 if (m_siblings[i]->hasTagName(type)) 219 if (m_siblings[i]->hasTagName(type))
235 ++count; 220 ++count;
236 } 221 }
237 222
238 return count; 223 return count;
239 } 224 }
240 225
241 inline int ShadowDOMSiblingTraversalStrategy::countElementsOfTypeAfter(Element* element, const QualifiedName& type) const 226 inline int ShadowDOMSiblingTraversalStrategy::countElementsOfTypeAfter(Element* element, const QualifiedName& type) const
242 { 227 {
243 UNUSED_PARAM(element);
244
245 ASSERT(element == toElement(m_siblings[m_nth])); 228 ASSERT(element == toElement(m_siblings[m_nth]));
246 229
247 int count = 0; 230 int count = 0;
248 for (size_t i = m_nth + 1; i < m_siblings.size(); ++i) { 231 for (size_t i = m_nth + 1; i < m_siblings.size(); ++i) {
249 if (m_siblings[i]->hasTagName(type)) 232 if (m_siblings[i]->hasTagName(type))
250 return ++count; 233 return ++count;
251 } 234 }
252 235
253 return count; 236 return count;
254 } 237 }
255 238
256 } 239 }
257 240
258 #endif 241 #endif
OLDNEW
« no previous file with comments | « Source/core/css/MediaQueryEvaluator.cpp ('k') | Source/core/css/resolver/FilterOperationResolver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698