| 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/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" | 8 #include "core/dom/Element.h" |
| 9 #include "core/dom/QualifiedName.h" | 9 #include "core/dom/QualifiedName.h" |
| 10 #include "core/dom/custom/V0CustomElement.h" | 10 #include "core/dom/custom/V0CustomElement.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 { | 67 { |
| 68 return createCustomElement(document, | 68 return createCustomElement(document, |
| 69 QualifiedName(nullAtom, document.convertLocalName(localName), HTMLNames:
:xhtmlNamespaceURI), | 69 QualifiedName(nullAtom, document.convertLocalName(localName), HTMLNames:
:xhtmlNamespaceURI), |
| 70 flags); | 70 flags); |
| 71 } | 71 } |
| 72 | 72 |
| 73 HTMLElement* CustomElement::createCustomElement(Document& document, const Qualif
iedName& tagName, CreateElementFlags flags) | 73 HTMLElement* CustomElement::createCustomElement(Document& document, const Qualif
iedName& tagName, CreateElementFlags flags) |
| 74 { | 74 { |
| 75 DCHECK(shouldCreateCustomElement(document, tagName)); | 75 DCHECK(shouldCreateCustomElement(document, tagName)); |
| 76 | 76 |
| 77 if (flags & DisableCustomElements) |
| 78 return HTMLElement::create(tagName, document); |
| 79 |
| 77 // TODO(kojii): Look up already defined custom elements when custom element | 80 // TODO(kojii): Look up already defined custom elements when custom element |
| 78 // queues and upgrade are implemented. | 81 // queues and upgrade are implemented. |
| 79 | 82 |
| 80 HTMLElement* element; | 83 HTMLElement* element; |
| 81 if (V0CustomElement::isValidName(tagName.localName()) && document.registrati
onContext()) { | 84 if (V0CustomElement::isValidName(tagName.localName()) && document.registrati
onContext()) { |
| 82 Element* v0element = document.registrationContext()->createCustomTagElem
ent(document, tagName); | 85 Element* v0element = document.registrationContext()->createCustomTagElem
ent(document, tagName); |
| 83 SECURITY_DCHECK(v0element->isHTMLElement()); | 86 SECURITY_DCHECK(v0element->isHTMLElement()); |
| 84 element = toHTMLElement(v0element); | 87 element = toHTMLElement(v0element); |
| 85 } else { | 88 } else { |
| 86 element = HTMLElement::create(tagName, document); | 89 element = HTMLElement::create(tagName, document); |
| 87 } | 90 } |
| 88 | 91 |
| 89 element->setCustomElementState(CustomElementState::Undefined); | 92 element->setCustomElementState(CustomElementState::Undefined); |
| 90 | 93 |
| 91 return element; | 94 return element; |
| 92 } | 95 } |
| 93 | 96 |
| 94 } // namespace blink | 97 } // namespace blink |
| OLD | NEW |