| 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 blink { | 33 namespace blink { |
| 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 FINAL : public ParseNode { | 41 class Step final : public ParseNode { |
| 42 WTF_MAKE_NONCOPYABLE(Step); | 42 WTF_MAKE_NONCOPYABLE(Step); |
| 43 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; | 43 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; |
| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 AtomicString m_data; | 89 AtomicString m_data; |
| 90 AtomicString m_namespaceURI; | 90 AtomicString m_namespaceURI; |
| 91 | 91 |
| 92 // When possible, we merge some or all predicates with node test for bet
ter performance. | 92 // When possible, we merge some or all predicates with node test for bet
ter performance. |
| 93 WillBeHeapVector<OwnPtrWillBeMember<Predicate> > m_mergedPredicates; | 93 WillBeHeapVector<OwnPtrWillBeMember<Predicate> > m_mergedPredicates; |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 Step(Axis, const NodeTest&); | 96 Step(Axis, const NodeTest&); |
| 97 Step(Axis, const NodeTest&, WillBeHeapVector<OwnPtrWillBeMember<Predicate> >
&); | 97 Step(Axis, const NodeTest&, WillBeHeapVector<OwnPtrWillBeMember<Predicate> >
&); |
| 98 virtual ~Step(); | 98 virtual ~Step(); |
| 99 virtual void trace(Visitor*) OVERRIDE; | 99 virtual void trace(Visitor*) override; |
| 100 | 100 |
| 101 void optimize(); | 101 void optimize(); |
| 102 | 102 |
| 103 void evaluate(EvaluationContext&, Node* context, NodeSet&) const; | 103 void evaluate(EvaluationContext&, Node* context, NodeSet&) const; |
| 104 | 104 |
| 105 Axis axis() const { return m_axis; } | 105 Axis axis() const { return m_axis; } |
| 106 const NodeTest& nodeTest() const { return *m_nodeTest; } | 106 const NodeTest& nodeTest() const { return *m_nodeTest; } |
| 107 | 107 |
| 108 private: | 108 private: |
| 109 friend void optimizeStepPair(Step*, Step*, bool&); | 109 friend void optimizeStepPair(Step*, Step*, bool&); |
| 110 bool predicatesAreContextListInsensitive() const; | 110 bool predicatesAreContextListInsensitive() const; |
| 111 NodeTest& nodeTest() { return *m_nodeTest; } | 111 NodeTest& nodeTest() { return *m_nodeTest; } |
| 112 | 112 |
| 113 void parseNodeTest(const String&); | 113 void parseNodeTest(const String&); |
| 114 void nodesInAxis(EvaluationContext&, Node* context, NodeSet&) const; | 114 void nodesInAxis(EvaluationContext&, Node* context, NodeSet&) const; |
| 115 String namespaceFromNodetest(const String& nodeTest) const; | 115 String namespaceFromNodetest(const String& nodeTest) const; |
| 116 | 116 |
| 117 Axis m_axis; | 117 Axis m_axis; |
| 118 OwnPtrWillBeMember<NodeTest> m_nodeTest; | 118 OwnPtrWillBeMember<NodeTest> m_nodeTest; |
| 119 WillBeHeapVector<OwnPtrWillBeMember<Predicate> > m_predicates; | 119 WillBeHeapVector<OwnPtrWillBeMember<Predicate> > m_predicates; |
| 120 }; | 120 }; |
| 121 | 121 |
| 122 void optimizeStepPair(Step*, Step*, bool& dropSecondStep); | 122 void optimizeStepPair(Step*, Step*, bool& dropSecondStep); |
| 123 | 123 |
| 124 } // namespace XPath | 124 } // namespace XPath |
| 125 | 125 |
| 126 } // namespace blink | 126 } // namespace blink |
| 127 | 127 |
| 128 #endif // XPathStep_h | 128 #endif // XPathStep_h |
| OLD | NEW |