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 19a0e0def294cb5053921d7d5bb703e3e5fb2cef..e4410476034f527f712afa6d24650d097d33f6b4 100644 |
| --- a/third_party/WebKit/Source/core/dom/Document.cpp |
| +++ b/third_party/WebKit/Source/core/dom/Document.cpp |
| @@ -28,6 +28,7 @@ |
| #include "core/dom/Document.h" |
| #include "bindings/core/v8/DOMDataStore.h" |
| +#include "bindings/core/v8/ElementCreationOptionsOrString.h" |
| #include "bindings/core/v8/ExceptionMessages.h" |
| #include "bindings/core/v8/ExceptionState.h" |
| #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
| @@ -73,6 +74,7 @@ |
| #include "core/dom/DocumentParserTiming.h" |
| #include "core/dom/DocumentType.h" |
| #include "core/dom/Element.h" |
| +#include "core/dom/ElementCreationOptions.h" |
| #include "core/dom/ElementDataCache.h" |
| #include "core/dom/ElementRegistrationOptions.h" |
| #include "core/dom/ElementTraversal.h" |
| @@ -660,7 +662,7 @@ Element* Document::createElement(const AtomicString& name, ExceptionState& excep |
| return Element::create(QualifiedName(nullAtom, name, nullAtom), this); |
| } |
| -Element* Document::createElement(const AtomicString& localName, const AtomicString& typeExtension, ExceptionState& exceptionState) |
| +Element* Document::createElement(const AtomicString& localName, const ElementCreationOptionsOrString& optionsOrString, ExceptionState& exceptionState) |
| { |
| if (!isValidName(localName)) { |
| exceptionState.throwDOMException(InvalidCharacterError, "The tag name provided ('" + localName + "') is not a valid name."); |
| @@ -679,8 +681,12 @@ Element* Document::createElement(const AtomicString& localName, const AtomicStri |
| return nullptr; |
| } |
| - if (!typeExtension.isEmpty()) |
| - V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element, typeExtension); |
| + if (optionsOrString.isString() && !optionsOrString.getAsString().isEmpty()) { |
|
dominicc (has gone to gerrit)
2016/09/15 01:19:24
I wonder if the existing code does toString on non
Anton Obzhirov
2016/09/15 09:25:20
Will check, good point, will need to figure out ho
|
| + V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element, AtomicString(optionsOrString.getAsString())); |
| + Deprecation::countDeprecation(this, UseCounter::DocumentCreateElement2ndArg); |
| + } else if (optionsOrString.isElementCreationOptions() && !optionsOrString.getAsElementCreationOptions().is().isEmpty()) { |
| + V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element, AtomicString(optionsOrString.getAsElementCreationOptions().is())); |
| + } |
| return element; |
| } |
| @@ -711,7 +717,7 @@ Element* Document::createElementNS(const AtomicString& namespaceURI, const Atomi |
| return createElement(qName, CreatedByCreateElement); |
| } |
| -Element* Document::createElementNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& typeExtension, ExceptionState& exceptionState) |
| +Element* Document::createElementNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, const ElementCreationOptionsOrString& optionsOrString, ExceptionState& exceptionState) |
| { |
| QualifiedName qName(createQualifiedName(namespaceURI, qualifiedName, exceptionState)); |
| if (qName == QualifiedName::null()) |
| @@ -725,8 +731,12 @@ Element* Document::createElementNS(const AtomicString& namespaceURI, const Atomi |
| else |
| element = createElement(qName, CreatedByCreateElement); |
| - if (!typeExtension.isEmpty()) |
| - V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element, typeExtension); |
| + if (optionsOrString.isString() && !optionsOrString.getAsString().isEmpty()) { |
| + V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element, AtomicString(optionsOrString.getAsString())); |
| + Deprecation::countDeprecation(this, UseCounter::DocumentCreateElement2ndArg); |
| + } else if (optionsOrString.isElementCreationOptions() && !optionsOrString.getAsElementCreationOptions().is().isEmpty()) { |
| + V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element, AtomicString(optionsOrString.getAsElementCreationOptions().is())); |
| + } |
| return element; |
| } |