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

Side by Side Diff: third_party/WebKit/Source/core/dom/shadow/ShadowRootRareDataV0.h

Issue 1904703002: Move v0 things from ShadowRootRareData into ShadowRootRareDataV0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed Created 4 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/shadow/ShadowRootRareData.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 10 matching lines...) Expand all
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef ShadowRootRareData_h 31 #ifndef ShadowRootRareDataV0_h
32 #define ShadowRootRareData_h 32 #define ShadowRootRareDataV0_h
33 33
34 #include "core/dom/shadow/InsertionPoint.h" 34 #include "core/dom/shadow/InsertionPoint.h"
35 #include "core/html/HTMLSlotElement.h"
36 #include "wtf/Vector.h" 35 #include "wtf/Vector.h"
37 36
38 namespace blink { 37 namespace blink {
39 38
40 class ShadowRootRareData : public GarbageCollected<ShadowRootRareData> { 39 class ShadowRootRareDataV0 : public GarbageCollected<ShadowRootRareDataV0> {
41 public: 40 public:
42 ShadowRootRareData() 41 ShadowRootRareDataV0()
43 : m_descendantShadowElementCount(0) 42 : m_descendantShadowElementCount(0)
44 , m_descendantContentElementCount(0) 43 , m_descendantContentElementCount(0)
45 , m_childShadowRootCount(0)
46 , m_descendantSlotCount(0)
47 { 44 {
48 } 45 }
49 46
50 HTMLShadowElement* shadowInsertionPointOfYoungerShadowRoot() const { return m_shadowInsertionPointOfYoungerShadowRoot.get(); } 47 HTMLShadowElement* shadowInsertionPointOfYoungerShadowRoot() const { return m_shadowInsertionPointOfYoungerShadowRoot.get(); }
51 void setShadowInsertionPointOfYoungerShadowRoot(HTMLShadowElement* shadowIns ertionPoint) { m_shadowInsertionPointOfYoungerShadowRoot = shadowInsertionPoint; } 48 void setShadowInsertionPointOfYoungerShadowRoot(HTMLShadowElement* shadowIns ertionPoint) { m_shadowInsertionPointOfYoungerShadowRoot = shadowInsertionPoint; }
52 49
53 void didAddInsertionPoint(InsertionPoint*); 50 void didAddInsertionPoint(InsertionPoint*);
54 void didRemoveInsertionPoint(InsertionPoint*); 51 void didRemoveInsertionPoint(InsertionPoint*);
55 52
56 bool containsShadowElements() const { return m_descendantShadowElementCount; } 53 bool containsShadowElements() const { return m_descendantShadowElementCount; }
57 bool containsContentElements() const { return m_descendantContentElementCoun t; } 54 bool containsContentElements() const { return m_descendantContentElementCoun t; }
58 bool containsShadowRoots() const { return m_childShadowRootCount; }
59 55
60 unsigned descendantShadowElementCount() const { return m_descendantShadowEle mentCount; } 56 unsigned descendantShadowElementCount() const { return m_descendantShadowEle mentCount; }
61 57
62 void didAddChildShadowRoot() { ++m_childShadowRootCount; }
63 void didRemoveChildShadowRoot() { DCHECK_GT(m_childShadowRootCount, 0u); --m _childShadowRootCount; }
64
65 unsigned childShadowRootCount() const { return m_childShadowRootCount; }
66
67 const HeapVector<Member<InsertionPoint>>& descendantInsertionPoints() { retu rn m_descendantInsertionPoints; } 58 const HeapVector<Member<InsertionPoint>>& descendantInsertionPoints() { retu rn m_descendantInsertionPoints; }
68 void setDescendantInsertionPoints(HeapVector<Member<InsertionPoint>>& list) { m_descendantInsertionPoints.swap(list); } 59 void setDescendantInsertionPoints(HeapVector<Member<InsertionPoint>>& list) { m_descendantInsertionPoints.swap(list); }
69 void clearDescendantInsertionPoints() { m_descendantInsertionPoints.clear(); } 60 void clearDescendantInsertionPoints() { m_descendantInsertionPoints.clear(); }
70 61
71 StyleSheetList* styleSheets() { return m_styleSheetList.get(); }
72 void setStyleSheets(StyleSheetList* styleSheetList) { m_styleSheetList = sty leSheetList; }
73
74 void didAddSlot() { ++m_descendantSlotCount; }
75 void didRemoveSlot() { DCHECK_GT(m_descendantSlotCount, 0u); --m_descendantS lotCount; }
76
77 unsigned descendantSlotCount() const { return m_descendantSlotCount; }
78
79 const HeapVector<Member<HTMLSlotElement>>& descendantSlots() const { return m_descendantSlots; }
80
81 void setDescendantSlots(HeapVector<Member<HTMLSlotElement>>& slots) { m_desc endantSlots.swap(slots); }
82 void clearDescendantSlots() { m_descendantSlots.clear(); }
83
84 DEFINE_INLINE_TRACE() 62 DEFINE_INLINE_TRACE()
85 { 63 {
86 visitor->trace(m_shadowInsertionPointOfYoungerShadowRoot); 64 visitor->trace(m_shadowInsertionPointOfYoungerShadowRoot);
87 visitor->trace(m_descendantInsertionPoints); 65 visitor->trace(m_descendantInsertionPoints);
88 visitor->trace(m_styleSheetList);
89 visitor->trace(m_descendantSlots);
90 } 66 }
91 67
92 private: 68 private:
93 Member<HTMLShadowElement> m_shadowInsertionPointOfYoungerShadowRoot; 69 Member<HTMLShadowElement> m_shadowInsertionPointOfYoungerShadowRoot;
94 unsigned m_descendantShadowElementCount; 70 unsigned m_descendantShadowElementCount;
95 unsigned m_descendantContentElementCount; 71 unsigned m_descendantContentElementCount;
96 unsigned m_childShadowRootCount;
97 HeapVector<Member<InsertionPoint>> m_descendantInsertionPoints; 72 HeapVector<Member<InsertionPoint>> m_descendantInsertionPoints;
98 Member<StyleSheetList> m_styleSheetList;
99 unsigned m_descendantSlotCount;
100 HeapVector<Member<HTMLSlotElement>> m_descendantSlots;
101 }; 73 };
102 74
103 inline void ShadowRootRareData::didAddInsertionPoint(InsertionPoint* point) 75 inline void ShadowRootRareDataV0::didAddInsertionPoint(InsertionPoint* point)
104 { 76 {
105 DCHECK(point); 77 DCHECK(point);
106 if (isHTMLShadowElement(*point)) 78 if (isHTMLShadowElement(*point))
107 ++m_descendantShadowElementCount; 79 ++m_descendantShadowElementCount;
108 else if (isHTMLContentElement(*point)) 80 else if (isHTMLContentElement(*point))
109 ++m_descendantContentElementCount; 81 ++m_descendantContentElementCount;
110 else 82 else
111 ASSERT_NOT_REACHED(); 83 ASSERT_NOT_REACHED();
112 } 84 }
113 85
114 inline void ShadowRootRareData::didRemoveInsertionPoint(InsertionPoint* point) 86 inline void ShadowRootRareDataV0::didRemoveInsertionPoint(InsertionPoint* point)
115 { 87 {
116 DCHECK(point); 88 DCHECK(point);
117 if (isHTMLShadowElement(*point)) { 89 if (isHTMLShadowElement(*point)) {
118 DCHECK_GT(m_descendantShadowElementCount, 0u); 90 DCHECK_GT(m_descendantShadowElementCount, 0u);
119 --m_descendantShadowElementCount; 91 --m_descendantShadowElementCount;
120 } else if (isHTMLContentElement(*point)) { 92 } else if (isHTMLContentElement(*point)) {
121 DCHECK_GT(m_descendantContentElementCount, 0u); 93 DCHECK_GT(m_descendantContentElementCount, 0u);
122 --m_descendantContentElementCount; 94 --m_descendantContentElementCount;
123 } else { 95 } else {
124 ASSERT_NOT_REACHED(); 96 ASSERT_NOT_REACHED();
125 } 97 }
126 } 98 }
127 99
128 } // namespace blink 100 } // namespace blink
129 101
130 #endif 102 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/shadow/ShadowRootRareData.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698