OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/dom/custom/CustomElement.h" | 5 #include "core/dom/custom/CustomElement.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/dom/QualifiedName.h" | 8 #include "core/dom/QualifiedName.h" |
9 #include "core/dom/custom/CEReactionsScope.h" | 9 #include "core/dom/custom/CEReactionsScope.h" |
10 #include "core/dom/custom/CustomElementDefinition.h" | 10 #include "core/dom/custom/CustomElementDefinition.h" |
11 #include "core/dom/custom/CustomElementReactionStack.h" | 11 #include "core/dom/custom/CustomElementReactionStack.h" |
12 #include "core/dom/custom/CustomElementsRegistry.h" | 12 #include "core/dom/custom/CustomElementsRegistry.h" |
13 #include "core/dom/custom/V0CustomElement.h" | 13 #include "core/dom/custom/V0CustomElement.h" |
14 #include "core/dom/custom/V0CustomElementRegistrationContext.h" | 14 #include "core/dom/custom/V0CustomElementRegistrationContext.h" |
15 #include "core/frame/FrameHost.h" | |
16 #include "core/frame/LocalDOMWindow.h" | 15 #include "core/frame/LocalDOMWindow.h" |
17 #include "core/html/HTMLElement.h" | 16 #include "core/html/HTMLElement.h" |
18 #include "core/html/HTMLUnknownElement.h" | 17 #include "core/html/HTMLUnknownElement.h" |
19 #include "platform/text/Character.h" | 18 #include "platform/text/Character.h" |
20 #include "wtf/text/AtomicStringHash.h" | 19 #include "wtf/text/AtomicStringHash.h" |
21 | 20 |
22 namespace blink { | 21 namespace blink { |
23 | 22 |
24 CustomElementsRegistry* CustomElement::registry(const Element& element) | 23 CustomElementsRegistry* CustomElement::registry(const Element& element) |
25 { | 24 { |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 189 |
191 // If the custom element reactions stack is not empty, then | 190 // If the custom element reactions stack is not empty, then |
192 // Add element to the current element queue. | 191 // Add element to the current element queue. |
193 if (CEReactionsScope* current = CEReactionsScope::current()) { | 192 if (CEReactionsScope* current = CEReactionsScope::current()) { |
194 current->enqueueToCurrentQueue(element, reaction); | 193 current->enqueueToCurrentQueue(element, reaction); |
195 return; | 194 return; |
196 } | 195 } |
197 | 196 |
198 // If the custom element reactions stack is empty, then | 197 // If the custom element reactions stack is empty, then |
199 // Add element to the backup element queue. | 198 // Add element to the backup element queue. |
200 element->document().frameHost()->customElementReactionStack() | 199 CustomElementReactionStack::current().enqueueToBackupQueue(element, reaction
); |
201 .enqueueToBackupQueue(element, reaction); | |
202 } | 200 } |
203 | 201 |
204 void CustomElement::enqueueConnectedCallback(Element* element) | 202 void CustomElement::enqueueConnectedCallback(Element* element) |
205 { | 203 { |
206 CustomElementDefinition* definition = definitionForElementWithoutCheck(*elem
ent); | 204 CustomElementDefinition* definition = definitionForElementWithoutCheck(*elem
ent); |
207 if (definition->hasConnectedCallback()) | 205 if (definition->hasConnectedCallback()) |
208 definition->enqueueConnectedCallback(element); | 206 definition->enqueueConnectedCallback(element); |
209 } | 207 } |
210 | 208 |
211 void CustomElement::enqueueDisconnectedCallback(Element* element) | 209 void CustomElement::enqueueDisconnectedCallback(Element* element) |
(...skipping 30 matching lines...) Expand all Loading... |
242 CustomElementsRegistry* registry = CustomElement::registry(*element); | 240 CustomElementsRegistry* registry = CustomElement::registry(*element); |
243 if (!registry) | 241 if (!registry) |
244 return; | 242 return; |
245 if (CustomElementDefinition* definition = registry->definitionForName(elemen
t->localName())) | 243 if (CustomElementDefinition* definition = registry->definitionForName(elemen
t->localName())) |
246 definition->enqueueUpgradeReaction(element); | 244 definition->enqueueUpgradeReaction(element); |
247 else | 245 else |
248 registry->addCandidate(element); | 246 registry->addCandidate(element); |
249 } | 247 } |
250 | 248 |
251 } // namespace blink | 249 } // namespace blink |
OLD | NEW |