Index: Source/core/xml/XPathResult.cpp |
diff --git a/Source/core/xml/XPathResult.cpp b/Source/core/xml/XPathResult.cpp |
index 72c472742d97e5f9474f1257d87bb9ad92c7cdd8..e7a661d41e0bf972fbcd1a44df5e298bc6b4359a 100644 |
--- a/Source/core/xml/XPathResult.cpp |
+++ b/Source/core/xml/XPathResult.cpp |
@@ -43,22 +43,22 @@ XPathResult::XPathResult(Document* document, const Value& value) |
{ |
ScriptWrappable::init(this); |
switch (m_value.type()) { |
- case Value::BooleanValue: |
- m_resultType = BOOLEAN_TYPE; |
- return; |
- case Value::NumberValue: |
- m_resultType = NUMBER_TYPE; |
- return; |
- case Value::StringValue: |
- m_resultType = STRING_TYPE; |
- return; |
- case Value::NodeSetValue: |
- m_resultType = UNORDERED_NODE_ITERATOR_TYPE; |
- m_nodeSetPosition = 0; |
- m_nodeSet = NodeSet::create(m_value.toNodeSet()); |
- m_document = document; |
- m_domTreeVersion = document->domTreeVersion(); |
- return; |
+ case Value::BooleanValue: |
+ m_resultType = BOOLEAN_TYPE; |
+ return; |
+ case Value::NumberValue: |
+ m_resultType = NUMBER_TYPE; |
+ return; |
+ case Value::StringValue: |
+ m_resultType = STRING_TYPE; |
+ return; |
+ case Value::NodeSetValue: |
+ m_resultType = UNORDERED_NODE_ITERATOR_TYPE; |
+ m_nodeSetPosition = 0; |
+ m_nodeSet = NodeSet::create(m_value.toNodeSet()); |
+ m_document = document; |
+ m_domTreeVersion = document->domTreeVersion(); |
+ return; |
} |
ASSERT_NOT_REACHED(); |
} |
@@ -77,46 +77,47 @@ void XPathResult::trace(Visitor* visitor) |
void XPathResult::convertTo(unsigned short type, ExceptionState& exceptionState) |
{ |
switch (type) { |
- case ANY_TYPE: |
- break; |
- case NUMBER_TYPE: |
- m_resultType = type; |
- m_value = m_value.toNumber(); |
- break; |
- case STRING_TYPE: |
- m_resultType = type; |
- m_value = m_value.toString(); |
- break; |
- case BOOLEAN_TYPE: |
- m_resultType = type; |
- m_value = m_value.toBoolean(); |
- break; |
- case UNORDERED_NODE_ITERATOR_TYPE: |
- case UNORDERED_NODE_SNAPSHOT_TYPE: |
- case ANY_UNORDERED_NODE_TYPE: |
- case FIRST_ORDERED_NODE_TYPE: // This is correct - singleNodeValue() will take care of ordering. |
- if (!m_value.isNodeSet()) { |
- exceptionState.throwTypeError("The result is not a node set, and therefore cannot be converted to the desired type."); |
- return; |
- } |
- m_resultType = type; |
- break; |
- case ORDERED_NODE_ITERATOR_TYPE: |
- if (!m_value.isNodeSet()) { |
- exceptionState.throwTypeError("The result is not a node set, and therefore cannot be converted to the desired type."); |
- return; |
- } |
- nodeSet().sort(); |
- m_resultType = type; |
- break; |
- case ORDERED_NODE_SNAPSHOT_TYPE: |
- if (!m_value.isNodeSet()) { |
- exceptionState.throwTypeError("The result is not a node set, and therefore cannot be converted to the desired type."); |
- return; |
- } |
- m_value.toNodeSet().sort(); |
- m_resultType = type; |
- break; |
+ case ANY_TYPE: |
+ break; |
+ case NUMBER_TYPE: |
+ m_resultType = type; |
+ m_value = m_value.toNumber(); |
+ break; |
+ case STRING_TYPE: |
+ m_resultType = type; |
+ m_value = m_value.toString(); |
+ break; |
+ case BOOLEAN_TYPE: |
+ m_resultType = type; |
+ m_value = m_value.toBoolean(); |
+ break; |
+ case UNORDERED_NODE_ITERATOR_TYPE: |
+ case UNORDERED_NODE_SNAPSHOT_TYPE: |
+ case ANY_UNORDERED_NODE_TYPE: |
+ // This is correct - singleNodeValue() will take care of ordering. |
+ case FIRST_ORDERED_NODE_TYPE: |
+ if (!m_value.isNodeSet()) { |
+ exceptionState.throwTypeError("The result is not a node set, and therefore cannot be converted to the desired type."); |
+ return; |
+ } |
+ m_resultType = type; |
+ break; |
+ case ORDERED_NODE_ITERATOR_TYPE: |
+ if (!m_value.isNodeSet()) { |
+ exceptionState.throwTypeError("The result is not a node set, and therefore cannot be converted to the desired type."); |
+ return; |
+ } |
+ nodeSet().sort(); |
+ m_resultType = type; |
+ break; |
+ case ORDERED_NODE_SNAPSHOT_TYPE: |
+ if (!m_value.isNodeSet()) { |
+ exceptionState.throwTypeError("The result is not a node set, and therefore cannot be converted to the desired type."); |
+ return; |
+ } |
+ m_value.toNodeSet().sort(); |
+ m_resultType = type; |
+ break; |
} |
} |
@@ -162,8 +163,7 @@ Node* XPathResult::singleNodeValue(ExceptionState& exceptionState) const |
const NodeSet& nodes = m_value.toNodeSet(); |
if (resultType() == FIRST_ORDERED_NODE_TYPE) |
return nodes.firstNode(); |
- else |
- return nodes.anyNode(); |
+ return nodes.anyNode(); |
} |
bool XPathResult::invalidIteratorState() const |