OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CustomElementUpgradeSorter_h | 5 #ifndef CustomElementUpgradeSorter_h |
6 #define CustomElementUpgradeSorter_h | 6 #define CustomElementUpgradeSorter_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 // Adds shadow-including descendents of parent to result in | 27 // Adds shadow-including descendents of parent to result in |
28 // shadow-including tree order. This operation is destroys the | 28 // shadow-including tree order. This operation is destroys the |
29 // state of this sorter; after calling sorted, you must not call | 29 // state of this sorter; after calling sorted, you must not call |
30 // add or sorted again with this object. | 30 // add or sorted again with this object. |
31 void sorted(HeapVector<Member<Element>>* result, Node* parent); | 31 void sorted(HeapVector<Member<Element>>* result, Node* parent); |
32 | 32 |
33 private: | 33 private: |
34 using ChildSet = HeapHashSet<Member<Node>>; | 34 using ChildSet = HeapHashSet<Member<Node>>; |
35 using ParentChildMap = HeapHashMap<Member<Node>, ChildSet>; | 35 using ParentChildMap = HeapHashMap<Member<Node>, ChildSet>; |
36 | 36 |
| 37 enum AddResult { |
| 38 kParentAlreadyExistsInMap, |
| 39 kParentAddedToMap |
| 40 }; |
| 41 |
| 42 AddResult addToParentChildMap(Node* parent, Node* child); |
37 void visit( | 43 void visit( |
38 HeapVector<Member<Element>>* result, | 44 HeapVector<Member<Element>>* result, |
39 ChildSet&, | 45 ChildSet&, |
40 const ChildSet::iterator&); | 46 const ChildSet::iterator&); |
41 | 47 |
42 Member<HeapHashSet<Member<Element>>> m_elements; | 48 Member<HeapHashSet<Member<Element>>> m_elements; |
43 | 49 |
44 // This is the subset of the tree, from root node (usually | 50 // This is the subset of the tree, from root node (usually |
45 // document) through elements and shadow roots, to candidates. | 51 // document) through elements and shadow roots, to candidates. |
46 Member<ParentChildMap> m_parentChildMap; | 52 Member<ParentChildMap> m_parentChildMap; |
47 }; | 53 }; |
48 | 54 |
49 } // namespace blink | 55 } // namespace blink |
50 | 56 |
51 #endif // CustomElementUpgradeSorter_h | 57 #endif // CustomElementUpgradeSorter_h |
OLD | NEW |