| 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/CustomElement.h" | 9 #include "core/dom/custom/CustomElement.h" |
| 10 #include "core/dom/custom/CustomElementAdoptedCallbackReaction.h" | 10 #include "core/dom/custom/CustomElementAdoptedCallbackReaction.h" |
| 11 #include "core/dom/custom/CustomElementAttributeChangedCallbackReaction.h" | 11 #include "core/dom/custom/CustomElementAttributeChangedCallbackReaction.h" |
| 12 #include "core/dom/custom/CustomElementConnectedCallbackReaction.h" | 12 #include "core/dom/custom/CustomElementConnectedCallbackReaction.h" |
| 13 #include "core/dom/custom/CustomElementDisconnectedCallbackReaction.h" | 13 #include "core/dom/custom/CustomElementDisconnectedCallbackReaction.h" |
| 14 #include "core/dom/custom/CustomElementReaction.h" | 14 #include "core/dom/custom/CustomElementReaction.h" |
| 15 #include "core/dom/custom/CustomElementReactionStack.h" |
| 15 #include "core/dom/custom/CustomElementUpgradeReaction.h" | 16 #include "core/dom/custom/CustomElementUpgradeReaction.h" |
| 16 #include "core/html/HTMLElement.h" | 17 #include "core/html/HTMLElement.h" |
| 17 | 18 |
| 18 namespace blink { | 19 namespace blink { |
| 19 | 20 |
| 20 CustomElementDefinition::CustomElementDefinition( | 21 CustomElementDefinition::CustomElementDefinition( |
| 21 const CustomElementDescriptor& descriptor) | 22 const CustomElementDescriptor& descriptor) |
| 22 : m_descriptor(descriptor) {} | 23 : m_descriptor(descriptor) {} |
| 23 | 24 |
| 24 CustomElementDefinition::CustomElementDefinition( | 25 CustomElementDefinition::CustomElementDefinition( |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 if (element->isConnected() && hasConnectedCallback()) | 148 if (element->isConnected() && hasConnectedCallback()) |
| 148 enqueueConnectedCallback(element); | 149 enqueueConnectedCallback(element); |
| 149 | 150 |
| 150 bool succeeded = false; | 151 bool succeeded = false; |
| 151 { | 152 { |
| 152 ConstructionStackScope constructionStackScope(this, element); | 153 ConstructionStackScope constructionStackScope(this, element); |
| 153 succeeded = runConstructor(element); | 154 succeeded = runConstructor(element); |
| 154 } | 155 } |
| 155 if (!succeeded) { | 156 if (!succeeded) { |
| 156 element->setCustomElementState(CustomElementState::Failed); | 157 element->setCustomElementState(CustomElementState::Failed); |
| 158 CustomElementReactionStack::current().clearQueue(element); |
| 157 return; | 159 return; |
| 158 } | 160 } |
| 159 | 161 |
| 160 element->setCustomElementDefinition(this); | 162 element->setCustomElementDefinition(this); |
| 161 } | 163 } |
| 162 | 164 |
| 163 bool CustomElementDefinition::hasAttributeChangedCallback( | 165 bool CustomElementDefinition::hasAttributeChangedCallback( |
| 164 const QualifiedName& name) const { | 166 const QualifiedName& name) const { |
| 165 return m_observedAttributes.contains(name.localName()); | 167 return m_observedAttributes.contains(name.localName()); |
| 166 } | 168 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 element->synchronizeAttribute(name); | 212 element->synchronizeAttribute(name); |
| 211 for (const auto& attribute : element->attributesWithoutUpdate()) { | 213 for (const auto& attribute : element->attributesWithoutUpdate()) { |
| 212 if (hasAttributeChangedCallback(attribute.name())) { | 214 if (hasAttributeChangedCallback(attribute.name())) { |
| 213 enqueueAttributeChangedCallback(element, attribute.name(), nullAtom, | 215 enqueueAttributeChangedCallback(element, attribute.name(), nullAtom, |
| 214 attribute.value()); | 216 attribute.value()); |
| 215 } | 217 } |
| 216 } | 218 } |
| 217 } | 219 } |
| 218 | 220 |
| 219 } // namespace blink | 221 } // namespace blink |
| OLD | NEW |