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. | 3 * Copyright (C) 2006, 2009 Apple Inc. |
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 20 matching lines...) Expand all Loading... |
31 #include "core/xml/XPathNodeSet.h" | 31 #include "core/xml/XPathNodeSet.h" |
32 | 32 |
33 namespace WebCore { | 33 namespace WebCore { |
34 | 34 |
35 class Node; | 35 class Node; |
36 | 36 |
37 namespace XPath { | 37 namespace XPath { |
38 | 38 |
39 class Predicate; | 39 class Predicate; |
40 | 40 |
41 class Step : public ParseNode { | 41 class Step FINAL : public ParseNode { |
42 WTF_MAKE_NONCOPYABLE(Step); | 42 WTF_MAKE_NONCOPYABLE(Step); |
43 WTF_MAKE_FAST_ALLOCATED; | 43 WTF_MAKE_FAST_ALLOCATED; |
44 public: | 44 public: |
45 enum Axis { | 45 enum Axis { |
46 AncestorAxis, AncestorOrSelfAxis, AttributeAxis, | 46 AncestorAxis, AncestorOrSelfAxis, AttributeAxis, |
47 ChildAxis, DescendantAxis, DescendantOrSelfAxis, | 47 ChildAxis, DescendantAxis, DescendantOrSelfAxis, |
48 FollowingAxis, FollowingSiblingAxis, NamespaceAxis, | 48 FollowingAxis, FollowingSiblingAxis, NamespaceAxis, |
49 ParentAxis, PrecedingAxis, PrecedingSiblingAxis, | 49 ParentAxis, PrecedingAxis, PrecedingSiblingAxis, |
50 SelfAxis | 50 SelfAxis |
51 }; | 51 }; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 Kind m_kind; | 87 Kind m_kind; |
88 AtomicString m_data; | 88 AtomicString m_data; |
89 AtomicString m_namespaceURI; | 89 AtomicString m_namespaceURI; |
90 | 90 |
91 // When possible, we merge some or all predicates with node test for bet
ter performance. | 91 // When possible, we merge some or all predicates with node test for bet
ter performance. |
92 Vector<OwnPtr<Predicate> > m_mergedPredicates; | 92 Vector<OwnPtr<Predicate> > m_mergedPredicates; |
93 }; | 93 }; |
94 | 94 |
95 Step(Axis, const NodeTest&); | 95 Step(Axis, const NodeTest&); |
96 Step(Axis, const NodeTest&, Vector<OwnPtr<Predicate> >&); | 96 Step(Axis, const NodeTest&, Vector<OwnPtr<Predicate> >&); |
97 ~Step(); | 97 virtual ~Step(); |
98 | 98 |
99 void optimize(); | 99 void optimize(); |
100 | 100 |
101 void evaluate(Node* context, NodeSet&) const; | 101 void evaluate(Node* context, NodeSet&) const; |
102 | 102 |
103 Axis axis() const { return m_axis; } | 103 Axis axis() const { return m_axis; } |
104 const NodeTest& nodeTest() const { return m_nodeTest; } | 104 const NodeTest& nodeTest() const { return m_nodeTest; } |
105 | 105 |
106 private: | 106 private: |
107 friend void optimizeStepPair(Step*, Step*, bool&); | 107 friend void optimizeStepPair(Step*, Step*, bool&); |
108 bool predicatesAreContextListInsensitive() const; | 108 bool predicatesAreContextListInsensitive() const; |
109 | 109 |
110 void parseNodeTest(const String&); | 110 void parseNodeTest(const String&); |
111 void nodesInAxis(Node* context, NodeSet&) const; | 111 void nodesInAxis(Node* context, NodeSet&) const; |
112 String namespaceFromNodetest(const String& nodeTest) const; | 112 String namespaceFromNodetest(const String& nodeTest) const; |
113 | 113 |
114 Axis m_axis; | 114 Axis m_axis; |
115 NodeTest m_nodeTest; | 115 NodeTest m_nodeTest; |
116 Vector<OwnPtr<Predicate> > m_predicates; | 116 Vector<OwnPtr<Predicate> > m_predicates; |
117 }; | 117 }; |
118 | 118 |
119 void optimizeStepPair(Step*, Step*, bool& dropSecondStep); | 119 void optimizeStepPair(Step*, Step*, bool& dropSecondStep); |
120 | 120 |
121 } // namespace XPath | 121 } // namespace XPath |
122 | 122 |
123 } // namespace WebCore | 123 } // namespace WebCore |
124 | 124 |
125 #endif // XPathStep_h | 125 #endif // XPathStep_h |
OLD | NEW |