PairwiseInterpolationValue CSSClipInterpolationType::mergeSingleConversions(InterpolationValue&& start, InterpolationValue&& end) const { const ClipAutos& startAutos = toCSSClipNonInterpolableValue(*start.nonInterpolableValue).clipAutos(); const ClipAutos& endAutos = toCSSClipNonInterpolableValue(*end.nonInterpolableValue).clipAutos(); if (startAutos != endAutos) return nullptr; return PairwiseInterpolationValue(start.interpolableValue.release(), end.interpolableValue.release(), start.nonInterpolableValue.release()); }
void CSSClipInterpolationType::composite(UnderlyingValueOwner& underlyingValueOwner, double underlyingFraction, const InterpolationValue& value, double interpolationFraction) const { const ClipAutos& underlyingAutos = toCSSClipNonInterpolableValue(*underlyingValueOwner.value().nonInterpolableValue).clipAutos(); const ClipAutos& autos = toCSSClipNonInterpolableValue(*value.nonInterpolableValue).clipAutos(); if (underlyingAutos == autos) underlyingValueOwner.mutableValue().interpolableValue->scaleAndAdd(underlyingFraction, *value.interpolableValue); else underlyingValueOwner.set(*this, value); }
void CSSClipInterpolationType::apply(const InterpolableValue& interpolableValue, const NonInterpolableValue* nonInterpolableValue, InterpolationEnvironment& environment) const { const ClipAutos& autos = toCSSClipNonInterpolableValue(nonInterpolableValue)->clipAutos(); const InterpolableList& list = toInterpolableList(interpolableValue); const auto& convertIndex = [&list, &environment](bool isAuto, size_t index) { if (isAuto) return Length(Auto); return CSSLengthInterpolationType::resolveInterpolableLength(*list.get(index), nullptr, environment.state().cssToLengthConversionData(), ValueRangeAll); }; environment.state().style()->setClip(LengthBox( convertIndex(autos.isTopAuto, ClipTop), convertIndex(autos.isRightAuto, ClipRight), convertIndex(autos.isBottomAuto, ClipBottom), convertIndex(autos.isLeftAuto, ClipLeft))); }
static ClipAutos getUnderlyingAutos(const InterpolationValue& underlying) { if (!underlying) return ClipAutos(); return toCSSClipNonInterpolableValue(*underlying.nonInterpolableValue) .clipAutos(); }