This source file includes following definitions.
- m_tokens
- item
- containsInternal
- add
- addInternal
- remove
- removeInternal
- setValue
#include "config.h"
#include "core/dom/DOMSettableTokenList.h"
#include "bindings/v8/ExceptionState.h"
namespace WebCore {
DOMSettableTokenList::DOMSettableTokenList()
: m_value()
, m_tokens()
{
ScriptWrappable::init(this);
}
DOMSettableTokenList::~DOMSettableTokenList()
{
}
const AtomicString DOMSettableTokenList::item(unsigned index) const
{
if (index >= length())
return AtomicString();
return m_tokens[index];
}
bool DOMSettableTokenList::containsInternal(const AtomicString& token) const
{
return m_tokens.contains(token);
}
void DOMSettableTokenList::add(const Vector<String>& tokens, ExceptionState& exceptionState)
{
DOMTokenList::add(tokens, exceptionState);
for (size_t i = 0; i < tokens.size(); ++i) {
if (m_tokens.isNull())
m_tokens.set(AtomicString(tokens[i]), false);
else
m_tokens.add(AtomicString(tokens[i]));
}
}
void DOMSettableTokenList::addInternal(const AtomicString& token)
{
DOMTokenList::addInternal(token);
if (m_tokens.isNull())
m_tokens.set(token, false);
else
m_tokens.add(token);
}
void DOMSettableTokenList::remove(const Vector<String>& tokens, ExceptionState& exceptionState)
{
DOMTokenList::remove(tokens, exceptionState);
for (size_t i = 0; i < tokens.size(); ++i)
m_tokens.remove(AtomicString(tokens[i]));
}
void DOMSettableTokenList::removeInternal(const AtomicString& token)
{
DOMTokenList::removeInternal(token);
m_tokens.remove(token);
}
void DOMSettableTokenList::setValue(const AtomicString& value)
{
m_value = value;
m_tokens.set(value, false);
}
}