Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(786)

Side by Side Diff: third_party/WebKit/Source/core/dom/custom/CustomElement.cpp

Issue 2067853002: Upgrade custom elements when inserting a node (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor editorial Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698