diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/html/HTMLOutputElement.cpp | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/html/HTMLOutputElement.cpp')
-rw-r--r-- | Source/WebCore/html/HTMLOutputElement.cpp | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/Source/WebCore/html/HTMLOutputElement.cpp b/Source/WebCore/html/HTMLOutputElement.cpp index c8a80bb03..d9aad97da 100644 --- a/Source/WebCore/html/HTMLOutputElement.cpp +++ b/Source/WebCore/html/HTMLOutputElement.cpp @@ -31,29 +31,30 @@ #include "config.h" #include "HTMLOutputElement.h" -#include "ExceptionCodePlaceholder.h" #include "HTMLFormElement.h" #include "HTMLNames.h" +#include <wtf/NeverDestroyed.h> namespace WebCore { +using namespace HTMLNames; + inline HTMLOutputElement::HTMLOutputElement(const QualifiedName& tagName, Document& document, HTMLFormElement* form) : HTMLFormControlElement(tagName, document, form) , m_isDefaultValueMode(true) , m_isSetTextContentInProgress(false) - , m_defaultValue("") - , m_tokens(DOMSettableTokenList::create()) + , m_defaultValue(emptyString()) { } -PassRefPtr<HTMLOutputElement> HTMLOutputElement::create(const QualifiedName& tagName, Document& document, HTMLFormElement* form) +Ref<HTMLOutputElement> HTMLOutputElement::create(const QualifiedName& tagName, Document& document, HTMLFormElement* form) { - return adoptRef(new HTMLOutputElement(tagName, document, form)); + return adoptRef(*new HTMLOutputElement(tagName, document, form)); } const AtomicString& HTMLOutputElement::formControlType() const { - DEFINE_STATIC_LOCAL(const AtomicString, output, ("output", AtomicString::ConstructFromLiteral)); + static NeverDestroyed<const AtomicString> output("output", AtomicString::ConstructFromLiteral); return output; } @@ -64,22 +65,13 @@ bool HTMLOutputElement::supportsFocus() const void HTMLOutputElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { - if (name == HTMLNames::forAttr) - setFor(value); - else + if (name == forAttr) { + if (m_tokens) + m_tokens->associatedAttributeValueChanged(value); + } else HTMLFormControlElement::parseAttribute(name, value); } -DOMSettableTokenList* HTMLOutputElement::htmlFor() const -{ - return m_tokens.get(); -} - -void HTMLOutputElement::setFor(const String& value) -{ - m_tokens->setValue(value); -} - void HTMLOutputElement::childrenChanged(const ChildChange& change) { HTMLFormControlElement::childrenChanged(change); @@ -134,11 +126,18 @@ void HTMLOutputElement::setDefaultValue(const String& value) setTextContentInternal(value); } +DOMTokenList& HTMLOutputElement::htmlFor() +{ + if (!m_tokens) + m_tokens = std::make_unique<DOMTokenList>(*this, forAttr); + return *m_tokens; +} + void HTMLOutputElement::setTextContentInternal(const String& value) { ASSERT(!m_isSetTextContentInProgress); m_isSetTextContentInProgress = true; - setTextContent(value, IGNORE_EXCEPTION); + setTextContent(value); } } // namespace |