Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeSorter.h

Issue 1995933005: CustomElementUpgradeSorter puts elements in shadow-including tree order. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CustomElementUpgradeSorter_h
6 #define CustomElementUpgradeSorter_h
7
8 #include "core/CoreExport.h"
9 #include "platform/heap/Handle.h"
10
11 namespace blink {
12
13 class Element;
14 class Node;
15
16 // Does a shadow-including tree order sort of a subset of elements.
17 // https://dom.spec.whatwg.org/#concept-shadow-including-tree-order
18 class CORE_EXPORT CustomElementUpgradeSorter {
19 STACK_ALLOCATED();
20 public:
21 CustomElementUpgradeSorter();
22
23 // Record an element of interest. The DOM tree must not be
24 // modified between calls to add and the call to sorted.
25 void add(Element*);
26
27 // Adds shadow-including descendents of parent to result in
28 // shadow-including tree order. This operation is destroys the
29 // state of this sorter; after calling sorted, you must not call
30 // add or sorted again with this object.
31 void sorted(HeapVector<Member<Element>>* result, Node* parent);
32
33 private:
34 using ChildSet = HeapHashSet<Member<Node>>;
35 using ParentChildMap = HeapHashMap<Member<Node>, ChildSet>;
36
37 void visit(
38 HeapVector<Member<Element>>* result,
39 ChildSet&,
40 const ChildSet::iterator&);
41
42 Member<HeapHashSet<Member<Element>>> m_elements;
43
44 // This is the subset of the tree, from root node (usually
45 // document) through elements and shadow roots, to candidates.
46 Member<ParentChildMap> m_parentChildMap;
47 };
48
49 } // namespace blink
50
51 #endif // CustomElementUpgradeSorter_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/core.gypi ('k') | third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeSorter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698