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

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

Issue 1995203002: Rewrite Shadow DOM distribution engine to support partial synchronous distribution for v1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wip 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
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 unsigned childShadowRootCount() const { return m_childShadowRootCount; } 109 unsigned childShadowRootCount() const { return m_childShadowRootCount; }
110 unsigned numberOfStyles() const { return m_numberOfStyles; } 110 unsigned numberOfStyles() const { return m_numberOfStyles; }
111 111
112 void recalcStyle(StyleRecalcChange); 112 void recalcStyle(StyleRecalcChange);
113 113
114 void registerScopedHTMLStyleChild(); 114 void registerScopedHTMLStyleChild();
115 void unregisterScopedHTMLStyleChild(); 115 void unregisterScopedHTMLStyleChild();
116 116
117 SlotAssignment& ensureSlotAssignment(); 117 SlotAssignment& ensureSlotAssignment();
118 118
119 void didAddSlot();
120 void didRemoveSlot();
121 const HeapVector<Member<HTMLSlotElement>>& descendantSlots();
122
123 void assignV1();
124 void distributeV1(); 119 void distributeV1();
125 120
126 HTMLSlotElement* assignedSlotFor(const Node&) const;
127
128 Element* activeElement() const; 121 Element* activeElement() const;
129 122
130 String innerHTML() const; 123 String innerHTML() const;
131 void setInnerHTML(const String&, ExceptionState&); 124 void setInnerHTML(const String&, ExceptionState&);
132 125
133 Node* cloneNode(bool, ExceptionState&); 126 Node* cloneNode(bool, ExceptionState&);
134 127
135 void setDelegatesFocus(bool flag) { m_delegatesFocus = flag; } 128 void setDelegatesFocus(bool flag) { m_delegatesFocus = flag; }
136 bool delegatesFocus() const { return m_delegatesFocus; } 129 bool delegatesFocus() const { return m_delegatesFocus; }
137 130
(...skipping 17 matching lines...) Expand all
155 void addChildShadowRoot() { ++m_childShadowRootCount; } 148 void addChildShadowRoot() { ++m_childShadowRootCount; }
156 void removeChildShadowRoot() { DCHECK_GT(m_childShadowRootCount, 0u); --m_ch ildShadowRootCount; } 149 void removeChildShadowRoot() { DCHECK_GT(m_childShadowRootCount, 0u); --m_ch ildShadowRootCount; }
157 void invalidateDescendantInsertionPoints(); 150 void invalidateDescendantInsertionPoints();
158 151
159 // ShadowRoots should never be cloned. 152 // ShadowRoots should never be cloned.
160 Node* cloneNode(bool) override { return nullptr; } 153 Node* cloneNode(bool) override { return nullptr; }
161 154
162 // FIXME: This shouldn't happen. https://bugs.webkit.org/show_bug.cgi?id=888 34 155 // FIXME: This shouldn't happen. https://bugs.webkit.org/show_bug.cgi?id=888 34
163 bool isOrphan() const { return !host(); } 156 bool isOrphan() const { return !host(); }
164 157
165 void invalidateDescendantSlots();
166 unsigned descendantSlotCount() const;
167
168 Member<ShadowRootRareDataV0> m_shadowRootRareDataV0; 158 Member<ShadowRootRareDataV0> m_shadowRootRareDataV0;
169 Member<StyleSheetList> m_styleSheetList; 159 Member<StyleSheetList> m_styleSheetList;
170 Member<SlotAssignment> m_slotAssignment; 160 Member<SlotAssignment> m_slotAssignment;
171 unsigned m_numberOfStyles : 13; 161 unsigned m_numberOfStyles : 14;
172 unsigned m_childShadowRootCount : 13; 162 unsigned m_childShadowRootCount : 13;
173 unsigned m_type : 2; 163 unsigned m_type : 2;
174 unsigned m_registeredWithParentShadowRoot : 1; 164 unsigned m_registeredWithParentShadowRoot : 1;
175 unsigned m_descendantInsertionPointsIsValid : 1; 165 unsigned m_descendantInsertionPointsIsValid : 1;
176 unsigned m_delegatesFocus : 1; 166 unsigned m_delegatesFocus : 1;
177 unsigned m_descendantSlotsIsValid : 1;
178 }; 167 };
179 168
180 inline Element* ShadowRoot::activeElement() const 169 inline Element* ShadowRoot::activeElement() const
181 { 170 {
182 return adjustedFocusedElement(); 171 return adjustedFocusedElement();
183 } 172 }
184 173
185 inline ShadowRoot* Element::shadowRootIfV1() const 174 inline ShadowRoot* Element::shadowRootIfV1() const
186 { 175 {
187 ShadowRoot* root = this->shadowRoot(); 176 ShadowRoot* root = this->shadowRoot();
188 if (root && root->isV1()) 177 if (root && root->isV1())
189 return root; 178 return root;
190 return nullptr; 179 return nullptr;
191 } 180 }
192 181
193 DEFINE_NODE_TYPE_CASTS(ShadowRoot, isShadowRoot()); 182 DEFINE_NODE_TYPE_CASTS(ShadowRoot, isShadowRoot());
194 DEFINE_TYPE_CASTS(ShadowRoot, TreeScope, treeScope, treeScope->rootNode().isShad owRoot(), treeScope.rootNode().isShadowRoot()); 183 DEFINE_TYPE_CASTS(ShadowRoot, TreeScope, treeScope, treeScope->rootNode().isShad owRoot(), treeScope.rootNode().isShadowRoot());
195 DEFINE_TYPE_CASTS(TreeScope, ShadowRoot, shadowRoot, true, true); 184 DEFINE_TYPE_CASTS(TreeScope, ShadowRoot, shadowRoot, true, true);
196 185
197 CORE_EXPORT std::ostream& operator<<(std::ostream&, const ShadowRootType&); 186 CORE_EXPORT std::ostream& operator<<(std::ostream&, const ShadowRootType&);
198 187
199 } // namespace blink 188 } // namespace blink
200 189
201 #endif // ShadowRoot_h 190 #endif // ShadowRoot_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698