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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 enum class ShadowRootType { 47 enum class ShadowRootType {
48 UserAgent, 48 UserAgent,
49 V0, 49 V0,
50 Open, 50 Open,
51 Closed 51 Closed
52 }; 52 };
53 53
54 class CORE_EXPORT ShadowRoot final : public DocumentFragment, public TreeScope, public DoublyLinkedListNode<ShadowRoot> { 54 class CORE_EXPORT ShadowRoot final : public DocumentFragment, public TreeScope, public DoublyLinkedListNode<ShadowRoot> {
55 DEFINE_WRAPPERTYPEINFO(); 55 DEFINE_WRAPPERTYPEINFO();
56 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ShadowRoot); 56 USING_GARBAGE_COLLECTED_MIXIN(ShadowRoot);
57 friend class WTF::DoublyLinkedListNode<ShadowRoot>; 57 friend class WTF::DoublyLinkedListNode<ShadowRoot>;
58 public: 58 public:
59 // FIXME: Current implementation does not work well if a shadow root is dyna mically created. 59 // FIXME: Current implementation does not work well if a shadow root is dyna mically created.
60 // So multiple shadow subtrees in several elements are prohibited. 60 // So multiple shadow subtrees in several elements are prohibited.
61 // See https://github.com/w3c/webcomponents/issues/102 and http://crbug.com/ 234020 61 // See https://github.com/w3c/webcomponents/issues/102 and http://crbug.com/ 234020
62 static PassRefPtrWillBeRawPtr<ShadowRoot> create(Document& document, ShadowR ootType type) 62 static RawPtr<ShadowRoot> create(Document& document, ShadowRootType type)
63 { 63 {
64 return adoptRefWillBeNoop(new ShadowRoot(document, type)); 64 return new ShadowRoot(document, type);
65 } 65 }
66 66
67 void recalcStyle(StyleRecalcChange); 67 void recalcStyle(StyleRecalcChange);
68 68
69 // Disambiguate between Node and TreeScope hierarchies; TreeScope's implemen tation is simpler. 69 // Disambiguate between Node and TreeScope hierarchies; TreeScope's implemen tation is simpler.
70 using TreeScope::document; 70 using TreeScope::document;
71 using TreeScope::getElementById; 71 using TreeScope::getElementById;
72 72
73 // TODO(kochi): crbug.com/507413 In non-Oilpan, host() may return null durin g queued 73 // TODO(kochi): crbug.com/507413 In non-Oilpan, host() may return null durin g queued
74 // event handling (e.g. during execCommand()). 74 // event handling (e.g. during execCommand()).
(...skipping 24 matching lines...) Expand all
99 bool containsInsertionPoints() const { return containsShadowElements() || co ntainsContentElements(); } 99 bool containsInsertionPoints() const { return containsShadowElements() || co ntainsContentElements(); }
100 bool containsShadowRoots() const; 100 bool containsShadowRoots() const;
101 101
102 unsigned descendantShadowElementCount() const; 102 unsigned descendantShadowElementCount() const;
103 103
104 // For Internals, don't use this. 104 // For Internals, don't use this.
105 unsigned childShadowRootCount() const; 105 unsigned childShadowRootCount() const;
106 unsigned numberOfStyles() const { return m_numberOfStyles; } 106 unsigned numberOfStyles() const { return m_numberOfStyles; }
107 107
108 HTMLShadowElement* shadowInsertionPointOfYoungerShadowRoot() const; 108 HTMLShadowElement* shadowInsertionPointOfYoungerShadowRoot() const;
109 void setShadowInsertionPointOfYoungerShadowRoot(PassRefPtrWillBeRawPtr<HTMLS hadowElement>); 109 void setShadowInsertionPointOfYoungerShadowRoot(RawPtr<HTMLShadowElement>);
110 110
111 void didAddInsertionPoint(InsertionPoint*); 111 void didAddInsertionPoint(InsertionPoint*);
112 void didRemoveInsertionPoint(InsertionPoint*); 112 void didRemoveInsertionPoint(InsertionPoint*);
113 const WillBeHeapVector<RefPtrWillBeMember<InsertionPoint>>& descendantInsert ionPoints(); 113 const HeapVector<Member<InsertionPoint>>& descendantInsertionPoints();
114 114
115 ShadowRootType type() const { return static_cast<ShadowRootType>(m_type); } 115 ShadowRootType type() const { return static_cast<ShadowRootType>(m_type); }
116 116
117 void didAddSlot(); 117 void didAddSlot();
118 void didRemoveSlot(); 118 void didRemoveSlot();
119 const WillBeHeapVector<RefPtrWillBeMember<HTMLSlotElement>>& descendantSlots (); 119 const HeapVector<Member<HTMLSlotElement>>& descendantSlots();
120 120
121 // Make protected methods from base class public here. 121 // Make protected methods from base class public here.
122 using TreeScope::setDocument; 122 using TreeScope::setDocument;
123 using TreeScope::setParentTreeScope; 123 using TreeScope::setParentTreeScope;
124 124
125 public: 125 public:
126 Element* activeElement() const; 126 Element* activeElement() const;
127 127
128 ShadowRoot* olderShadowRoot() const { return next(); } 128 ShadowRoot* olderShadowRoot() const { return next(); }
129 129
130 String innerHTML() const; 130 String innerHTML() const;
131 void setInnerHTML(const String&, ExceptionState&); 131 void setInnerHTML(const String&, ExceptionState&);
132 132
133 PassRefPtrWillBeRawPtr<Node> cloneNode(bool, ExceptionState&); 133 RawPtr<Node> cloneNode(bool, ExceptionState&);
134 134
135 StyleSheetList* styleSheets(); 135 StyleSheetList* styleSheets();
136 136
137 void setDelegatesFocus(bool flag) { m_delegatesFocus = flag; } 137 void setDelegatesFocus(bool flag) { m_delegatesFocus = flag; }
138 bool delegatesFocus() const { return m_delegatesFocus; } 138 bool delegatesFocus() const { return m_delegatesFocus; }
139 139
140 DECLARE_VIRTUAL_TRACE(); 140 DECLARE_VIRTUAL_TRACE();
141 141
142 private: 142 private:
143 ShadowRoot(Document&, ShadowRootType); 143 ShadowRoot(Document&, ShadowRootType);
144 ~ShadowRoot() override; 144 ~ShadowRoot() override;
145 145
146 #if !ENABLE(OILPAN) 146 #if !ENABLE(OILPAN)
147 void dispose() override; 147 void dispose() override;
148 #endif 148 #endif
149 149
150 void childrenChanged(const ChildrenChange&) override; 150 void childrenChanged(const ChildrenChange&) override;
151 151
152 ShadowRootRareData* ensureShadowRootRareData(); 152 ShadowRootRareData* ensureShadowRootRareData();
153 153
154 void addChildShadowRoot(); 154 void addChildShadowRoot();
155 void removeChildShadowRoot(); 155 void removeChildShadowRoot();
156 void invalidateDescendantInsertionPoints(); 156 void invalidateDescendantInsertionPoints();
157 157
158 // ShadowRoots should never be cloned. 158 // ShadowRoots should never be cloned.
159 PassRefPtrWillBeRawPtr<Node> cloneNode(bool) override { return nullptr; } 159 RawPtr<Node> cloneNode(bool) override { return nullptr; }
160 160
161 // FIXME: This shouldn't happen. https://bugs.webkit.org/show_bug.cgi?id=888 34 161 // FIXME: This shouldn't happen. https://bugs.webkit.org/show_bug.cgi?id=888 34
162 bool isOrphan() const { return !host(); } 162 bool isOrphan() const { return !host(); }
163 163
164 void invalidateDescendantSlots(); 164 void invalidateDescendantSlots();
165 unsigned descendantSlotCount() const; 165 unsigned descendantSlotCount() const;
166 166
167 RawPtrWillBeMember<ShadowRoot> m_prev; 167 Member<ShadowRoot> m_prev;
168 RawPtrWillBeMember<ShadowRoot> m_next; 168 Member<ShadowRoot> m_next;
169 OwnPtrWillBeMember<ShadowRootRareData> m_shadowRootRareData; 169 Member<ShadowRootRareData> m_shadowRootRareData;
170 unsigned m_numberOfStyles : 26; 170 unsigned m_numberOfStyles : 26;
171 unsigned m_type : 2; 171 unsigned m_type : 2;
172 unsigned m_registeredWithParentShadowRoot : 1; 172 unsigned m_registeredWithParentShadowRoot : 1;
173 unsigned m_descendantInsertionPointsIsValid : 1; 173 unsigned m_descendantInsertionPointsIsValid : 1;
174 unsigned m_delegatesFocus : 1; 174 unsigned m_delegatesFocus : 1;
175 unsigned m_descendantSlotsIsValid : 1; 175 unsigned m_descendantSlotsIsValid : 1;
176 }; 176 };
177 177
178 inline Element* ShadowRoot::activeElement() const 178 inline Element* ShadowRoot::activeElement() const
179 { 179 {
180 return adjustedFocusedElement(); 180 return adjustedFocusedElement();
181 } 181 }
182 182
183 DEFINE_NODE_TYPE_CASTS(ShadowRoot, isShadowRoot()); 183 DEFINE_NODE_TYPE_CASTS(ShadowRoot, isShadowRoot());
184 DEFINE_TYPE_CASTS(ShadowRoot, TreeScope, treeScope, treeScope->rootNode().isShad owRoot(), treeScope.rootNode().isShadowRoot()); 184 DEFINE_TYPE_CASTS(ShadowRoot, TreeScope, treeScope, treeScope->rootNode().isShad owRoot(), treeScope.rootNode().isShadowRoot());
185 DEFINE_TYPE_CASTS(TreeScope, ShadowRoot, shadowRoot, true, true); 185 DEFINE_TYPE_CASTS(TreeScope, ShadowRoot, shadowRoot, true, true);
186 186
187 } // namespace blink 187 } // namespace blink
188 188
189 #endif // ShadowRoot_h 189 #endif // ShadowRoot_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/shadow/InsertionPoint.cpp ('k') | third_party/WebKit/Source/core/dom/shadow/ShadowRoot.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698