SVGAnimationDiscreteFunctionImpl.h [plain text]
#pragma once
#include "SVGAnimationDiscreteFunction.h"
#include "SVGPropertyTraits.h"
namespace WebCore {
class SVGAnimationBooleanFunction : public SVGAnimationDiscreteFunction<bool> {
public:
using Base = SVGAnimationDiscreteFunction<bool>;
using Base::Base;
void setFromAndToValues(SVGElement*, const String& from, const String& to) override
{
m_from = SVGPropertyTraits<bool>::fromString(from);
m_to = SVGPropertyTraits<bool>::fromString(to);
}
};
template<typename EnumType>
class SVGAnimationEnumerationFunction : public SVGAnimationDiscreteFunction<EnumType> {
using Base = SVGAnimationDiscreteFunction<EnumType>;
using Base::m_from;
using Base::m_to;
public:
using Base::Base;
void setFromAndToValues(SVGElement*, const String& from, const String& to) override
{
m_from = SVGPropertyTraits<EnumType>::fromString(from);
m_to = SVGPropertyTraits<EnumType>::fromString(to);
}
};
class SVGAnimationOrientTypeFunction : public SVGAnimationDiscreteFunction<SVGMarkerOrientType> {
public:
using Base = SVGAnimationDiscreteFunction<SVGMarkerOrientType>;
using Base::Base;
void setFromAndToValues(SVGElement*, const String&, const String&) override
{
ASSERT_NOT_REACHED();
}
private:
friend class SVGAnimatedAngleOrientAnimator;
};
class SVGAnimationPreserveAspectRatioFunction : public SVGAnimationDiscreteFunction<SVGPreserveAspectRatioValue> {
public:
using Base = SVGAnimationDiscreteFunction<SVGPreserveAspectRatioValue>;
using Base::Base;
void setFromAndToValues(SVGElement*, const String& from, const String& to) override
{
m_from = SVGPreserveAspectRatioValue(from);
m_to = SVGPreserveAspectRatioValue(to);
}
};
class SVGAnimationStringFunction : public SVGAnimationDiscreteFunction<String> {
public:
using Base = SVGAnimationDiscreteFunction<String>;
using Base::Base;
void setFromAndToValues(SVGElement*, const String& from, const String& to) override
{
m_from = from;
m_to = to;
}
};
}