SVGStaticListPropertyTearOff.h [plain text]
#ifndef SVGStaticListPropertyTearOff_h
#define SVGStaticListPropertyTearOff_h
#if ENABLE(SVG)
#include "SVGListProperty.h"
namespace WebCore {
template<typename PropertyType>
class SVGStaticListPropertyTearOff : public SVGListProperty<PropertyType> {
public:
typedef SVGListProperty<PropertyType> Base;
typedef typename SVGPropertyTraits<PropertyType>::ListItemType ListItemType;
typedef SVGPropertyTearOff<ListItemType> ListItemTearOff;
using Base::m_role;
using Base::m_values;
static PassRefPtr<SVGStaticListPropertyTearOff<PropertyType> > create(SVGElement* contextElement, PropertyType& values)
{
ASSERT(contextElement);
return adoptRef(new SVGStaticListPropertyTearOff<PropertyType>(contextElement, values));
}
void clear(ExceptionCode& ec)
{
Base::clearValues(ec);
}
ListItemType initialize(const ListItemType& newItem, ExceptionCode& ec)
{
return Base::initializeValues(newItem, ec);
}
ListItemType getItem(unsigned index, ExceptionCode& ec)
{
return Base::getItemValues(index, ec);
}
ListItemType insertItemBefore(const ListItemType& newItem, unsigned index, ExceptionCode& ec)
{
return Base::insertItemBeforeValues(newItem, index, ec);
}
ListItemType replaceItem(const ListItemType& newItem, unsigned index, ExceptionCode& ec)
{
return Base::replaceItemValues(newItem, index, ec);
}
ListItemType removeItem(unsigned index, ExceptionCode& ec)
{
return Base::removeItemValues(index, ec);
}
ListItemType appendItem(const ListItemType& newItem, ExceptionCode& ec)
{
return Base::appendItemValues(newItem, ec);
}
private:
SVGStaticListPropertyTearOff(SVGElement* contextElement, PropertyType& values)
: SVGListProperty<PropertyType>(UndefinedRole, values, 0)
, m_contextElement(contextElement)
{
}
virtual bool isReadOnly() const
{
return m_role == AnimValRole;
}
virtual void commitChange()
{
ASSERT(m_values);
m_values->commitChange(m_contextElement.get());
}
virtual bool processIncomingListItemValue(const ListItemType&, unsigned*)
{
return true;
}
virtual bool processIncomingListItemWrapper(RefPtr<ListItemTearOff>&, unsigned*)
{
ASSERT_NOT_REACHED();
return true;
}
private:
RefPtr<SVGElement> m_contextElement;
};
}
#endif // ENABLE(SVG)
#endif // SVGStaticListPropertyTearOff_h