Chromium Code Reviews| 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 19 matching lines...) Expand all Loading... | |
| 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(Expression* expr, const Vector<Predicate*>& predicates) | 39 Filter::Filter(Expression* expr, const Vector<Predicate*>& predicates) |
| 40 : m_expr(expr), m_predicates(predicates) | 40 : m_expr(adoptPtr(expr)) |
|
abarth-chromium
2013/10/11 20:28:05
Again, |expr| should have the type PassOwnPtr<Expr
| |
| 41 { | 41 { |
| 42 m_predicates.reserveInitialCapacity(predicates.size()); | |
| 43 for (size_t i = 0; i < predicates.size(); i++) | |
| 44 m_predicates.append(adoptPtr(predicates[i])); | |
|
abarth-chromium
2013/10/11 20:28:05
Calling adoptPtr manually here is wrong for the sa
| |
| 45 | |
| 42 setIsContextNodeSensitive(m_expr->isContextNodeSensitive()); | 46 setIsContextNodeSensitive(m_expr->isContextNodeSensitive()); |
| 43 setIsContextPositionSensitive(m_expr->isContextPositionSensitive()); | 47 setIsContextPositionSensitive(m_expr->isContextPositionSensitive()); |
| 44 setIsContextSizeSensitive(m_expr->isContextSizeSensitive()); | 48 setIsContextSizeSensitive(m_expr->isContextSizeSensitive()); |
| 45 } | 49 } |
| 46 | 50 |
| 47 Filter::~Filter() | 51 Filter::~Filter() |
| 48 { | 52 { |
| 49 delete m_expr; | |
| 50 deleteAllValues(m_predicates); | |
| 51 } | 53 } |
| 52 | 54 |
| 53 Value Filter::evaluate() const | 55 Value Filter::evaluate() const |
| 54 { | 56 { |
| 55 Value v = m_expr->evaluate(); | 57 Value v = m_expr->evaluate(); |
| 56 | 58 |
| 57 NodeSet& nodes = v.modifiableNodeSet(); | 59 NodeSet& nodes = v.modifiableNodeSet(); |
| 58 nodes.sort(); | 60 nodes.sort(); |
| 59 | 61 |
| 60 EvaluationContext& evaluationContext = Expression::evaluationContext(); | 62 EvaluationContext& evaluationContext = Expression::evaluationContext(); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 206 Value v = m_filter->evaluate(); | 208 Value v = m_filter->evaluate(); |
| 207 | 209 |
| 208 NodeSet& nodes = v.modifiableNodeSet(); | 210 NodeSet& nodes = v.modifiableNodeSet(); |
| 209 m_path->evaluate(nodes); | 211 m_path->evaluate(nodes); |
| 210 | 212 |
| 211 return v; | 213 return v; |
| 212 } | 214 } |
| 213 | 215 |
| 214 } | 216 } |
| 215 } | 217 } |
| OLD | NEW |