This source file includes following definitions.
- m_tokens
- create
- formControlType
- supportsFocus
- parseAttribute
- htmlFor
- setFor
- childrenChanged
- resetImpl
- value
- setValue
- defaultValue
- setDefaultValue
#include "config.h"
#include "core/html/HTMLOutputElement.h"
#include "HTMLNames.h"
#include "bindings/v8/ExceptionStatePlaceholder.h"
namespace WebCore {
inline HTMLOutputElement::HTMLOutputElement(Document& document, HTMLFormElement* form)
: HTMLFormControlElement(HTMLNames::outputTag, document, form)
, m_isDefaultValueMode(true)
, m_defaultValue("")
, m_tokens(DOMSettableTokenList::create())
{
ScriptWrappable::init(this);
}
PassRefPtr<HTMLOutputElement> HTMLOutputElement::create(Document& document, HTMLFormElement* form)
{
return adoptRef(new HTMLOutputElement(document, form));
}
const AtomicString& HTMLOutputElement::formControlType() const
{
DEFINE_STATIC_LOCAL(const AtomicString, output, ("output", AtomicString::ConstructFromLiteral));
return output;
}
bool HTMLOutputElement::supportsFocus() const
{
return HTMLElement::supportsFocus();
}
void HTMLOutputElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == HTMLNames::forAttr)
setFor(value);
else
HTMLFormControlElement::parseAttribute(name, value);
}
DOMSettableTokenList* HTMLOutputElement::htmlFor() const
{
return m_tokens.get();
}
void HTMLOutputElement::setFor(const AtomicString& value)
{
m_tokens->setValue(value);
}
void HTMLOutputElement::childrenChanged(bool createdByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
{
HTMLFormControlElement::childrenChanged(createdByParser, beforeChange, afterChange, childCountDelta);
if (m_isDefaultValueMode)
m_defaultValue = textContent();
}
void HTMLOutputElement::resetImpl()
{
if (m_defaultValue == value())
return;
setTextContent(m_defaultValue);
m_isDefaultValueMode = true;
}
String HTMLOutputElement::value() const
{
return textContent();
}
void HTMLOutputElement::setValue(const String& value)
{
m_isDefaultValueMode = false;
if (value == this->value())
return;
setTextContent(value);
}
String HTMLOutputElement::defaultValue() const
{
return m_defaultValue;
}
void HTMLOutputElement::setDefaultValue(const String& value)
{
if (m_defaultValue == value)
return;
m_defaultValue = value;
if (m_isDefaultValueMode)
setTextContent(value);
}
}