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/CustomElementAttributeChangedCallbackReaction.h" | 10 #include "core/dom/custom/CustomElementAttributeChangedCallbackReaction.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 size_t depth = m_constructionStack.size(); | 115 size_t depth = m_constructionStack.size(); |
116 | 116 |
117 bool succeeded = runConstructor(element); | 117 bool succeeded = runConstructor(element); |
118 | 118 |
119 // Pop the construction stack. | 119 // Pop the construction stack. |
120 if (m_constructionStack.last().get()) | 120 if (m_constructionStack.last().get()) |
121 DCHECK_EQ(m_constructionStack.last(), element); | 121 DCHECK_EQ(m_constructionStack.last(), element); |
122 DCHECK_EQ(m_constructionStack.size(), depth); // It's a *stack*. | 122 DCHECK_EQ(m_constructionStack.size(), depth); // It's a *stack*. |
123 m_constructionStack.removeLast(); | 123 m_constructionStack.removeLast(); |
124 | 124 |
125 if (!succeeded) | 125 if (!succeeded) { |
| 126 element->setCustomElementState(CustomElementState::Failed); |
126 return; | 127 return; |
| 128 } |
127 | 129 |
128 CHECK(element->getCustomElementState() == CustomElementState::Custom); | 130 CHECK(element->getCustomElementState() == CustomElementState::Custom); |
129 } | 131 } |
130 | 132 |
131 bool CustomElementDefinition::hasAttributeChangedCallback( | 133 bool CustomElementDefinition::hasAttributeChangedCallback( |
132 const QualifiedName& name) const | 134 const QualifiedName& name) const |
133 { | 135 { |
134 return m_observedAttributes.contains(name.localName()); | 136 return m_observedAttributes.contains(name.localName()); |
135 } | 137 } |
136 | 138 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 element->synchronizeAttribute(name); | 178 element->synchronizeAttribute(name); |
177 for (const auto& attribute : element->attributesWithoutUpdate()) { | 179 for (const auto& attribute : element->attributesWithoutUpdate()) { |
178 if (hasAttributeChangedCallback(attribute.name())) { | 180 if (hasAttributeChangedCallback(attribute.name())) { |
179 enqueueAttributeChangedCallback(element, attribute.name(), | 181 enqueueAttributeChangedCallback(element, attribute.name(), |
180 nullAtom, attribute.value()); | 182 nullAtom, attribute.value()); |
181 } | 183 } |
182 } | 184 } |
183 } | 185 } |
184 | 186 |
185 } // namespace blink | 187 } // namespace blink |
OLD | NEW |