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

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

Issue 2023093003: Upgrade in-document custom elements when an element is defined. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ASAN failure in test helper. 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/Element.h"
9 #include "core/dom/QualifiedName.h" 8 #include "core/dom/QualifiedName.h"
10 #include "core/dom/custom/V0CustomElement.h" 9 #include "core/dom/custom/V0CustomElement.h"
11 #include "core/dom/custom/V0CustomElementRegistrationContext.h" 10 #include "core/dom/custom/V0CustomElementRegistrationContext.h"
11 #include "core/frame/LocalDOMWindow.h"
12 #include "core/html/HTMLElement.h" 12 #include "core/html/HTMLElement.h"
13 #include "platform/text/Character.h" 13 #include "platform/text/Character.h"
14 #include "wtf/text/AtomicStringHash.h" 14 #include "wtf/text/AtomicStringHash.h"
15 15
16 namespace blink { 16 namespace blink {
17 17
18 CustomElementsRegistry* CustomElement::registry(const Element& element)
19 {
20 if (LocalDOMWindow* window = element.document().domWindow())
21 return window->customElements();
22 return nullptr;
23 }
24
18 bool CustomElement::isValidName(const AtomicString& name) 25 bool CustomElement::isValidName(const AtomicString& name)
19 { 26 {
20 if (!name.length() || name[0] < 'a' || name[0] > 'z') 27 if (!name.length() || name[0] < 'a' || name[0] > 'z')
21 return false; 28 return false;
22 29
23 bool hasHyphens = false; 30 bool hasHyphens = false;
24 for (size_t i = 1; i < name.length(); ) { 31 for (size_t i = 1; i < name.length(); ) {
25 UChar32 ch; 32 UChar32 ch;
26 if (name.is8Bit()) 33 if (name.is8Bit())
27 ch = name[i++]; 34 ch = name[i++];
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } else { 92 } else {
86 element = HTMLElement::create(tagName, document); 93 element = HTMLElement::create(tagName, document);
87 } 94 }
88 95
89 element->setCustomElementState(CustomElementState::Undefined); 96 element->setCustomElementState(CustomElementState::Undefined);
90 97
91 return element; 98 return element;
92 } 99 }
93 100
94 } // namespace blink 101 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698