| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 166 |
| 167 bool XPathResult::invalidIteratorState() const | 167 bool XPathResult::invalidIteratorState() const |
| 168 { | 168 { |
| 169 if (resultType() != UNORDERED_NODE_ITERATOR_TYPE && resultType() != ORDERED_
NODE_ITERATOR_TYPE) | 169 if (resultType() != UNORDERED_NODE_ITERATOR_TYPE && resultType() != ORDERED_
NODE_ITERATOR_TYPE) |
| 170 return false; | 170 return false; |
| 171 | 171 |
| 172 ASSERT(m_document); | 172 ASSERT(m_document); |
| 173 return m_document->domTreeVersion() != m_domTreeVersion; | 173 return m_document->domTreeVersion() != m_domTreeVersion; |
| 174 } | 174 } |
| 175 | 175 |
| 176 unsigned long XPathResult::snapshotLength(ExceptionState& exceptionState) const | 176 unsigned XPathResult::snapshotLength(ExceptionState& exceptionState) const |
| 177 { | 177 { |
| 178 if (resultType() != UNORDERED_NODE_SNAPSHOT_TYPE && resultType() != ORDERED_
NODE_SNAPSHOT_TYPE) { | 178 if (resultType() != UNORDERED_NODE_SNAPSHOT_TYPE && resultType() != ORDERED_
NODE_SNAPSHOT_TYPE) { |
| 179 exceptionState.throwTypeError("The result type is not a snapshot."); | 179 exceptionState.throwTypeError("The result type is not a snapshot."); |
| 180 return 0; | 180 return 0; |
| 181 } | 181 } |
| 182 | 182 |
| 183 return m_value.toNodeSet(0).size(); | 183 return m_value.toNodeSet(0).size(); |
| 184 } | 184 } |
| 185 | 185 |
| 186 Node* XPathResult::iterateNext(ExceptionState& exceptionState) | 186 Node* XPathResult::iterateNext(ExceptionState& exceptionState) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 198 if (m_nodeSetPosition + 1 > nodeSet().size()) | 198 if (m_nodeSetPosition + 1 > nodeSet().size()) |
| 199 return 0; | 199 return 0; |
| 200 | 200 |
| 201 Node* node = nodeSet()[m_nodeSetPosition]; | 201 Node* node = nodeSet()[m_nodeSetPosition]; |
| 202 | 202 |
| 203 m_nodeSetPosition++; | 203 m_nodeSetPosition++; |
| 204 | 204 |
| 205 return node; | 205 return node; |
| 206 } | 206 } |
| 207 | 207 |
| 208 Node* XPathResult::snapshotItem(unsigned long index, ExceptionState& exceptionSt
ate) | 208 Node* XPathResult::snapshotItem(unsigned index, ExceptionState& exceptionState) |
| 209 { | 209 { |
| 210 if (resultType() != UNORDERED_NODE_SNAPSHOT_TYPE && resultType() != ORDERED_
NODE_SNAPSHOT_TYPE) { | 210 if (resultType() != UNORDERED_NODE_SNAPSHOT_TYPE && resultType() != ORDERED_
NODE_SNAPSHOT_TYPE) { |
| 211 exceptionState.throwTypeError("The result type is not a snapshot."); | 211 exceptionState.throwTypeError("The result type is not a snapshot."); |
| 212 return 0; | 212 return 0; |
| 213 } | 213 } |
| 214 | 214 |
| 215 const NodeSet& nodes = m_value.toNodeSet(0); | 215 const NodeSet& nodes = m_value.toNodeSet(0); |
| 216 if (index >= nodes.size()) | 216 if (index >= nodes.size()) |
| 217 return 0; | 217 return 0; |
| 218 | 218 |
| 219 return nodes[index]; | 219 return nodes[index]; |
| 220 } | 220 } |
| 221 | 221 |
| 222 } | 222 } |
| OLD | NEW |