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 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * | 9 * |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "core/xml/XPathPath.h" | 29 #include "core/xml/XPathPath.h" |
30 | 30 |
31 #include "core/dom/Document.h" | 31 #include "core/dom/Document.h" |
32 #include "core/xml/XPathPredicate.h" | 32 #include "core/xml/XPathPredicate.h" |
33 #include "core/xml/XPathStep.h" | 33 #include "core/xml/XPathStep.h" |
34 #include "core/xml/XPathValue.h" | 34 #include "core/xml/XPathValue.h" |
35 | 35 |
36 namespace WebCore { | 36 namespace WebCore { |
37 namespace XPath { | 37 namespace XPath { |
38 | 38 |
39 Filter::Filter(PassOwnPtr<Expression> expr, const Vector<Predicate*>& predicates
) | 39 Filter::Filter(PassOwnPtr<Expression> expr, Vector<OwnPtr<Predicate> >& predicat
es) |
40 : m_expr(expr) | 40 : m_expr(expr) |
41 { | 41 { |
42 m_predicates.reserveInitialCapacity(predicates.size()); | 42 m_predicates.swap(predicates); |
43 for (size_t i = 0; i < predicates.size(); i++) | |
44 m_predicates.append(adoptPtr(predicates[i])); | |
45 | |
46 setIsContextNodeSensitive(m_expr->isContextNodeSensitive()); | 43 setIsContextNodeSensitive(m_expr->isContextNodeSensitive()); |
47 setIsContextPositionSensitive(m_expr->isContextPositionSensitive()); | 44 setIsContextPositionSensitive(m_expr->isContextPositionSensitive()); |
48 setIsContextSizeSensitive(m_expr->isContextSizeSensitive()); | 45 setIsContextSizeSensitive(m_expr->isContextSizeSensitive()); |
49 } | 46 } |
50 | 47 |
51 Filter::~Filter() | 48 Filter::~Filter() |
52 { | 49 { |
53 } | 50 } |
54 | 51 |
55 Value Filter::evaluate() const | 52 Value Filter::evaluate() const |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 Value v = m_filter->evaluate(); | 205 Value v = m_filter->evaluate(); |
209 | 206 |
210 NodeSet& nodes = v.modifiableNodeSet(); | 207 NodeSet& nodes = v.modifiableNodeSet(); |
211 m_path->evaluate(nodes); | 208 m_path->evaluate(nodes); |
212 | 209 |
213 return v; | 210 return v; |
214 } | 211 } |
215 | 212 |
216 } | 213 } |
217 } | 214 } |
OLD | NEW |