#ifndef SVGPoint_h
#define SVGPoint_h
#include "core/svg/properties/SVGProperty.h"
#include "platform/geometry/FloatPoint.h"
namespace WebCore {
class AffineTransform;
class SVGPointTearOff;
class SVGPoint : public SVGPropertyBase {
public:
typedef SVGPointTearOff TearOffType;
static PassRefPtr<SVGPoint> create()
{
return adoptRef(new SVGPoint());
}
static PassRefPtr<SVGPoint> create(const FloatPoint& point)
{
return adoptRef(new SVGPoint(point));
}
PassRefPtr<SVGPoint> clone() const;
virtual PassRefPtr<SVGPropertyBase> cloneForAnimation(const String&) const OVERRIDE;
const FloatPoint& value() const { return m_value; }
void setValue(const FloatPoint& value) { m_value = value; }
float x() const { return m_value.x(); }
float y() const { return m_value.y(); }
void setX(float f) { m_value.setX(f); }
void setY(float f) { m_value.setY(f); }
FloatPoint matrixTransform(const AffineTransform&) const;
bool operator==(const SVGPoint&) const;
bool operator!=(const SVGPoint& other) const { return !operator==(other); }
virtual String valueAsString() const OVERRIDE;
void setValueAsString(const String&, ExceptionState&);
virtual void add(PassRefPtr<SVGPropertyBase>, SVGElement*) OVERRIDE;
virtual void calculateAnimatedValue(SVGAnimationElement*, float percentage, unsigned repeatCount, PassRefPtr<SVGPropertyBase> from, PassRefPtr<SVGPropertyBase> to, PassRefPtr<SVGPropertyBase> toAtEndOfDurationValue, SVGElement* contextElement) OVERRIDE;
virtual float calculateDistance(PassRefPtr<SVGPropertyBase> to, SVGElement* contextElement) OVERRIDE;
static AnimatedPropertyType classType() { return AnimatedPoint; }
private:
SVGPoint();
explicit SVGPoint(const FloatPoint&);
template<typename CharType>
void parse(const CharType*& ptr, const CharType* end, ExceptionState&);
FloatPoint m_value;
};
inline PassRefPtr<SVGPoint> toSVGPoint(PassRefPtr<SVGPropertyBase> passBase)
{
RefPtr<SVGPropertyBase> base = passBase;
ASSERT(base->type() == SVGPoint::classType());
return static_pointer_cast<SVGPoint>(base.release());
}
}
#endif