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

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

Issue 2058823002: Implement callback reactions for Custom Elements V1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@stack-ce
Patch Set: dominicc review 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/CustomElementsRegistry.h" 5 #include "core/dom/custom/CustomElementsRegistry.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "bindings/core/v8/ScriptCustomElementDefinitionBuilder.h" 8 #include "bindings/core/v8/ScriptCustomElementDefinitionBuilder.h"
9 #include "bindings/core/v8/ScriptPromise.h" 9 #include "bindings/core/v8/ScriptPromise.h"
10 #include "bindings/core/v8/ScriptPromiseResolver.h" 10 #include "bindings/core/v8/ScriptPromiseResolver.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 CustomElementDefinition* definition = builder.build(descriptor); 160 CustomElementDefinition* definition = builder.build(descriptor);
161 CHECK(!exceptionState.hadException()); 161 CHECK(!exceptionState.hadException());
162 CHECK(definition->descriptor() == descriptor); 162 CHECK(definition->descriptor() == descriptor);
163 DefinitionMap::AddResult result = 163 DefinitionMap::AddResult result =
164 m_definitions.add(descriptor.name(), definition); 164 m_definitions.add(descriptor.name(), definition);
165 CHECK(result.isNewEntry); 165 CHECK(result.isNewEntry);
166 166
167 HeapVector<Member<Element>> candidates; 167 HeapVector<Member<Element>> candidates;
168 collectCandidates(descriptor, &candidates); 168 collectCandidates(descriptor, &candidates);
169 for (Element* candidate : candidates) 169 for (Element* candidate : candidates)
170 CustomElement::enqueueUpgradeReaction(candidate, definition); 170 definition->enqueueUpgradeReaction(candidate);
171 171
172 // 19: when-defined promise processing 172 // 19: when-defined promise processing
173 const auto& entry = m_whenDefinedPromiseMap.find(name); 173 const auto& entry = m_whenDefinedPromiseMap.find(name);
174 if (entry == m_whenDefinedPromiseMap.end()) 174 if (entry == m_whenDefinedPromiseMap.end())
175 return; 175 return;
176 entry->value->resolve(); 176 entry->value->resolve();
177 m_whenDefinedPromiseMap.remove(entry); 177 m_whenDefinedPromiseMap.remove(entry);
178 } 178 }
179 179
180 // https://html.spec.whatwg.org/multipage/scripting.html#dom-customelementsregis try-get 180 // https://html.spec.whatwg.org/multipage/scripting.html#dom-customelementsregis try-get
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 if (!element || !desc.matches(*element)) 261 if (!element || !desc.matches(*element))
262 continue; 262 continue;
263 sorter.add(element); 263 sorter.add(element);
264 } 264 }
265 265
266 m_upgradeCandidates->remove(it); 266 m_upgradeCandidates->remove(it);
267 sorter.sorted(elements, m_document.get()); 267 sorter.sorted(elements, m_document.get());
268 } 268 }
269 269
270 } // namespace blink 270 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698