This source file includes following definitions.
- usesDefaultInterpolationWith
- interpolateTo
- addWith
- equalTo
#include "config.h"
#include "core/animation/AnimatableFilterOperations.h"
#include <algorithm>
namespace WebCore {
bool AnimatableFilterOperations::usesDefaultInterpolationWith(const AnimatableValue* value) const
{
const AnimatableFilterOperations* target = toAnimatableFilterOperations(value);
return !operations().canInterpolateWith(target->operations());
}
PassRefPtrWillBeRawPtr<AnimatableValue> AnimatableFilterOperations::interpolateTo(const AnimatableValue* value, double fraction) const
{
if (usesDefaultInterpolationWith(value))
return defaultInterpolateTo(this, value, fraction);
const AnimatableFilterOperations* target = toAnimatableFilterOperations(value);
FilterOperations result;
size_t fromSize = operations().size();
size_t toSize = target->operations().size();
size_t size = std::max(fromSize, toSize);
for (size_t i = 0; i < size; i++) {
FilterOperation* from = (i < fromSize) ? m_operations.operations()[i].get() : 0;
FilterOperation* to = (i < toSize) ? target->m_operations.operations()[i].get() : 0;
RefPtr<FilterOperation> blendedOp = FilterOperation::blend(from, to, fraction);
if (blendedOp)
result.operations().append(blendedOp);
else
ASSERT_NOT_REACHED();
}
return AnimatableFilterOperations::create(result);
}
PassRefPtrWillBeRawPtr<AnimatableValue> AnimatableFilterOperations::addWith(const AnimatableValue* value) const
{
ASSERT_WITH_MESSAGE(false, "Web Animations not yet implemented: AnimatableFilterOperations::addWith()");
return defaultAddWith(this, value);
}
bool AnimatableFilterOperations::equalTo(const AnimatableValue* value) const
{
return operations() == toAnimatableFilterOperations(value)->operations();
}
}