| 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/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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |