| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 m_resultType = kStringType; | 52 m_resultType = kStringType; |
| 53 return; | 53 return; |
| 54 case Value::NodeSetValue: | 54 case Value::NodeSetValue: |
| 55 m_resultType = kUnorderedNodeIteratorType; | 55 m_resultType = kUnorderedNodeIteratorType; |
| 56 m_nodeSetPosition = 0; | 56 m_nodeSetPosition = 0; |
| 57 m_nodeSet = NodeSet::create(m_value.toNodeSet(&context)); | 57 m_nodeSet = NodeSet::create(m_value.toNodeSet(&context)); |
| 58 m_document = &context.node->document(); | 58 m_document = &context.node->document(); |
| 59 m_domTreeVersion = m_document->domTreeVersion(); | 59 m_domTreeVersion = m_document->domTreeVersion(); |
| 60 return; | 60 return; |
| 61 } | 61 } |
| 62 ASSERT_NOT_REACHED(); | 62 NOTREACHED(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 DEFINE_TRACE(XPathResult) | 65 DEFINE_TRACE(XPathResult) |
| 66 { | 66 { |
| 67 visitor->trace(m_value); | 67 visitor->trace(m_value); |
| 68 visitor->trace(m_nodeSet); | 68 visitor->trace(m_nodeSet); |
| 69 visitor->trace(m_document); | 69 visitor->trace(m_document); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void XPathResult::convertTo(unsigned short type, ExceptionState& exceptionState) | 72 void XPathResult::convertTo(unsigned short type, ExceptionState& exceptionState) |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 if (resultType() == kFirstOrderedNodeType) | 159 if (resultType() == kFirstOrderedNodeType) |
| 160 return nodes.firstNode(); | 160 return nodes.firstNode(); |
| 161 return nodes.anyNode(); | 161 return nodes.anyNode(); |
| 162 } | 162 } |
| 163 | 163 |
| 164 bool XPathResult::invalidIteratorState() const | 164 bool XPathResult::invalidIteratorState() const |
| 165 { | 165 { |
| 166 if (resultType() != kUnorderedNodeIteratorType && resultType() != kOrderedNo
deIteratorType) | 166 if (resultType() != kUnorderedNodeIteratorType && resultType() != kOrderedNo
deIteratorType) |
| 167 return false; | 167 return false; |
| 168 | 168 |
| 169 ASSERT(m_document); | 169 DCHECK(m_document); |
| 170 return m_document->domTreeVersion() != m_domTreeVersion; | 170 return m_document->domTreeVersion() != m_domTreeVersion; |
| 171 } | 171 } |
| 172 | 172 |
| 173 unsigned XPathResult::snapshotLength(ExceptionState& exceptionState) const | 173 unsigned XPathResult::snapshotLength(ExceptionState& exceptionState) const |
| 174 { | 174 { |
| 175 if (resultType() != kUnorderedNodeSnapshotType && resultType() != kOrderedNo
deSnapshotType) { | 175 if (resultType() != kUnorderedNodeSnapshotType && resultType() != kOrderedNo
deSnapshotType) { |
| 176 exceptionState.throwTypeError("The result type is not a snapshot."); | 176 exceptionState.throwTypeError("The result type is not a snapshot."); |
| 177 return 0; | 177 return 0; |
| 178 } | 178 } |
| 179 | 179 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 210 } | 210 } |
| 211 | 211 |
| 212 const NodeSet& nodes = m_value.toNodeSet(0); | 212 const NodeSet& nodes = m_value.toNodeSet(0); |
| 213 if (index >= nodes.size()) | 213 if (index >= nodes.size()) |
| 214 return nullptr; | 214 return nullptr; |
| 215 | 215 |
| 216 return nodes[index]; | 216 return nodes[index]; |
| 217 } | 217 } |
| 218 | 218 |
| 219 } // namespace blink | 219 } // namespace blink |
| OLD | NEW |