| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 2 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 namespace blink { | 34 namespace blink { |
| 35 namespace XPath { | 35 namespace XPath { |
| 36 | 36 |
| 37 // When a node set is large, sorting it by traversing the whole document is | 37 // When a node set is large, sorting it by traversing the whole document is |
| 38 // better (we can assume that we aren't dealing with documents that we cannot | 38 // better (we can assume that we aren't dealing with documents that we cannot |
| 39 // even traverse in reasonable time). | 39 // even traverse in reasonable time). |
| 40 const unsigned traversalSortCutoff = 10000; | 40 const unsigned traversalSortCutoff = 10000; |
| 41 | 41 |
| 42 typedef WillBeHeapVector<RawPtrWillBeMember<Node>> NodeSetVector; | 42 typedef WillBeHeapVector<RawPtrWillBeMember<Node>> NodeSetVector; |
| 43 | 43 |
| 44 PassOwnPtrWillBeRawPtr<NodeSet> NodeSet::create(const NodeSet& other) | 44 NodeSet* NodeSet::create(const NodeSet& other) |
| 45 { | 45 { |
| 46 OwnPtrWillBeRawPtr<NodeSet> nodeSet = NodeSet::create(); | 46 NodeSet* nodeSet = NodeSet::create(); |
| 47 nodeSet->m_isSorted = other.m_isSorted; | 47 nodeSet->m_isSorted = other.m_isSorted; |
| 48 nodeSet->m_subtreesAreDisjoint = other.m_subtreesAreDisjoint; | 48 nodeSet->m_subtreesAreDisjoint = other.m_subtreesAreDisjoint; |
| 49 nodeSet->m_nodes.appendVector(other.m_nodes); | 49 nodeSet->m_nodes.appendVector(other.m_nodes); |
| 50 return nodeSet.release(); | 50 return nodeSet; |
| 51 } | 51 } |
| 52 | 52 |
| 53 static inline Node* parentWithDepth(unsigned depth, const NodeSetVector& parents
) | 53 static inline Node* parentWithDepth(unsigned depth, const NodeSetVector& parents
) |
| 54 { | 54 { |
| 55 ASSERT(parents.size() >= depth + 1); | 55 ASSERT(parents.size() >= depth + 1); |
| 56 return parents[parents.size() - 1 - depth]; | 56 return parents[parents.size() - 1 - depth]; |
| 57 } | 57 } |
| 58 | 58 |
| 59 static void sortBlock(unsigned from, unsigned to, WillBeHeapVector<NodeSetVector
>& parentMatrix, bool mayContainAttributeNodes) | 59 static void sortBlock(unsigned from, unsigned to, WillBeHeapVector<NodeSetVector
>& parentMatrix, bool mayContainAttributeNodes) |
| 60 { | 60 { |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 Node* NodeSet::anyNode() const | 274 Node* NodeSet::anyNode() const |
| 275 { | 275 { |
| 276 if (isEmpty()) | 276 if (isEmpty()) |
| 277 return 0; | 277 return 0; |
| 278 | 278 |
| 279 return m_nodes.at(0).get(); | 279 return m_nodes.at(0).get(); |
| 280 } | 280 } |
| 281 | 281 |
| 282 } | 282 } |
| 283 } | 283 } |
| OLD | NEW |