InterpolationValue SVGInterpolationType::maybeConvertSingle(const PropertySpecificKeyframe& keyframe, const InterpolationEnvironment& environment, const InterpolationValue& underlying, ConversionCheckers& conversionCheckers) const { if (keyframe.isNeutral()) return maybeConvertNeutral(underlying, conversionCheckers); SVGPropertyBase* svgValue = environment.svgBaseValue().cloneForAnimation(toSVGPropertySpecificKeyframe(keyframe).value()); return maybeConvertSVGValue(*svgValue); }
InterpolationValue SVGTransformListInterpolationType::maybeConvertSingle( const PropertySpecificKeyframe& keyframe, const InterpolationEnvironment& environment, const InterpolationValue& underlying, ConversionCheckers& conversionCheckers) const { Vector<SVGTransformType> types; Vector<std::unique_ptr<InterpolableValue>> interpolableParts; if (keyframe.composite() == EffectModel::CompositeAdd) { if (underlying) { types.appendVector(getTransformTypes(underlying)); interpolableParts.append(underlying.interpolableValue->clone()); } conversionCheckers.append(SVGTransformListChecker::create(underlying)); } else { DCHECK(!keyframe.isNeutral()); } if (!keyframe.isNeutral()) { SVGPropertyBase* svgValue = environment.svgBaseValue().cloneForAnimation( toSVGPropertySpecificKeyframe(keyframe).value()); InterpolationValue value = maybeConvertSVGValue(*svgValue); if (!value) return nullptr; types.appendVector(getTransformTypes(value)); interpolableParts.append(std::move(value.interpolableValue)); } std::unique_ptr<InterpolableList> interpolableList = InterpolableList::create(types.size()); size_t interpolableListIndex = 0; for (auto& part : interpolableParts) { InterpolableList& list = toInterpolableList(*part); for (size_t i = 0; i < list.length(); ++i) { interpolableList->set(interpolableListIndex, std::move(list.getMutable(i))); ++interpolableListIndex; } } return InterpolationValue(std::move(interpolableList), SVGTransformNonInterpolableValue::create(types)); }
PassRefPtr<Interpolation> SVGPropertySpecificKeyframe::maybeCreateInterpolation(PropertyHandle propertyHandle, Keyframe::PropertySpecificKeyframe& end, Element* element, const ComputedStyle* baseStyle) const { const InterpolationTypes* applicableTypes = applicableTypesForProperty(propertyHandle); if (applicableTypes) return InvalidatableInterpolation::create(propertyHandle, *applicableTypes, *this, end); ASSERT(element); SVGAnimatedPropertyBase* attribute = toSVGElement(element)->propertyFromAttribute(propertyHandle.svgAttribute()); ASSERT(attribute); RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase()->cloneForAnimation(m_value); RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()->cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); if (!fromValue || !toValue) return nullptr; return createSVGInterpolation(fromValue.get(), toValue.get(), attribute); }