#ifndef AnimatableSVGPaint_h
#define AnimatableSVGPaint_h
#include "core/animation/AnimatableColor.h"
#include "core/animation/AnimatableValue.h"
#include "core/svg/SVGPaint.h"
namespace WebCore {
class AnimatableSVGPaint FINAL : public AnimatableValue {
public:
virtual ~AnimatableSVGPaint() { }
static PassRefPtrWillBeRawPtr<AnimatableSVGPaint> create(SVGPaint::SVGPaintType type, const Color& color, const String& uri)
{
return create(type, AnimatableColorImpl(color), uri);
}
static PassRefPtrWillBeRawPtr<AnimatableSVGPaint> create(SVGPaint::SVGPaintType type, const AnimatableColorImpl& color, const String& uri)
{
return adoptRefWillBeNoop(new AnimatableSVGPaint(type, color, uri));
}
SVGPaint::SVGPaintType paintType() const { return m_type; };
Color color() const { return m_color.toColor(); };
const String& uri() const { return m_uri; };
virtual void trace(Visitor*) OVERRIDE { }
protected:
virtual PassRefPtrWillBeRawPtr<AnimatableValue> interpolateTo(const AnimatableValue*, double fraction) const OVERRIDE;
virtual PassRefPtrWillBeRawPtr<AnimatableValue> addWith(const AnimatableValue*) const OVERRIDE;
virtual bool usesDefaultInterpolationWith(const AnimatableValue*) const OVERRIDE;
private:
AnimatableSVGPaint(SVGPaint::SVGPaintType type, const AnimatableColorImpl& color, const String& uri)
: m_type(type)
, m_color(color)
, m_uri(uri)
{
}
virtual AnimatableType type() const OVERRIDE { return TypeSVGPaint; }
virtual bool equalTo(const AnimatableValue*) const OVERRIDE;
SVGPaint::SVGPaintType m_type;
AnimatableColorImpl m_color;
String m_uri;
};
DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(AnimatableSVGPaint, isSVGPaint());
}
#endif