#ifndef SVGStringListTearOff_h
#define SVGStringListTearOff_h
#include "core/svg/SVGStringList.h"
#include "core/svg/properties/SVGPropertyTearOff.h"
namespace WebCore {
class SVGStringListTearOff : public SVGPropertyTearOff<SVGStringList>, public ScriptWrappable {
public:
static PassRefPtr<SVGStringListTearOff> create(PassRefPtr<SVGStringList> target, SVGElement* contextElement, PropertyIsAnimValType propertyIsAnimVal, const QualifiedName& attributeName = nullQName())
{
return adoptRef(new SVGStringListTearOff(target, contextElement, propertyIsAnimVal, attributeName));
}
unsigned long length()
{
return target()->length();
}
void clear(ExceptionState& exceptionState)
{
if (isImmutable()) {
exceptionState.throwDOMException(NoModificationAllowedError, "The object is read-only.");
return;
}
target()->clear();
commitChange();
}
String initialize(const String& item, ExceptionState& exceptionState)
{
if (isImmutable()) {
exceptionState.throwDOMException(NoModificationAllowedError, "The object is read-only.");
return String();
}
target()->initialize(item);
commitChange();
return item;
}
String getItem(unsigned long index, ExceptionState& exceptionState)
{
return target()->getItem(index, exceptionState);
}
String insertItemBefore(const String& item, unsigned long index, ExceptionState& exceptionState)
{
if (isImmutable()) {
exceptionState.throwDOMException(NoModificationAllowedError, "The object is read-only.");
return String();
}
target()->insertItemBefore(item, index);
commitChange();
return item;
}
String replaceItem(const String& item, unsigned long index, ExceptionState& exceptionState)
{
if (isImmutable()) {
exceptionState.throwDOMException(NoModificationAllowedError, "The object is read-only.");
return String();
}
target()->replaceItem(item, index, exceptionState);
commitChange();
return item;
}
bool anonymousIndexedSetter(unsigned index, const String& item, ExceptionState& exceptionState)
{
replaceItem(item, index, exceptionState);
return true;
}
String removeItem(unsigned long index, ExceptionState& exceptionState)
{
if (isImmutable()) {
exceptionState.throwDOMException(NoModificationAllowedError, "The object is read-only.");
return String();
}
String removedItem = target()->removeItem(index, exceptionState);
commitChange();
return removedItem;
}
String appendItem(const String& item, ExceptionState& exceptionState)
{
if (isImmutable()) {
exceptionState.throwDOMException(NoModificationAllowedError, "The object is read-only.");
return String();
}
target()->appendItem(item);
commitChange();
return item;
}
protected:
SVGStringListTearOff(PassRefPtr<SVGStringList>, SVGElement*, PropertyIsAnimValType, const QualifiedName&);
};
}
#endif