OLD | NEW |
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 for (const Element* sibling = element->nextElementSibling(); sibling; siblin
g = sibling->nextElementSibling()) { | 71 for (const Element* sibling = element->nextElementSibling(); sibling; siblin
g = sibling->nextElementSibling()) { |
72 if (sibling->hasTagName(type)) | 72 if (sibling->hasTagName(type)) |
73 return false; | 73 return false; |
74 } | 74 } |
75 return true; | 75 return true; |
76 } | 76 } |
77 | 77 |
78 inline int DOMSiblingTraversalStrategy::countElementsBefore(Element* element) co
nst | 78 inline int DOMSiblingTraversalStrategy::countElementsBefore(Element* element) co
nst |
79 { | 79 { |
80 int count = 0; | 80 int count = 0; |
81 for (const Element* sibling = element->previousElementSibling(); sibling; si
bling = sibling->previousElementSibling()) { | 81 for (const Element* sibling = element->previousElementSibling(); sibling; si
bling = sibling->previousElementSibling()) |
82 unsigned index = sibling->childIndex(); | |
83 if (index) { | |
84 count += index; | |
85 break; | |
86 } | |
87 count++; | 82 count++; |
88 } | |
89 | 83 |
90 return count; | 84 return count; |
91 } | 85 } |
92 | 86 |
93 inline int DOMSiblingTraversalStrategy::countElementsOfTypeBefore(Element* eleme
nt, const QualifiedName& type) const | 87 inline int DOMSiblingTraversalStrategy::countElementsOfTypeBefore(Element* eleme
nt, const QualifiedName& type) const |
94 { | 88 { |
95 int count = 0; | 89 int count = 0; |
96 for (const Element* sibling = element->previousElementSibling(); sibling; si
bling = sibling->previousElementSibling()) { | 90 for (const Element* sibling = element->previousElementSibling(); sibling; si
bling = sibling->previousElementSibling()) { |
97 if (sibling->hasTagName(type)) | 91 if (sibling->hasTagName(type)) |
98 ++count; | 92 ++count; |
99 } | 93 } |
100 | 94 |
101 return count; | 95 return count; |
102 } | 96 } |
103 | 97 |
104 inline int DOMSiblingTraversalStrategy::countElementsAfter(Element* element) con
st | 98 inline int DOMSiblingTraversalStrategy::countElementsAfter(Element* element) con
st |
105 { | 99 { |
106 int count = 0; | 100 int count = 0; |
107 for (const Element* sibling = element->nextElementSibling(); sibling; siblin
g = sibling->nextElementSibling()) | 101 for (const Element* sibling = element->nextElementSibling(); sibling; siblin
g = sibling->nextElementSibling()) { |
| 102 unsigned index = sibling->childIndex(); |
| 103 if (index) { |
| 104 count += index; |
| 105 break; |
| 106 } |
108 ++count; | 107 ++count; |
| 108 } |
109 | 109 |
110 return count; | 110 return count; |
111 } | 111 } |
112 | 112 |
113 inline int DOMSiblingTraversalStrategy::countElementsOfTypeAfter(Element* elemen
t, const QualifiedName& type) const | 113 inline int DOMSiblingTraversalStrategy::countElementsOfTypeAfter(Element* elemen
t, const QualifiedName& type) const |
114 { | 114 { |
115 int count = 0; | 115 int count = 0; |
116 for (const Element* sibling = element->nextElementSibling(); sibling; siblin
g = sibling->nextElementSibling()) { | 116 for (const Element* sibling = element->nextElementSibling(); sibling; siblin
g = sibling->nextElementSibling()) { |
117 if (sibling->hasTagName(type)) | 117 if (sibling->hasTagName(type)) |
118 ++count; | 118 ++count; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 if (m_siblings[i]->hasTagName(type)) | 255 if (m_siblings[i]->hasTagName(type)) |
256 return ++count; | 256 return ++count; |
257 } | 257 } |
258 | 258 |
259 return count; | 259 return count; |
260 } | 260 } |
261 | 261 |
262 } | 262 } |
263 | 263 |
264 #endif | 264 #endif |
OLD | NEW |