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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 size_t depth = m_constructionStack.size(); | 113 size_t depth = m_constructionStack.size(); |
114 | 114 |
115 bool succeeded = runConstructor(element); | 115 bool succeeded = runConstructor(element); |
116 | 116 |
117 // Pop the construction stack. | 117 // Pop the construction stack. |
118 if (m_constructionStack.last().get()) | 118 if (m_constructionStack.last().get()) |
119 DCHECK_EQ(m_constructionStack.last(), element); | 119 DCHECK_EQ(m_constructionStack.last(), element); |
120 DCHECK_EQ(m_constructionStack.size(), depth); // It's a *stack*. | 120 DCHECK_EQ(m_constructionStack.size(), depth); // It's a *stack*. |
121 m_constructionStack.removeLast(); | 121 m_constructionStack.removeLast(); |
122 | 122 |
123 if (!succeeded) | 123 if (!succeeded) { |
| 124 element->setCustomElementState(CustomElementState::Failed); |
124 return; | 125 return; |
| 126 } |
125 | 127 |
126 CHECK(element->getCustomElementState() == CustomElementState::Custom); | 128 CHECK(element->getCustomElementState() == CustomElementState::Custom); |
127 } | 129 } |
128 | 130 |
129 bool CustomElementDefinition::hasAttributeChangedCallback( | 131 bool CustomElementDefinition::hasAttributeChangedCallback( |
130 const QualifiedName& name) | 132 const QualifiedName& name) |
131 { | 133 { |
132 return m_observedAttributes.contains(name.localName()); | 134 return m_observedAttributes.contains(name.localName()); |
133 } | 135 } |
134 | 136 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 element->synchronizeAttribute(name); | 171 element->synchronizeAttribute(name); |
170 for (const auto& attribute : element->attributesWithoutUpdate()) { | 172 for (const auto& attribute : element->attributesWithoutUpdate()) { |
171 if (hasAttributeChangedCallback(attribute.name())) { | 173 if (hasAttributeChangedCallback(attribute.name())) { |
172 enqueueAttributeChangedCallback(element, attribute.name(), | 174 enqueueAttributeChangedCallback(element, attribute.name(), |
173 nullAtom, attribute.value()); | 175 nullAtom, attribute.value()); |
174 } | 176 } |
175 } | 177 } |
176 } | 178 } |
177 | 179 |
178 } // namespace blink | 180 } // namespace blink |
OLD | NEW |