| 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. All rights reserved. | 3 * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. |
| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 // E.g., there is no need to build a set of all "foo" nodes to evaluate | 62 // E.g., there is no need to build a set of all "foo" nodes to evaluate |
| 63 // "foo[@bar]", we can check the predicate while enumerating. | 63 // "foo[@bar]", we can check the predicate while enumerating. |
| 64 // This optimization can be applied to predicates that are not context node | 64 // This optimization can be applied to predicates that are not context node |
| 65 // list sensitive, or to first predicate that is only context position | 65 // list sensitive, or to first predicate that is only context position |
| 66 // sensitive, e.g. foo[position() mod 2 = 0]. | 66 // sensitive, e.g. foo[position() mod 2 = 0]. |
| 67 HeapVector<Member<Predicate>> remainingPredicates; | 67 HeapVector<Member<Predicate>> remainingPredicates; |
| 68 for (const auto& predicate : m_predicates) { | 68 for (const auto& predicate : m_predicates) { |
| 69 if ((!predicate->isContextPositionSensitive() || | 69 if ((!predicate->isContextPositionSensitive() || |
| 70 nodeTest().mergedPredicates().isEmpty()) && | 70 nodeTest().mergedPredicates().isEmpty()) && |
| 71 !predicate->isContextSizeSensitive() && remainingPredicates.isEmpty()) { | 71 !predicate->isContextSizeSensitive() && remainingPredicates.isEmpty()) { |
| 72 nodeTest().mergedPredicates().append(predicate); | 72 nodeTest().mergedPredicates().push_back(predicate); |
| 73 } else { | 73 } else { |
| 74 remainingPredicates.append(predicate); | 74 remainingPredicates.push_back(predicate); |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 swap(remainingPredicates, m_predicates); | 77 swap(remainingPredicates, m_predicates); |
| 78 } | 78 } |
| 79 | 79 |
| 80 bool optimizeStepPair(Step* first, Step* second) { | 80 bool optimizeStepPair(Step* first, Step* second) { |
| 81 if (first->m_axis == Step::DescendantOrSelfAxis && | 81 if (first->m_axis == Step::DescendantOrSelfAxis && |
| 82 first->nodeTest().getKind() == Step::NodeTest::AnyNodeTest && | 82 first->nodeTest().getKind() == Step::NodeTest::AnyNodeTest && |
| 83 !first->m_predicates.size() && | 83 !first->m_predicates.size() && |
| 84 !first->nodeTest().mergedPredicates().size()) { | 84 !first->nodeTest().mergedPredicates().size()) { |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 nodes.markSorted(false); | 438 nodes.markSorted(false); |
| 439 return; | 439 return; |
| 440 } | 440 } |
| 441 } | 441 } |
| 442 NOTREACHED(); | 442 NOTREACHED(); |
| 443 } | 443 } |
| 444 | 444 |
| 445 } // namespace XPath | 445 } // namespace XPath |
| 446 | 446 |
| 447 } // namespace blink | 447 } // namespace blink |
| OLD | NEW |