This source file includes following definitions.
- toSVGLengthList
- usesDefaultInterpolationWith
- interpolateTo
- trace
#include "config.h"
#include "core/animation/AnimatableStrokeDasharrayList.h"
#include "bindings/v8/ExceptionStatePlaceholder.h"
#include "core/animation/AnimatableSVGLength.h"
namespace WebCore {
AnimatableStrokeDasharrayList::AnimatableStrokeDasharrayList(PassRefPtr<SVGLengthList> passLengths)
{
RefPtr<SVGLengthList> lengths = passLengths;
SVGLengthList::ConstIterator it = lengths->begin();
SVGLengthList::ConstIterator itEnd = lengths->end();
for (; it != itEnd; ++it)
m_values.append(AnimatableSVGLength::create(*it));
}
PassRefPtr<SVGLengthList> AnimatableStrokeDasharrayList::toSVGLengthList() const
{
RefPtr<SVGLengthList> lengths = SVGLengthList::create();
for (size_t i = 0; i < m_values.size(); ++i) {
RefPtr<SVGLength> length = toAnimatableSVGLength(m_values[i].get())->toSVGLength()->clone();
if (length->valueInSpecifiedUnits() < 0)
length->setValueInSpecifiedUnits(0);
lengths->append(length);
}
return lengths.release();
}
bool AnimatableStrokeDasharrayList::usesDefaultInterpolationWith(const AnimatableValue* value) const
{
return false;
}
PassRefPtrWillBeRawPtr<AnimatableValue> AnimatableStrokeDasharrayList::interpolateTo(const AnimatableValue* value, double fraction) const
{
WillBeHeapVector<RefPtrWillBeMember<AnimatableValue> > from = m_values;
WillBeHeapVector<RefPtrWillBeMember<AnimatableValue> > to = toAnimatableStrokeDasharrayList(value)->m_values;
if (from.isEmpty() && to.isEmpty())
return takeConstRef(this);
if (from.isEmpty() || to.isEmpty()) {
#if ENABLE_OILPAN
DEFINE_STATIC_LOCAL(Persistent<AnimatableSVGLength>, zeroPixels, (AnimatableSVGLength::create(SVGLength::create())));
#else
DEFINE_STATIC_REF(AnimatableSVGLength, zeroPixels, AnimatableSVGLength::create(SVGLength::create()).leakRef());
#endif
if (from.isEmpty()) {
from.append(zeroPixels);
from.append(zeroPixels);
}
if (to.isEmpty()) {
to.append(zeroPixels);
to.append(zeroPixels);
}
}
WillBeHeapVector<RefPtrWillBeMember<AnimatableValue> > interpolatedValues;
bool success = interpolateLists(from, to, fraction, interpolatedValues);
ASSERT_UNUSED(success, success);
return adoptRefWillBeNoop(new AnimatableStrokeDasharrayList(interpolatedValues));
}
void AnimatableStrokeDasharrayList::trace(Visitor* visitor)
{
AnimatableRepeatable::trace(visitor);
}
}