SVGStaticListPropertyTearOff.h [plain text]
#pragma once
#include "SVGListProperty.h"
namespace WebCore {
template<typename PropertyType>
class SVGStaticListPropertyTearOff : public SVGListProperty<PropertyType> {
public:
using Self = SVGStaticListPropertyTearOff<PropertyType>;
using Base = SVGListProperty<PropertyType>;
using ListItemType = typename SVGPropertyTraits<PropertyType>::ListItemType;
using ListItemTearOff = typename SVGPropertyTraits<PropertyType>::ListItemTearOff;
using Base::m_role;
using Base::m_values;
static Ref<Self> create(SVGElement& contextElement, PropertyType& values)
{
return adoptRef(*new Self(contextElement, values));
}
ExceptionOr<void> clear()
{
return Base::clearValues();
}
ExceptionOr<ListItemType> initialize(const ListItemType& newItem)
{
return Base::initializeValues(newItem);
}
ExceptionOr<ListItemType> getItem(unsigned index)
{
return Base::getItemValues(index);
}
ExceptionOr<ListItemType> insertItemBefore(const ListItemType& newItem, unsigned index)
{
return Base::insertItemBeforeValues(newItem, index);
}
ExceptionOr<ListItemType> replaceItem(const ListItemType& newItem, unsigned index)
{
return Base::replaceItemValues(newItem, index);
}
ExceptionOr<ListItemType> removeItem(unsigned index)
{
return Base::removeItemValues(index);
}
ExceptionOr<ListItemType> appendItem(const ListItemType& newItem)
{
return Base::appendItemValues(newItem);
}
protected:
SVGStaticListPropertyTearOff(SVGElement* contextElement, PropertyType& values)
: Base(UndefinedRole, values, nullptr)
, m_contextElement(*contextElement)
{
}
bool isReadOnly() const override
{
return m_role == AnimValRole;
}
void commitChange() override
{
ASSERT(m_values);
m_values->commitChange(m_contextElement);
}
bool processIncomingListItemValue(const ListItemType&, unsigned*) override
{
return true;
}
bool processIncomingListItemWrapper(Ref<ListItemTearOff>&, unsigned*) override
{
ASSERT_NOT_REACHED();
return true;
}
Ref<SVGElement> m_contextElement;
};
}