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/LocalDOMWindow.h" | 15 #include "core/frame/LocalDOMWindow.h" |
16 #include "core/html/HTMLElement.h" | 16 #include "core/html/HTMLElement.h" |
17 #include "core/html/HTMLUnknownElement.h" | 17 #include "core/html/HTMLUnknownElement.h" |
18 #include "platform/text/Character.h" | 18 #include "platform/text/Character.h" |
19 #include "wtf/text/AtomicStringHash.h" | 19 #include "wtf/text/AtomicStringHash.h" |
20 | 20 |
21 namespace blink { | 21 namespace blink { |
22 | 22 |
23 CustomElementsRegistry* CustomElement::registry(const Element& element) | 23 CustomElementsRegistry* CustomElement::registry(const Element& element) |
24 { | 24 { |
25 return registry(element.document()); | 25 return registry(element.document()); |
26 } | 26 } |
| 27 |
27 CustomElementsRegistry* CustomElement::registry(const Document& document) | 28 CustomElementsRegistry* CustomElement::registry(const Document& document) |
28 { | 29 { |
29 if (LocalDOMWindow* window = document.domWindow()) | 30 if (LocalDOMWindow* window = document.executingWindow()) |
30 return window->customElements(); | 31 return window->customElements(); |
31 return nullptr; | 32 return nullptr; |
32 } | 33 } |
33 | 34 |
34 static CustomElementDefinition* definitionForElementWithoutCheck(const Element&
element) | 35 static CustomElementDefinition* definitionForElementWithoutCheck(const Element&
element) |
35 { | 36 { |
36 DCHECK_EQ(element.getCustomElementState(), CustomElementState::Custom); | 37 DCHECK_EQ(element.getCustomElementState(), CustomElementState::Custom); |
37 return element.customElementDefinition(); | 38 return element.customElementDefinition(); |
38 } | 39 } |
39 | 40 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 CustomElementsRegistry* registry = CustomElement::registry(*element); | 241 CustomElementsRegistry* registry = CustomElement::registry(*element); |
241 if (!registry) | 242 if (!registry) |
242 return; | 243 return; |
243 if (CustomElementDefinition* definition = registry->definitionForName(elemen
t->localName())) | 244 if (CustomElementDefinition* definition = registry->definitionForName(elemen
t->localName())) |
244 definition->enqueueUpgradeReaction(element); | 245 definition->enqueueUpgradeReaction(element); |
245 else | 246 else |
246 registry->addCandidate(element); | 247 registry->addCandidate(element); |
247 } | 248 } |
248 | 249 |
249 } // namespace blink | 250 } // namespace blink |
OLD | NEW |