SVGAnimatedPathSegListPropertyTearOff.h [plain text]
#ifndef SVGAnimatedPathSegListPropertyTearOff_h
#define SVGAnimatedPathSegListPropertyTearOff_h
#include "SVGAnimatedListPropertyTearOff.h"
#include "SVGPathByteStream.h"
#include "SVGPathElement.h"
#include "SVGPathSegList.h"
#include "SVGPathSegListPropertyTearOff.h"
#include "SVGPathUtilities.h"
namespace WebCore {
class SVGAnimatedPathSegListPropertyTearOff : public SVGAnimatedListPropertyTearOff<SVGPathSegList> {
public:
virtual SVGListProperty<SVGPathSegList>* baseVal() override
{
if (!m_baseVal)
m_baseVal = SVGPathSegListPropertyTearOff::create(this, BaseValRole, PathSegUnalteredRole, m_values, m_wrappers);
return static_cast<SVGListProperty<SVGPathSegList>*>(m_baseVal.get());
}
virtual SVGListProperty<SVGPathSegList>* animVal() override
{
if (!m_animVal)
m_animVal = SVGPathSegListPropertyTearOff::create(this, AnimValRole, PathSegUnalteredRole, m_values, m_wrappers);
return static_cast<SVGListProperty<SVGPathSegList>*>(m_animVal.get());
}
int findItem(const RefPtr<SVGPathSeg>& segment) const
{
ASSERT(m_baseVal);
return static_cast<SVGPathSegListPropertyTearOff*>(m_baseVal.get())->findItem(segment);
}
void removeItemFromList(size_t itemIndex, bool shouldSynchronizeWrappers)
{
ASSERT(m_baseVal);
static_cast<SVGPathSegListPropertyTearOff*>(m_baseVal.get())->removeItemFromList(itemIndex, shouldSynchronizeWrappers);
}
static PassRefPtr<SVGAnimatedPathSegListPropertyTearOff> create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, SVGPathSegList& values)
{
ASSERT(contextElement);
return adoptRef(new SVGAnimatedPathSegListPropertyTearOff(contextElement, attributeName, animatedPropertyType, values));
}
using SVGAnimatedListPropertyTearOff<SVGPathSegList>::animationStarted;
void animationStarted(SVGPathByteStream* byteStream, const SVGPathSegList* baseValue)
{
ASSERT(byteStream);
ASSERT(baseValue);
ASSERT(!m_animatedPathByteStream);
m_animatedPathByteStream = byteStream;
SVGPathSegList* copy = new SVGPathSegList(*baseValue);
SVGAnimatedListPropertyTearOff<SVGPathSegList>::animationStarted(copy, true);
}
void animationEnded()
{
ASSERT(m_animatedPathByteStream);
m_animatedPathByteStream = 0;
SVGAnimatedListPropertyTearOff<SVGPathSegList>::animationEnded();
}
void animValDidChange()
{
ASSERT(m_animatedPathByteStream);
SVGPathElement* pathElement = toSVGPathElement(contextElement());
if (pathElement->isAnimValObserved()) {
SVGPathSegList& animatedList = currentAnimatedValue();
animatedList.clear();
buildSVGPathSegListFromByteStream(m_animatedPathByteStream, pathElement, animatedList, UnalteredParsing);
}
SVGAnimatedListPropertyTearOff<SVGPathSegList>::animValDidChange();
}
SVGPathByteStream* animatedPathByteStream() const { return m_animatedPathByteStream; }
private:
SVGAnimatedPathSegListPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, SVGPathSegList& values)
: SVGAnimatedListPropertyTearOff<SVGPathSegList>(contextElement, attributeName, animatedPropertyType, values)
, m_animatedPathByteStream(0)
{
}
SVGPathByteStream* m_animatedPathByteStream;
};
}
#endif // SVGAnimatedPathSegListPropertyTearOff_h