PassRefPtrWillBeRawPtr<AnimatableValue> AnimatableRepeatable::interpolateTo(const AnimatableValue* value, double fraction) const { WillBeHeapVector<RefPtrWillBeMember<AnimatableValue>> interpolatedValues; bool success = interpolateLists(m_values, toAnimatableRepeatable(value)->m_values, fraction, interpolatedValues); if (success) return create(interpolatedValues); return defaultInterpolateTo(this, value, fraction); }
bool AnimatableRepeatable::equalTo(const AnimatableValue* value) const { const WillBeHeapVector<RefPtrWillBeMember<AnimatableValue>>& otherValues = toAnimatableRepeatable(value)->m_values; if (m_values.size() != otherValues.size()) return false; for (size_t i = 0; i < m_values.size(); ++i) { if (!m_values[i]->equals(otherValues[i].get())) return false; } return true; }
bool AnimatableRepeatable::usesDefaultInterpolationWith(const AnimatableValue* value) const { const WillBeHeapVector<RefPtrWillBeMember<AnimatableValue>>& fromValues = m_values; const WillBeHeapVector<RefPtrWillBeMember<AnimatableValue>>& toValues = toAnimatableRepeatable(value)->m_values; ASSERT(!fromValues.isEmpty() && !toValues.isEmpty()); size_t size = lowestCommonMultiple(fromValues.size(), toValues.size()); ASSERT(size > 0); for (size_t i = 0; i < size; ++i) { const AnimatableValue* from = fromValues[i % fromValues.size()].get(); const AnimatableValue* to = toValues[i % toValues.size()].get(); // Spec: If a pair of values cannot be interpolated, then the lists are not interpolable. if (AnimatableValue::usesDefaultInterpolation(from, to)) return true; } return false; }
void PrintTo(const AnimatableValue& animValue, ::std::ostream* os) { if (animValue.isClipPathOperation()) PrintTo(*(toAnimatableClipPathOperation(&animValue)), os); else if (animValue.isColor()) PrintTo(*(toAnimatableColor(&animValue)), os); else if (animValue.isDouble()) PrintTo(*(toAnimatableDouble(&animValue)), os); else if (animValue.isImage()) PrintTo(*(toAnimatableImage(&animValue)), os); else if (animValue.isLength()) PrintTo(*(toAnimatableLength(&animValue)), os); else if (animValue.isLengthBox()) PrintTo(*(toAnimatableLengthBox(&animValue)), os); else if (animValue.isLengthPoint()) PrintTo(*(toAnimatableLengthPoint(&animValue)), os); else if (animValue.isLengthSize()) PrintTo(*(toAnimatableLengthSize(&animValue)), os); else if (animValue.isNeutral()) PrintTo(*(static_cast<const AnimatableNeutral*>(&animValue)), os); else if (animValue.isRepeatable()) PrintTo(*(toAnimatableRepeatable(&animValue)), os); else if (animValue.isSVGLength()) PrintTo(*(toAnimatableSVGLength(&animValue)), os); else if (animValue.isSVGPaint()) PrintTo(*(toAnimatableSVGPaint(&animValue)), os); else if (animValue.isShapeValue()) PrintTo(*(toAnimatableShapeValue(&animValue)), os); else if (animValue.isStrokeDasharrayList()) PrintTo(*(toAnimatableStrokeDasharrayList(&animValue)), os); else if (animValue.isTransform()) PrintTo(*(toAnimatableTransform(&animValue)), os); else if (animValue.isUnknown()) PrintTo(*(toAnimatableUnknown(&animValue)), os); else if (animValue.isVisibility()) PrintTo(*(toAnimatableVisibility(&animValue)), os); else *os << "Unknown AnimatableValue - update ifelse chain in AnimatableValueTestHelper.h"; }