| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 return Value(nodes, Value::adopt); | 125 return Value(nodes, Value::adopt); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void LocationPath::evaluate(EvaluationContext& context, NodeSet& nodes) const | 128 void LocationPath::evaluate(EvaluationContext& context, NodeSet& nodes) const |
| 129 { | 129 { |
| 130 bool resultIsSorted = nodes.isSorted(); | 130 bool resultIsSorted = nodes.isSorted(); |
| 131 | 131 |
| 132 for (unsigned i = 0; i < m_steps.size(); i++) { | 132 for (unsigned i = 0; i < m_steps.size(); i++) { |
| 133 Step* step = m_steps[i]; | 133 Step* step = m_steps[i]; |
| 134 NodeSet* newNodes = NodeSet::create(); | 134 NodeSet* newNodes = NodeSet::create(); |
| 135 WillBeHeapHashSet<RawPtrWillBeMember<Node>> newNodesSet; | 135 HeapHashSet<Member<Node>> newNodesSet; |
| 136 | 136 |
| 137 bool needToCheckForDuplicateNodes = !nodes.subtreesAreDisjoint() || (ste
p->getAxis() != Step::ChildAxis && step->getAxis() != Step::SelfAxis | 137 bool needToCheckForDuplicateNodes = !nodes.subtreesAreDisjoint() || (ste
p->getAxis() != Step::ChildAxis && step->getAxis() != Step::SelfAxis |
| 138 && step->getAxis() != Step::DescendantAxis && step->getAxis() != Ste
p::DescendantOrSelfAxis && step->getAxis() != Step::AttributeAxis); | 138 && step->getAxis() != Step::DescendantAxis && step->getAxis() != Ste
p::DescendantOrSelfAxis && step->getAxis() != Step::AttributeAxis); |
| 139 | 139 |
| 140 if (needToCheckForDuplicateNodes) | 140 if (needToCheckForDuplicateNodes) |
| 141 resultIsSorted = false; | 141 resultIsSorted = false; |
| 142 | 142 |
| 143 // This is a simplified check that can be improved to handle more cases. | 143 // This is a simplified check that can be improved to handle more cases. |
| 144 if (nodes.subtreesAreDisjoint() && (step->getAxis() == Step::ChildAxis |
| step->getAxis() == Step::SelfAxis)) | 144 if (nodes.subtreesAreDisjoint() && (step->getAxis() == Step::ChildAxis |
| step->getAxis() == Step::SelfAxis)) |
| 145 newNodes->markSubtreesDisjoint(true); | 145 newNodes->markSubtreesDisjoint(true); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 209 |
| 210 NodeSet& nodes = v.modifiableNodeSet(context); | 210 NodeSet& nodes = v.modifiableNodeSet(context); |
| 211 m_path->evaluate(context, nodes); | 211 m_path->evaluate(context, nodes); |
| 212 | 212 |
| 213 return v; | 213 return v; |
| 214 } | 214 } |
| 215 | 215 |
| 216 } // namespace XPath | 216 } // namespace XPath |
| 217 | 217 |
| 218 } // namespace blink | 218 } // namespace blink |
| OLD | NEW |