This source file includes following definitions.
- usesDefaultInterpolationWith
- interpolateTo
- equalTo
#include "config.h"
#include "core/animation/AnimatableShapeValue.h"
namespace WebCore {
bool AnimatableShapeValue::usesDefaultInterpolationWith(const AnimatableValue* value) const
{
const AnimatableShapeValue* shapeValue = toAnimatableShapeValue(value);
if (m_shape->type() != ShapeValue::Shape
|| shapeValue->m_shape->type() != ShapeValue::Shape
|| m_shape->cssBox() != shapeValue->m_shape->cssBox())
return true;
const BasicShape* fromShape = this->m_shape->shape();
const BasicShape* toShape = shapeValue->m_shape->shape();
return !fromShape->canBlend(toShape);
}
PassRefPtrWillBeRawPtr<AnimatableValue> AnimatableShapeValue::interpolateTo(const AnimatableValue* value, double fraction) const
{
if (usesDefaultInterpolationWith(value))
return defaultInterpolateTo(this, value, fraction);
const AnimatableShapeValue* shapeValue = toAnimatableShapeValue(value);
const BasicShape* fromShape = this->m_shape->shape();
const BasicShape* toShape = shapeValue->m_shape->shape();
return AnimatableShapeValue::create(ShapeValue::createShapeValue(toShape->blend(fromShape, fraction), shapeValue->m_shape->cssBox()).get());
}
bool AnimatableShapeValue::equalTo(const AnimatableValue* value) const
{
const ShapeValue* shape = toAnimatableShapeValue(value)->m_shape.get();
return m_shape == shape || (m_shape && shape && *m_shape == *shape);
}
}