#ifndef AnimatableUnknown_h
#define AnimatableUnknown_h
#include "CSSValueKeywords.h"
#include "core/animation/AnimatableValue.h"
#include "core/css/CSSValuePool.h"
namespace WebCore {
class AnimatableUnknown FINAL : public AnimatableValue {
public:
virtual ~AnimatableUnknown() { }
static PassRefPtrWillBeRawPtr<AnimatableUnknown> create(PassRefPtrWillBeRawPtr<CSSValue> value)
{
return adoptRefWillBeNoop(new AnimatableUnknown(value));
}
static PassRefPtrWillBeRawPtr<AnimatableUnknown> create(CSSValueID value)
{
return adoptRefWillBeNoop(new AnimatableUnknown(cssValuePool().createIdentifierValue(value)));
}
PassRefPtrWillBeRawPtr<CSSValue> toCSSValue() const { return m_value; }
CSSValueID toCSSValueID() const { return toCSSPrimitiveValue(m_value.get())->getValueID(); }
virtual void trace(Visitor* visitor) OVERRIDE
{
visitor->trace(m_value);
}
protected:
virtual PassRefPtrWillBeRawPtr<AnimatableValue> interpolateTo(const AnimatableValue* value, double fraction) const OVERRIDE
{
return defaultInterpolateTo(this, value, fraction);
}
virtual bool usesDefaultInterpolationWith(const AnimatableValue*) const OVERRIDE { return true; }
private:
explicit AnimatableUnknown(PassRefPtrWillBeRawPtr<CSSValue> value)
: m_value(value)
{
ASSERT(m_value);
}
virtual AnimatableType type() const OVERRIDE { return TypeUnknown; }
virtual bool equalTo(const AnimatableValue*) const OVERRIDE;
const RefPtrWillBeMember<CSSValue> m_value;
};
DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(AnimatableUnknown, isUnknown());
inline bool AnimatableUnknown::equalTo(const AnimatableValue* value) const
{
const AnimatableUnknown* unknown = toAnimatableUnknown(value);
return m_value == unknown->m_value || m_value->equals(*unknown->m_value);
}
}
#endif