Chromium Code Reviews| Index: third_party/WebKit/Source/core/dom/Document.cpp |
| diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp |
| index 7755997f837a5574ff44bf827390c9cfa208929d..9d214c3afe4173b819ddf1cb8a2ff0be65df21d4 100644 |
| --- a/third_party/WebKit/Source/core/dom/Document.cpp |
| +++ b/third_party/WebKit/Source/core/dom/Document.cpp |
| @@ -44,6 +44,7 @@ |
| #include "bindings/core/v8/V8PerIsolateData.h" |
| #include "bindings/core/v8/WindowProxy.h" |
| #include "core/HTMLElementFactory.h" |
| +#include "core/HTMLElementTypeHelpers.h" |
| #include "core/HTMLNames.h" |
| #include "core/SVGElementFactory.h" |
| #include "core/SVGNames.h" |
| @@ -712,6 +713,12 @@ String getTypeExtension(Document* document, |
| Element* Document::createElement(const AtomicString& localName, |
| const StringOrDictionary& stringOrOptions, |
| ExceptionState& exceptionState) { |
| + const AtomicString& is = |
| + getTypeExtension(this, stringOrOptions, exceptionState).isEmpty() |
| + ? AtomicString() |
| + : AtomicString( |
| + getTypeExtension(this, stringOrOptions, exceptionState)); |
| + |
| if (!isValidName(localName)) { |
| exceptionState.throwDOMException( |
| InvalidCharacterError, |
| @@ -721,9 +728,16 @@ Element* Document::createElement(const AtomicString& localName, |
| Element* element; |
| - if (CustomElement::shouldCreateCustomElement(convertLocalName(localName))) { |
| - element = CustomElement::createCustomElementSync( |
| - *this, convertLocalName(localName)); |
| + int builtin = 0; |
|
dominicc (has gone to gerrit)
2016/11/07 01:59:00
Use bool, not int, for true/false values. C++ 'hel
|
| + if (RuntimeEnabledFeatures::customElementsBuiltinEnabled() && |
| + stringOrOptions.isDictionary()) { |
| + builtin = 1; |
| + } |
| + |
| + if (CustomElement::shouldCreateCustomElement(convertLocalName(localName)) || |
|
dominicc (has gone to gerrit)
2016/11/07 01:58:59
The createElement spec case-converts names sometim
|
| + builtin) { |
| + return CustomElement::createCustomElementSync( |
| + *this, convertLocalName(localName), is); |
| } else if (V0CustomElement::isValidName(localName) && registrationContext()) { |
| element = registrationContext()->createCustomTagElement( |
| *this, QualifiedName(nullAtom, convertLocalName(localName), |
| @@ -734,11 +748,9 @@ Element* Document::createElement(const AtomicString& localName, |
| return nullptr; |
| } |
| - String typeExtention = |
| - getTypeExtension(this, stringOrOptions, exceptionState); |
| - if (!typeExtention.isEmpty()) { |
| - V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension( |
| - element, AtomicString(typeExtention)); |
| + if (!is.isEmpty()) { |
| + V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element, |
| + is); |
| } |
| return element; |