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/CustomElementRegistry.h" | 5 #include "core/dom/custom/CustomElementRegistry.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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 192 |
193 HeapVector<Member<Element>> candidates; | 193 HeapVector<Member<Element>> candidates; |
194 collectCandidates(descriptor, &candidates); | 194 collectCandidates(descriptor, &candidates); |
195 for (Element* candidate : candidates) | 195 for (Element* candidate : candidates) |
196 definition->enqueueUpgradeReaction(candidate); | 196 definition->enqueueUpgradeReaction(candidate); |
197 | 197 |
198 // 16: when-defined promise processing | 198 // 16: when-defined promise processing |
199 const auto& entry = m_whenDefinedPromiseMap.find(name); | 199 const auto& entry = m_whenDefinedPromiseMap.find(name); |
200 if (entry != m_whenDefinedPromiseMap.end()) { | 200 if (entry != m_whenDefinedPromiseMap.end()) { |
201 entry->value->resolve(); | 201 entry->value->resolve(); |
202 m_whenDefinedPromiseMap.remove(entry); | 202 m_whenDefinedPromiseMap.erase(entry); |
203 } | 203 } |
204 return definition; | 204 return definition; |
205 } | 205 } |
206 | 206 |
207 // https://html.spec.whatwg.org/multipage/scripting.html#dom-customelementsregis
try-get | 207 // https://html.spec.whatwg.org/multipage/scripting.html#dom-customelementsregis
try-get |
208 ScriptValue CustomElementRegistry::get(const AtomicString& name) { | 208 ScriptValue CustomElementRegistry::get(const AtomicString& name) { |
209 CustomElementDefinition* definition = definitionForName(name); | 209 CustomElementDefinition* definition = definitionForName(name); |
210 if (!definition) { | 210 if (!definition) { |
211 // Binding layer converts |ScriptValue()| to script specific value, | 211 // Binding layer converts |ScriptValue()| to script specific value, |
212 // e.g. |undefined| for v8. | 212 // e.g. |undefined| for v8. |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 UpgradeCandidateMap::iterator it = m_upgradeCandidates->find(desc.name()); | 295 UpgradeCandidateMap::iterator it = m_upgradeCandidates->find(desc.name()); |
296 if (it == m_upgradeCandidates->end()) | 296 if (it == m_upgradeCandidates->end()) |
297 return; | 297 return; |
298 CustomElementUpgradeSorter sorter; | 298 CustomElementUpgradeSorter sorter; |
299 for (Element* element : *it.get()->value) { | 299 for (Element* element : *it.get()->value) { |
300 if (!element || !desc.matches(*element)) | 300 if (!element || !desc.matches(*element)) |
301 continue; | 301 continue; |
302 sorter.add(element); | 302 sorter.add(element); |
303 } | 303 } |
304 | 304 |
305 m_upgradeCandidates->remove(it); | 305 m_upgradeCandidates->erase(it); |
306 | 306 |
307 Document* document = m_owner->document(); | 307 Document* document = m_owner->document(); |
308 if (!document) | 308 if (!document) |
309 return; | 309 return; |
310 | 310 |
311 sorter.sorted(elements, document); | 311 sorter.sorted(elements, document); |
312 } | 312 } |
313 | 313 |
314 } // namespace blink | 314 } // namespace blink |
OLD | NEW |