| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 exceptionState.throwTypeError("The result type is not a boolean."); | 148 exceptionState.throwTypeError("The result type is not a boolean."); |
| 149 return false; | 149 return false; |
| 150 } | 150 } |
| 151 return m_value.toBoolean(); | 151 return m_value.toBoolean(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 Node* XPathResult::singleNodeValue(ExceptionState& exceptionState) const | 154 Node* XPathResult::singleNodeValue(ExceptionState& exceptionState) const |
| 155 { | 155 { |
| 156 if (resultType() != ANY_UNORDERED_NODE_TYPE && resultType() != FIRST_ORDERED
_NODE_TYPE) { | 156 if (resultType() != ANY_UNORDERED_NODE_TYPE && resultType() != FIRST_ORDERED
_NODE_TYPE) { |
| 157 exceptionState.throwTypeError("The result type is not a single node."); | 157 exceptionState.throwTypeError("The result type is not a single node."); |
| 158 return 0; | 158 return nullptr; |
| 159 } | 159 } |
| 160 | 160 |
| 161 const NodeSet& nodes = m_value.toNodeSet(0); | 161 const NodeSet& nodes = m_value.toNodeSet(0); |
| 162 if (resultType() == FIRST_ORDERED_NODE_TYPE) | 162 if (resultType() == FIRST_ORDERED_NODE_TYPE) |
| 163 return nodes.firstNode(); | 163 return nodes.firstNode(); |
| 164 return nodes.anyNode(); | 164 return nodes.anyNode(); |
| 165 } | 165 } |
| 166 | 166 |
| 167 bool XPathResult::invalidIteratorState() const | 167 bool XPathResult::invalidIteratorState() const |
| 168 { | 168 { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 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) |
| 187 { | 187 { |
| 188 if (resultType() != UNORDERED_NODE_ITERATOR_TYPE && resultType() != ORDERED_
NODE_ITERATOR_TYPE) { | 188 if (resultType() != UNORDERED_NODE_ITERATOR_TYPE && resultType() != ORDERED_
NODE_ITERATOR_TYPE) { |
| 189 exceptionState.throwTypeError("The result type is not an iterator."); | 189 exceptionState.throwTypeError("The result type is not an iterator."); |
| 190 return 0; | 190 return nullptr; |
| 191 } | 191 } |
| 192 | 192 |
| 193 if (invalidIteratorState()) { | 193 if (invalidIteratorState()) { |
| 194 exceptionState.throwDOMException(InvalidStateError, "The document has mu
tated since the result was returned."); | 194 exceptionState.throwDOMException(InvalidStateError, "The document has mu
tated since the result was returned."); |
| 195 return 0; | 195 return nullptr; |
| 196 } | 196 } |
| 197 | 197 |
| 198 if (m_nodeSetPosition + 1 > nodeSet().size()) | 198 if (m_nodeSetPosition + 1 > nodeSet().size()) |
| 199 return 0; | 199 return nullptr; |
| 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 index, ExceptionState& exceptionState) | 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 nullptr; |
| 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 nullptr; |
| 218 | 218 |
| 219 return nodes[index]; | 219 return nodes[index]; |
| 220 } | 220 } |
| 221 | 221 |
| 222 } | 222 } |
| OLD | NEW |