OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005 Frerich Raabe <raabe@kde.org> | 2 * Copyright (C) 2005 Frerich Raabe <raabe@kde.org> |
3 * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 | 160 |
161 bool XPathResult::invalidIteratorState() const | 161 bool XPathResult::invalidIteratorState() const |
162 { | 162 { |
163 if (resultType() != UNORDERED_NODE_ITERATOR_TYPE && resultType() != ORDERED_
NODE_ITERATOR_TYPE) | 163 if (resultType() != UNORDERED_NODE_ITERATOR_TYPE && resultType() != ORDERED_
NODE_ITERATOR_TYPE) |
164 return false; | 164 return false; |
165 | 165 |
166 ASSERT(m_document); | 166 ASSERT(m_document); |
167 return m_document->domTreeVersion() != m_domTreeVersion; | 167 return m_document->domTreeVersion() != m_domTreeVersion; |
168 } | 168 } |
169 | 169 |
170 unsigned long XPathResult::snapshotLength(ExceptionCode& ec) const | 170 unsigned XPathResult::snapshotLength(ExceptionCode& ec) const |
171 { | 171 { |
172 if (resultType() != UNORDERED_NODE_SNAPSHOT_TYPE && resultType() != ORDERED_
NODE_SNAPSHOT_TYPE) { | 172 if (resultType() != UNORDERED_NODE_SNAPSHOT_TYPE && resultType() != ORDERED_
NODE_SNAPSHOT_TYPE) { |
173 ec = TypeError; | 173 ec = TypeError; |
174 return 0; | 174 return 0; |
175 } | 175 } |
176 | 176 |
177 return m_value.toNodeSet().size(); | 177 return m_value.toNodeSet().size(); |
178 } | 178 } |
179 | 179 |
180 Node* XPathResult::iterateNext(ExceptionCode& ec) | 180 Node* XPathResult::iterateNext(ExceptionCode& ec) |
(...skipping 11 matching lines...) Expand all Loading... |
192 if (m_nodeSetPosition + 1 > m_nodeSet.size()) | 192 if (m_nodeSetPosition + 1 > m_nodeSet.size()) |
193 return 0; | 193 return 0; |
194 | 194 |
195 Node* node = m_nodeSet[m_nodeSetPosition]; | 195 Node* node = m_nodeSet[m_nodeSetPosition]; |
196 | 196 |
197 m_nodeSetPosition++; | 197 m_nodeSetPosition++; |
198 | 198 |
199 return node; | 199 return node; |
200 } | 200 } |
201 | 201 |
202 Node* XPathResult::snapshotItem(unsigned long index, ExceptionCode& ec) | 202 Node* XPathResult::snapshotItem(unsigned index, ExceptionCode& ec) |
203 { | 203 { |
204 if (resultType() != UNORDERED_NODE_SNAPSHOT_TYPE && resultType() != ORDERED_
NODE_SNAPSHOT_TYPE) { | 204 if (resultType() != UNORDERED_NODE_SNAPSHOT_TYPE && resultType() != ORDERED_
NODE_SNAPSHOT_TYPE) { |
205 ec = TypeError; | 205 ec = TypeError; |
206 return 0; | 206 return 0; |
207 } | 207 } |
208 | 208 |
209 const NodeSet& nodes = m_value.toNodeSet(); | 209 const NodeSet& nodes = m_value.toNodeSet(); |
210 if (index >= nodes.size()) | 210 if (index >= nodes.size()) |
211 return 0; | 211 return 0; |
212 | 212 |
213 return nodes[index]; | 213 return nodes[index]; |
214 } | 214 } |
215 | 215 |
216 } | 216 } |
OLD | NEW |