| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 ASSERT(o.m_mergedPredicates.isEmpty()); | 69 ASSERT(o.m_mergedPredicates.isEmpty()); |
| 70 } | 70 } |
| 71 NodeTest& operator=(const NodeTest& o) | 71 NodeTest& operator=(const NodeTest& o) |
| 72 { | 72 { |
| 73 m_kind = o.m_kind; | 73 m_kind = o.m_kind; |
| 74 m_data = o.m_data; | 74 m_data = o.m_data; |
| 75 m_namespaceURI = o.m_namespaceURI; | 75 m_namespaceURI = o.m_namespaceURI; |
| 76 ASSERT(o.m_mergedPredicates.isEmpty()); | 76 ASSERT(o.m_mergedPredicates.isEmpty()); |
| 77 return *this; | 77 return *this; |
| 78 } | 78 } |
| 79 void trace(Visitor* visitor) { visitor->trace(m_mergedPredicates); } | 79 DEFINE_INLINE_TRACE() { visitor->trace(m_mergedPredicates); } |
| 80 | 80 |
| 81 Kind kind() const { return m_kind; } | 81 Kind kind() const { return m_kind; } |
| 82 const AtomicString& data() const { return m_data; } | 82 const AtomicString& data() const { return m_data; } |
| 83 const AtomicString& namespaceURI() const { return m_namespaceURI; } | 83 const AtomicString& namespaceURI() const { return m_namespaceURI; } |
| 84 WillBeHeapVector<OwnPtrWillBeMember<Predicate> >& mergedPredicates() { r
eturn m_mergedPredicates; } | 84 WillBeHeapVector<OwnPtrWillBeMember<Predicate> >& mergedPredicates() { r
eturn m_mergedPredicates; } |
| 85 const WillBeHeapVector<OwnPtrWillBeMember<Predicate> >& mergedPredicates
() const { return m_mergedPredicates; } | 85 const WillBeHeapVector<OwnPtrWillBeMember<Predicate> >& mergedPredicates
() const { return m_mergedPredicates; } |
| 86 | 86 |
| 87 private: | 87 private: |
| 88 Kind m_kind; | 88 Kind m_kind; |
| 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 DECLARE_VIRTUAL_TRACE(); |
| 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 |