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 14 matching lines...) Expand all Loading... |
25 void add(Element*); | 25 void add(Element*); |
26 | 26 |
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>, Member<ChildSet>>; |
36 | 36 |
37 enum AddResult { | 37 enum AddResult { |
38 kParentAlreadyExistsInMap, | 38 kParentAlreadyExistsInMap, |
39 kParentAddedToMap | 39 kParentAddedToMap |
40 }; | 40 }; |
41 | 41 |
42 AddResult addToParentChildMap(Node* parent, Node* child); | 42 AddResult addToParentChildMap(Node* parent, Node* child); |
43 void visit( | 43 void visit( |
44 HeapVector<Member<Element>>* result, | 44 HeapVector<Member<Element>>* result, |
45 ChildSet&, | 45 ChildSet&, |
46 const ChildSet::iterator&); | 46 const ChildSet::iterator&); |
47 | 47 |
48 Member<HeapHashSet<Member<Element>>> m_elements; | 48 Member<HeapHashSet<Member<Element>>> m_elements; |
49 | 49 |
50 // This is the subset of the tree, from root node (usually | 50 // This is the subset of the tree, from root node (usually |
51 // document) through elements and shadow roots, to candidates. | 51 // document) through elements and shadow roots, to candidates. |
52 Member<ParentChildMap> m_parentChildMap; | 52 Member<ParentChildMap> m_parentChildMap; |
53 }; | 53 }; |
54 | 54 |
55 } // namespace blink | 55 } // namespace blink |
56 | 56 |
57 #endif // CustomElementUpgradeSorter_h | 57 #endif // CustomElementUpgradeSorter_h |
OLD | NEW |