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/CustomElementDefinition.h" | 5 #include "core/dom/custom/CustomElementDefinition.h" |
6 | 6 |
7 #include "core/dom/Attr.h" | 7 #include "core/dom/Attr.h" |
8 #include "core/dom/ExceptionCode.h" | 8 #include "core/dom/ExceptionCode.h" |
9 #include "core/dom/custom/CEReactionsScope.h" | 9 #include "core/dom/custom/CEReactionsScope.h" |
10 #include "core/dom/custom/CustomElement.h" | 10 #include "core/dom/custom/CustomElement.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 element->setCustomElementState(CustomElementState::Undefined); | 95 element->setCustomElementState(CustomElementState::Undefined); |
96 // 6.2.2. Enqueue a custom element upgrade reaction given result and | 96 // 6.2.2. Enqueue a custom element upgrade reaction given result and |
97 // definition. | 97 // definition. |
98 enqueueUpgradeReaction(element); | 98 enqueueUpgradeReaction(element); |
99 return element; | 99 return element; |
100 } | 100 } |
101 | 101 |
102 // https://html.spec.whatwg.org/multipage/scripting.html#concept-upgrade-an-elem
ent | 102 // https://html.spec.whatwg.org/multipage/scripting.html#concept-upgrade-an-elem
ent |
103 void CustomElementDefinition::upgrade(Element* element) | 103 void CustomElementDefinition::upgrade(Element* element) |
104 { | 104 { |
| 105 DCHECK_EQ(element->getCustomElementState(), CustomElementState::Undefined); |
| 106 |
105 if (!m_observedAttributes.isEmpty()) | 107 if (!m_observedAttributes.isEmpty()) |
106 enqueueAttributeChangedCallbackForAllAttributes(element); | 108 enqueueAttributeChangedCallbackForAllAttributes(element); |
107 | 109 |
108 if (element->inShadowIncludingDocument() && hasConnectedCallback()) | 110 if (element->inShadowIncludingDocument() && hasConnectedCallback()) |
109 enqueueConnectedCallback(element); | 111 enqueueConnectedCallback(element); |
110 | 112 |
111 m_constructionStack.append(element); | 113 m_constructionStack.append(element); |
112 size_t depth = m_constructionStack.size(); | 114 size_t depth = m_constructionStack.size(); |
113 | 115 |
114 bool succeeded = runConstructor(element); | 116 bool succeeded = runConstructor(element); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 element->synchronizeAttribute(name); | 173 element->synchronizeAttribute(name); |
172 for (const auto& attribute : element->attributesWithoutUpdate()) { | 174 for (const auto& attribute : element->attributesWithoutUpdate()) { |
173 if (hasAttributeChangedCallback(attribute.name())) { | 175 if (hasAttributeChangedCallback(attribute.name())) { |
174 enqueueAttributeChangedCallback(element, attribute.name(), | 176 enqueueAttributeChangedCallback(element, attribute.name(), |
175 nullAtom, attribute.value()); | 177 nullAtom, attribute.value()); |
176 } | 178 } |
177 } | 179 } |
178 } | 180 } |
179 | 181 |
180 } // namespace blink | 182 } // namespace blink |
OLD | NEW |