| 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 11 matching lines...) Expand all Loading... |
| 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #ifndef XPathResult_h | 27 #ifndef XPathResult_h |
| 28 #define XPathResult_h | 28 #define XPathResult_h |
| 29 | 29 |
| 30 #include "bindings/v8/ScriptWrappable.h" | 30 #include "bindings/v8/ScriptWrappable.h" |
| 31 #include "core/xml/XPathValue.h" | 31 #include "core/xml/XPathValue.h" |
| 32 #include "heap/Handle.h" |
| 32 #include "wtf/Forward.h" | 33 #include "wtf/Forward.h" |
| 33 #include "wtf/RefCounted.h" | 34 #include "wtf/RefCounted.h" |
| 34 | 35 |
| 35 namespace WebCore { | 36 namespace WebCore { |
| 36 | 37 |
| 37 class Document; | 38 class Document; |
| 38 class ExceptionState; | 39 class ExceptionState; |
| 39 class Node; | 40 class Node; |
| 40 | 41 |
| 41 class XPathResult : public RefCounted<XPathResult>, public ScriptWrappable { | 42 class XPathResult : public RefCountedWillBeGarbageCollectedFinalized<XPathResult
>, public ScriptWrappable { |
| 43 DECLARE_GC_INFO; |
| 42 public: | 44 public: |
| 43 enum XPathResultType { | 45 enum XPathResultType { |
| 44 ANY_TYPE = 0, | 46 ANY_TYPE = 0, |
| 45 NUMBER_TYPE = 1, | 47 NUMBER_TYPE = 1, |
| 46 STRING_TYPE = 2, | 48 STRING_TYPE = 2, |
| 47 BOOLEAN_TYPE = 3, | 49 BOOLEAN_TYPE = 3, |
| 48 UNORDERED_NODE_ITERATOR_TYPE = 4, | 50 UNORDERED_NODE_ITERATOR_TYPE = 4, |
| 49 ORDERED_NODE_ITERATOR_TYPE = 5, | 51 ORDERED_NODE_ITERATOR_TYPE = 5, |
| 50 UNORDERED_NODE_SNAPSHOT_TYPE = 6, | 52 UNORDERED_NODE_SNAPSHOT_TYPE = 6, |
| 51 ORDERED_NODE_SNAPSHOT_TYPE = 7, | 53 ORDERED_NODE_SNAPSHOT_TYPE = 7, |
| 52 ANY_UNORDERED_NODE_TYPE = 8, | 54 ANY_UNORDERED_NODE_TYPE = 8, |
| 53 FIRST_ORDERED_NODE_TYPE = 9 | 55 FIRST_ORDERED_NODE_TYPE = 9 |
| 54 }; | 56 }; |
| 55 | 57 |
| 56 static PassRefPtr<XPathResult> create(Document* document, const XPath::Value
& value) { return adoptRef(new XPathResult(document, value)); } | 58 static PassRefPtrWillBeRawPtr<XPathResult> create(Document* document, const
XPath::Value& value) |
| 59 { |
| 60 return adoptRefWillBeNoop(new XPathResult(document, value)); |
| 61 } |
| 57 ~XPathResult(); | 62 ~XPathResult(); |
| 58 | 63 |
| 59 void convertTo(unsigned short type, ExceptionState&); | 64 void convertTo(unsigned short type, ExceptionState&); |
| 60 | 65 |
| 61 unsigned short resultType() const; | 66 unsigned short resultType() const; |
| 62 | 67 |
| 63 double numberValue(ExceptionState&) const; | 68 double numberValue(ExceptionState&) const; |
| 64 String stringValue(ExceptionState&) const; | 69 String stringValue(ExceptionState&) const; |
| 65 bool booleanValue(ExceptionState&) const; | 70 bool booleanValue(ExceptionState&) const; |
| 66 Node* singleNodeValue(ExceptionState&) const; | 71 Node* singleNodeValue(ExceptionState&) const; |
| 67 | 72 |
| 68 bool invalidIteratorState() const; | 73 bool invalidIteratorState() const; |
| 69 unsigned long snapshotLength(ExceptionState&) const; | 74 unsigned long snapshotLength(ExceptionState&) const; |
| 70 Node* iterateNext(ExceptionState&); | 75 Node* iterateNext(ExceptionState&); |
| 71 Node* snapshotItem(unsigned long index, ExceptionState&); | 76 Node* snapshotItem(unsigned long index, ExceptionState&); |
| 72 | 77 |
| 73 const XPath::Value& value() const { return m_value; } | 78 const XPath::Value& value() const { return m_value; } |
| 74 | 79 |
| 80 void trace(Visitor*) { } |
| 81 |
| 75 private: | 82 private: |
| 76 XPathResult(Document*, const XPath::Value&); | 83 XPathResult(Document*, const XPath::Value&); |
| 77 | 84 |
| 78 XPath::Value m_value; | 85 XPath::Value m_value; |
| 79 unsigned m_nodeSetPosition; | 86 unsigned m_nodeSetPosition; |
| 80 XPath::NodeSet m_nodeSet; // FIXME: why duplicate the node set stored in m_v
alue? | 87 XPath::NodeSet m_nodeSet; // FIXME: why duplicate the node set stored in m_v
alue? |
| 81 unsigned short m_resultType; | 88 unsigned short m_resultType; |
| 82 RefPtr<Document> m_document; | 89 RefPtr<Document> m_document; |
| 83 uint64_t m_domTreeVersion; | 90 uint64_t m_domTreeVersion; |
| 84 }; | 91 }; |
| 85 | 92 |
| 86 } // namespace WebCore | 93 } // namespace WebCore |
| 87 | 94 |
| 88 #endif // XPathResult_h | 95 #endif // XPathResult_h |
| OLD | NEW |