| 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/CustomElement.h" | 5 #include "core/dom/custom/CustomElement.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/dom/QualifiedName.h" | 8 #include "core/dom/QualifiedName.h" |
| 9 #include "core/dom/custom/CustomElementDefinition.h" | 9 #include "core/dom/custom/CustomElementDefinition.h" |
| 10 #include "core/dom/custom/CustomElementsRegistry.h" | 10 #include "core/dom/custom/CustomElementsRegistry.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 void CustomElement::enqueueAttributeChangedCallback(Element* element, | 179 void CustomElement::enqueueAttributeChangedCallback(Element* element, |
| 180 const QualifiedName& name, | 180 const QualifiedName& name, |
| 181 const AtomicString& oldValue, const AtomicString& newValue) | 181 const AtomicString& oldValue, const AtomicString& newValue) |
| 182 { | 182 { |
| 183 DCHECK_EQ(element->getCustomElementState(), CustomElementState::Custom); | 183 DCHECK_EQ(element->getCustomElementState(), CustomElementState::Custom); |
| 184 CustomElementDefinition* definition = definitionForElement(*element); | 184 CustomElementDefinition* definition = definitionForElement(*element); |
| 185 if (definition->hasAttributeChangedCallback(name)) | 185 if (definition->hasAttributeChangedCallback(name)) |
| 186 definition->enqueueAttributeChangedCallback(element, name, oldValue, new
Value); | 186 definition->enqueueAttributeChangedCallback(element, name, oldValue, new
Value); |
| 187 } | 187 } |
| 188 | 188 |
| 189 void CustomElement::tryToUpgrade(Element* element) |
| 190 { |
| 191 // Try to upgrade an element |
| 192 // https://html.spec.whatwg.org/multipage/scripting.html#concept-try-upgrade |
| 193 |
| 194 DCHECK_EQ(element->getCustomElementState(), CustomElementState::Undefined); |
| 195 |
| 196 CustomElementsRegistry* registry = CustomElement::registry(*element); |
| 197 if (!registry) |
| 198 return; |
| 199 if (CustomElementDefinition* definition = registry->definitionForName(elemen
t->localName())) |
| 200 definition->enqueueUpgradeReaction(element); |
| 201 else |
| 202 registry->addCandidate(element); |
| 203 } |
| 204 |
| 189 } // namespace blink | 205 } // namespace blink |
| OLD | NEW |