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

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

Issue 2954843002: Fix upgrading built-in custom elements
Patch Set: Created 3 years, 5 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/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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 const AtomicString& name) const { 263 const AtomicString& name) const {
264 return DefinitionForId(name_id_map_.at(name)); 264 return DefinitionForId(name_id_map_.at(name));
265 } 265 }
266 266
267 CustomElementDefinition* CustomElementRegistry::DefinitionForId( 267 CustomElementDefinition* CustomElementRegistry::DefinitionForId(
268 CustomElementDefinition::Id id) const { 268 CustomElementDefinition::Id id) const {
269 return id ? definitions_[id - 1].Get() : nullptr; 269 return id ? definitions_[id - 1].Get() : nullptr;
270 } 270 }
271 271
272 void CustomElementRegistry::AddCandidate(Element* candidate) { 272 void CustomElementRegistry::AddCandidate(Element* candidate) {
273 const AtomicString& name = candidate->localName(); 273 const AtomicString& isAttribute = candidate->getAttribute(HTMLNames::isAttr);
dominicc (has gone to gerrit) 2017/06/26 03:03:19 I think you should structure this differently, bec
Anton Obzhirov 2017/06/27 19:19:00 Yes, will do, haven’t realized you could mix both.
Anton Obzhirov 2017/06/28 14:09:07 BTW according to https://html.spec.whatwg.org/mult
274 const AtomicString& name =
275 isAttribute.IsNull() ? candidate->localName() : isAttribute;
276
274 if (NameIsDefined(name) || V0NameIsDefined(name)) 277 if (NameIsDefined(name) || V0NameIsDefined(name))
275 return; 278 return;
276 UpgradeCandidateMap::iterator it = upgrade_candidates_->find(name); 279 UpgradeCandidateMap::iterator it = upgrade_candidates_->find(name);
277 UpgradeCandidateSet* set; 280 UpgradeCandidateSet* set;
278 if (it != upgrade_candidates_->end()) { 281 if (it != upgrade_candidates_->end()) {
279 set = it->value; 282 set = it->value;
280 } else { 283 } else {
281 set = upgrade_candidates_->insert(name, new UpgradeCandidateSet()) 284 set = upgrade_candidates_->insert(name, new UpgradeCandidateSet())
282 .stored_value->value; 285 .stored_value->value;
283 } 286 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 upgrade_candidates_->erase(it); 322 upgrade_candidates_->erase(it);
320 323
321 Document* document = owner_->document(); 324 Document* document = owner_->document();
322 if (!document) 325 if (!document)
323 return; 326 return;
324 327
325 sorter.Sorted(elements, document); 328 sorter.Sorted(elements, document);
326 } 329 }
327 330
328 } // namespace blink 331 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698