| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 } | 99 } |
| 100 | 100 |
| 101 // https://html.spec.whatwg.org/multipage/scripting.html#concept-upgrade-an-elem
ent | 101 // https://html.spec.whatwg.org/multipage/scripting.html#concept-upgrade-an-elem
ent |
| 102 void CustomElementDefinition::upgrade(Element* element) | 102 void CustomElementDefinition::upgrade(Element* element) |
| 103 { | 103 { |
| 104 DCHECK_EQ(element->getCustomElementState(), CustomElementState::Undefined); | 104 DCHECK_EQ(element->getCustomElementState(), CustomElementState::Undefined); |
| 105 | 105 |
| 106 if (!m_observedAttributes.isEmpty()) | 106 if (!m_observedAttributes.isEmpty()) |
| 107 enqueueAttributeChangedCallbackForAllAttributes(element); | 107 enqueueAttributeChangedCallbackForAllAttributes(element); |
| 108 | 108 |
| 109 if (element->inShadowIncludingDocument() && hasConnectedCallback()) | 109 if (element->isConnected() && hasConnectedCallback()) |
| 110 enqueueConnectedCallback(element); | 110 enqueueConnectedCallback(element); |
| 111 | 111 |
| 112 m_constructionStack.append(element); | 112 m_constructionStack.append(element); |
| 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); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 element->synchronizeAttribute(name); | 169 element->synchronizeAttribute(name); |
| 170 for (const auto& attribute : element->attributesWithoutUpdate()) { | 170 for (const auto& attribute : element->attributesWithoutUpdate()) { |
| 171 if (hasAttributeChangedCallback(attribute.name())) { | 171 if (hasAttributeChangedCallback(attribute.name())) { |
| 172 enqueueAttributeChangedCallback(element, attribute.name(), | 172 enqueueAttributeChangedCallback(element, attribute.name(), |
| 173 nullAtom, attribute.value()); | 173 nullAtom, attribute.value()); |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 } | 176 } |
| 177 | 177 |
| 178 } // namespace blink | 178 } // namespace blink |
| OLD | NEW |