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

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: No longer FAIL: imported/wpt/shadow-dom/HTMLSlotElement-interface.html Created 4 years, 6 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 unsigned childShadowRootCount() const { return m_childShadowRootCount; } 107 unsigned childShadowRootCount() const { return m_childShadowRootCount; }
108 unsigned numberOfStyles() const { return m_numberOfStyles; } 108 unsigned numberOfStyles() const { return m_numberOfStyles; }
109 109
110 void recalcStyle(StyleRecalcChange); 110 void recalcStyle(StyleRecalcChange);
111 111
112 void registerScopedHTMLStyleChild(); 112 void registerScopedHTMLStyleChild();
113 void unregisterScopedHTMLStyleChild(); 113 void unregisterScopedHTMLStyleChild();
114 114
115 SlotAssignment& ensureSlotAssignment(); 115 SlotAssignment& ensureSlotAssignment();
116 116
117 void didAddSlot();
118 void didRemoveSlot();
119 const HeapVector<Member<HTMLSlotElement>>& descendantSlots();
120
121 void assignV1();
122 void distributeV1(); 117 void distributeV1();
123 118
124 HTMLSlotElement* assignedSlotFor(const Node&) const;
125
126 Element* activeElement() const; 119 Element* activeElement() const;
127 120
128 String innerHTML() const; 121 String innerHTML() const;
129 void setInnerHTML(const String&, ExceptionState&); 122 void setInnerHTML(const String&, ExceptionState&);
130 123
131 Node* cloneNode(bool, ExceptionState&); 124 Node* cloneNode(bool, ExceptionState&);
132 125
133 void setDelegatesFocus(bool flag) { m_delegatesFocus = flag; } 126 void setDelegatesFocus(bool flag) { m_delegatesFocus = flag; }
134 bool delegatesFocus() const { return m_delegatesFocus; } 127 bool delegatesFocus() const { return m_delegatesFocus; }
135 128
(...skipping 14 matching lines...) Expand all
150 143
151 ShadowRootRareDataV0& ensureShadowRootRareDataV0(); 144 ShadowRootRareDataV0& ensureShadowRootRareDataV0();
152 145
153 void addChildShadowRoot() { ++m_childShadowRootCount; } 146 void addChildShadowRoot() { ++m_childShadowRootCount; }
154 void removeChildShadowRoot() { DCHECK_GT(m_childShadowRootCount, 0u); --m_ch ildShadowRootCount; } 147 void removeChildShadowRoot() { DCHECK_GT(m_childShadowRootCount, 0u); --m_ch ildShadowRootCount; }
155 void invalidateDescendantInsertionPoints(); 148 void invalidateDescendantInsertionPoints();
156 149
157 // ShadowRoots should never be cloned. 150 // ShadowRoots should never be cloned.
158 Node* cloneNode(bool) override { return nullptr; } 151 Node* cloneNode(bool) override { return nullptr; }
159 152
160 void invalidateDescendantSlots();
161 unsigned descendantSlotCount() const;
162
163 Member<ShadowRootRareDataV0> m_shadowRootRareDataV0; 153 Member<ShadowRootRareDataV0> m_shadowRootRareDataV0;
164 Member<StyleSheetList> m_styleSheetList; 154 Member<StyleSheetList> m_styleSheetList;
165 Member<SlotAssignment> m_slotAssignment; 155 Member<SlotAssignment> m_slotAssignment;
166 unsigned m_numberOfStyles : 13; 156 unsigned m_numberOfStyles : 14;
167 unsigned m_childShadowRootCount : 13; 157 unsigned m_childShadowRootCount : 13;
168 unsigned m_type : 2; 158 unsigned m_type : 2;
169 unsigned m_registeredWithParentShadowRoot : 1; 159 unsigned m_registeredWithParentShadowRoot : 1;
170 unsigned m_descendantInsertionPointsIsValid : 1; 160 unsigned m_descendantInsertionPointsIsValid : 1;
171 unsigned m_delegatesFocus : 1; 161 unsigned m_delegatesFocus : 1;
172 unsigned m_descendantSlotsIsValid : 1;
173 }; 162 };
174 163
175 inline Element* ShadowRoot::activeElement() const 164 inline Element* ShadowRoot::activeElement() const
176 { 165 {
177 return adjustedFocusedElement(); 166 return adjustedFocusedElement();
178 } 167 }
179 168
180 inline ShadowRoot* Element::shadowRootIfV1() const 169 inline ShadowRoot* Element::shadowRootIfV1() const
181 { 170 {
182 ShadowRoot* root = this->shadowRoot(); 171 ShadowRoot* root = this->shadowRoot();
183 if (root && root->isV1()) 172 if (root && root->isV1())
184 return root; 173 return root;
185 return nullptr; 174 return nullptr;
186 } 175 }
187 176
188 DEFINE_NODE_TYPE_CASTS(ShadowRoot, isShadowRoot()); 177 DEFINE_NODE_TYPE_CASTS(ShadowRoot, isShadowRoot());
189 DEFINE_TYPE_CASTS(ShadowRoot, TreeScope, treeScope, treeScope->rootNode().isShad owRoot(), treeScope.rootNode().isShadowRoot()); 178 DEFINE_TYPE_CASTS(ShadowRoot, TreeScope, treeScope, treeScope->rootNode().isShad owRoot(), treeScope.rootNode().isShadowRoot());
190 DEFINE_TYPE_CASTS(TreeScope, ShadowRoot, shadowRoot, true, true); 179 DEFINE_TYPE_CASTS(TreeScope, ShadowRoot, shadowRoot, true, true);
191 180
192 CORE_EXPORT std::ostream& operator<<(std::ostream&, const ShadowRootType&); 181 CORE_EXPORT std::ostream& operator<<(std::ostream&, const ShadowRootType&);
193 182
194 } // namespace blink 183 } // namespace blink
195 184
196 #endif // ShadowRoot_h 185 #endif // ShadowRoot_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698