summaryrefslogtreecommitdiff
path: root/Source/WebCore/html/HTMLOutputElement.cpp
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-05-30 12:48:17 +0200
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-05-30 12:48:17 +0200
commit881da28418d380042aa95a97f0cbd42560a64f7c (patch)
treea794dff3274695e99c651902dde93d934ea7a5af /Source/WebCore/html/HTMLOutputElement.cpp
parent7e104c57a70fdf551bb3d22a5d637cdcbc69dbea (diff)
parent0fcedcd17cc00d3dd44c718b3cb36c1033319671 (diff)
downloadqtwebkit-881da28418d380042aa95a97f0cbd42560a64f7c.tar.gz
Merge 'wip/next' into dev
Change-Id: Iff9ee5e23bb326c4371ec8ed81d56f2f05d680e9
Diffstat (limited to 'Source/WebCore/html/HTMLOutputElement.cpp')
-rw-r--r--Source/WebCore/html/HTMLOutputElement.cpp42
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);