| 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" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // Push the construction stack. | 128 // Push the construction stack. |
| 129 m_constructionStack.append(element); | 129 m_constructionStack.append(element); |
| 130 m_depth = m_constructionStack.size(); | 130 m_depth = m_constructionStack.size(); |
| 131 } | 131 } |
| 132 | 132 |
| 133 CustomElementDefinition::ConstructionStackScope::~ConstructionStackScope() { | 133 CustomElementDefinition::ConstructionStackScope::~ConstructionStackScope() { |
| 134 // Pop the construction stack. | 134 // Pop the construction stack. |
| 135 DCHECK(!m_constructionStack.last() || | 135 DCHECK(!m_constructionStack.last() || |
| 136 m_constructionStack.last() == m_element); | 136 m_constructionStack.last() == m_element); |
| 137 DCHECK_EQ(m_constructionStack.size(), m_depth); // It's a *stack*. | 137 DCHECK_EQ(m_constructionStack.size(), m_depth); // It's a *stack*. |
| 138 m_constructionStack.removeLast(); | 138 m_constructionStack.pop_back(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 // https://html.spec.whatwg.org/multipage/scripting.html#concept-upgrade-an-elem
ent | 141 // https://html.spec.whatwg.org/multipage/scripting.html#concept-upgrade-an-elem
ent |
| 142 void CustomElementDefinition::upgrade(Element* element) { | 142 void CustomElementDefinition::upgrade(Element* element) { |
| 143 DCHECK_EQ(element->getCustomElementState(), CustomElementState::Undefined); | 143 DCHECK_EQ(element->getCustomElementState(), CustomElementState::Undefined); |
| 144 | 144 |
| 145 if (!m_observedAttributes.isEmpty()) | 145 if (!m_observedAttributes.isEmpty()) |
| 146 enqueueAttributeChangedCallbackForAllAttributes(element); | 146 enqueueAttributeChangedCallbackForAllAttributes(element); |
| 147 | 147 |
| 148 if (element->isConnected() && hasConnectedCallback()) | 148 if (element->isConnected() && hasConnectedCallback()) |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 element->synchronizeAttribute(name); | 212 element->synchronizeAttribute(name); |
| 213 for (const auto& attribute : element->attributesWithoutUpdate()) { | 213 for (const auto& attribute : element->attributesWithoutUpdate()) { |
| 214 if (hasAttributeChangedCallback(attribute.name())) { | 214 if (hasAttributeChangedCallback(attribute.name())) { |
| 215 enqueueAttributeChangedCallback(element, attribute.name(), nullAtom, | 215 enqueueAttributeChangedCallback(element, attribute.name(), nullAtom, |
| 216 attribute.value()); | 216 attribute.value()); |
| 217 } | 217 } |
| 218 } | 218 } |
| 219 } | 219 } |
| 220 | 220 |
| 221 } // namespace blink | 221 } // namespace blink |
| OLD | NEW |