PassOwnPtr<PairwisePrimitiveInterpolation> CSSLengthInterpolationType::mergeSingleConversions(InterpolationValue& startValue, InterpolationValue& endValue) const { return PairwisePrimitiveInterpolation::create(*this, startValue.mutableComponent().interpolableValue.release(), endValue.mutableComponent().interpolableValue.release(), CSSLengthNonInterpolableValue::merge(startValue.nonInterpolableValue(), endValue.nonInterpolableValue())); }
PassOwnPtr<PairwisePrimitiveInterpolation> SVGNumberListInterpolationType::mergeSingleConversions(InterpolationValue& startValue, InterpolationValue& endValue) const { size_t startLength = toInterpolableList(startValue.interpolableValue()).length(); size_t endLength = toInterpolableList(endValue.interpolableValue()).length(); if (startLength != endLength) return nullptr; return InterpolationType::mergeSingleConversions(startValue, endValue); }
PassOwnPtr<PairwisePrimitiveInterpolation> CSSShadowListInterpolationType::mergeSingleConversions(InterpolationValue& startValue, InterpolationValue& endValue) const { PairwiseInterpolationComponent component = ListInterpolationFunctions::mergeSingleConversions( startValue.mutableComponent(), endValue.mutableComponent(), ShadowInterpolationFunctions::mergeSingleConversions); if (!component) return nullptr; return PairwisePrimitiveInterpolation::create(*this, component); }
PassOwnPtr<PairwisePrimitiveInterpolation> SVGTransformListInterpolationType::mergeSingleConversions(InterpolationValue& startValue, InterpolationValue& endValue) const { if (!transformTypesMatch(startValue, endValue)) return nullptr; return PairwisePrimitiveInterpolation::create(*this, startValue.mutableComponent().interpolableValue.release(), endValue.mutableComponent().interpolableValue.release(), endValue.mutableComponent().nonInterpolableValue.release()); }
PassOwnPtr<PairwisePrimitiveInterpolation> PathInterpolationFunctions::mergeSingleConversions(const InterpolationType& type, InterpolationValue& startValue, InterpolationValue& endValue) { const Vector<SVGPathSegType>& startTypes = toSVGPathNonInterpolableValue(startValue.nonInterpolableValue())->pathSegTypes(); const Vector<SVGPathSegType>& endTypes = toSVGPathNonInterpolableValue(endValue.nonInterpolableValue())->pathSegTypes(); if (!pathSegTypesMatch(startTypes, endTypes)) return nullptr; return PairwisePrimitiveInterpolation::create(type, startValue.mutableComponent().interpolableValue.release(), endValue.mutableComponent().interpolableValue.release(), const_cast<NonInterpolableValue*>(endValue.nonInterpolableValue())); // Take ref. }
void PathInterpolationFunctions::composite(UnderlyingValue& underlyingValue, double underlyingFraction, const InterpolationValue& value) { const InterpolableList& list = toInterpolableList(value.interpolableValue()); double neutralComponent = toInterpolableNumber(list.get(PathNeutralIndex))->value(); if (neutralComponent == 0) { underlyingValue.set(&value); return; } ASSERT(pathSegTypesMatch( toSVGPathNonInterpolableValue(underlyingValue->nonInterpolableValue())->pathSegTypes(), toSVGPathNonInterpolableValue(value.nonInterpolableValue())->pathSegTypes())); underlyingValue.mutableComponent().interpolableValue->scaleAndAdd(neutralComponent, value.interpolableValue()); underlyingValue.mutableComponent().nonInterpolableValue = const_cast<NonInterpolableValue*>(value.nonInterpolableValue()); // Take ref. }
void SVGNumberListInterpolationType::composite(UnderlyingValue& underlyingValue, double underlyingFraction, const InterpolationValue& value) const { const InterpolableList& list = toInterpolableList(value.interpolableValue()); if (toInterpolableList(underlyingValue->interpolableValue()).length() <= list.length()) padWithZeroes(underlyingValue.mutableComponent().interpolableValue, list.length()); InterpolableList& underlyingList = *toInterpolableList(underlyingValue.mutableComponent().interpolableValue.get()); ASSERT(underlyingList.length() >= list.length()); size_t i = 0; for (; i < list.length(); i++) underlyingList.getMutable(i)->scaleAndAdd(underlyingFraction, *list.get(i)); for (; i < underlyingList.length(); i++) underlyingList.getMutable(i)->scale(underlyingFraction); }
InterpolationValue CSSImageInterpolationType::maybeConvertNeutral( const InterpolationValue& underlying, ConversionCheckers& conversionCheckers) const { conversionCheckers.append(UnderlyingImageChecker::create(underlying)); return InterpolationValue(underlying.clone()); }
UnderlyingImageChecker(const InterpolationValue& underlying) : m_underlying(underlying.clone()) {}
void CSSLengthInterpolationType::composite(UnderlyingValue& underlyingValue, double underlyingFraction, const InterpolationValue& value) const { InterpolationComponent& underlyingComponent = underlyingValue.mutableComponent(); underlyingComponent.interpolableValue->scaleAndAdd(underlyingFraction, value.interpolableValue()); underlyingComponent.nonInterpolableValue = CSSLengthNonInterpolableValue::merge(underlyingValue->nonInterpolableValue(), value.nonInterpolableValue()); }