diff options
author | Konstantin Tokarev <annulen@yandex.ru> | 2016-08-25 19:20:41 +0300 |
---|---|---|
committer | Konstantin Tokarev <annulen@yandex.ru> | 2017-02-02 12:30:55 +0000 |
commit | 6882a04fb36642862b11efe514251d32070c3d65 (patch) | |
tree | b7959826000b061fd5ccc7512035c7478742f7b0 /Source/WebCore/html/HTMLOutputElement.cpp | |
parent | ab6df191029eeeb0b0f16f127d553265659f739e (diff) | |
download | qtwebkit-6882a04fb36642862b11efe514251d32070c3d65.tar.gz |
Imported QtWebKit TP3 (git b57bc6801f1876c3220d5a4bfea33d620d477443)
Change-Id: I3b1d8a2808782c9f34d50240000e20cb38d3680f
Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/WebCore/html/HTMLOutputElement.cpp')
-rw-r--r-- | Source/WebCore/html/HTMLOutputElement.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/Source/WebCore/html/HTMLOutputElement.cpp b/Source/WebCore/html/HTMLOutputElement.cpp index f90051dfe..5c02c5e96 100644 --- a/Source/WebCore/html/HTMLOutputElement.cpp +++ b/Source/WebCore/html/HTMLOutputElement.cpp @@ -34,26 +34,28 @@ #include "ExceptionCodePlaceholder.h" #include "HTMLFormElement.h" #include "HTMLNames.h" +#include <wtf/NeverDestroyed.h> namespace WebCore { -inline HTMLOutputElement::HTMLOutputElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form) +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()) { } -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,27 +66,18 @@ 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->attributeValueChanged(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(bool createdByParser, Node* beforeChange, Node* afterChange, int childCountDelta) +void HTMLOutputElement::childrenChanged(const ChildChange& change) { - HTMLFormControlElement::childrenChanged(createdByParser, beforeChange, afterChange, childCountDelta); + HTMLFormControlElement::childrenChanged(change); - if (createdByParser || m_isSetTextContentInProgress) { + if (change.source == ChildChangeSourceParser || m_isSetTextContentInProgress) { m_isSetTextContentInProgress = false; return; } @@ -134,6 +127,13 @@ void HTMLOutputElement::setDefaultValue(const String& value) setTextContentInternal(value); } +DOMTokenList& HTMLOutputElement::htmlFor() +{ + if (!m_tokens) + m_tokens = std::make_unique<AttributeDOMTokenList>(*this, forAttr); + return *m_tokens; +} + void HTMLOutputElement::setTextContentInternal(const String& value) { ASSERT(!m_isSetTextContentInProgress); |