void CSSBorderImageLengthBoxInterpolationType::apply( const InterpolableValue& interpolableValue, const NonInterpolableValue* nonInterpolableValue, InterpolationEnvironment& environment) const { const SideNumbers& sideNumbers = toCSSBorderImageLengthBoxNonInterpolableValue(nonInterpolableValue) ->sideNumbers(); const Vector<RefPtr<NonInterpolableValue>>& nonInterpolableValues = toCSSBorderImageLengthBoxNonInterpolableValue(nonInterpolableValue) ->sideNonInterpolableValues(); const InterpolableList& list = toInterpolableList(interpolableValue); const auto& convertSide = [&sideNumbers, &list, &environment, &nonInterpolableValues](size_t index) -> BorderImageLength { if (sideNumbers.isNumber[index]) return clampTo<double>(toInterpolableNumber(list.get(index))->value(), 0); return LengthInterpolationFunctions::createLength( *list.get(index), nonInterpolableValues[index].get(), environment.state().cssToLengthConversionData(), ValueRangeNonNegative); }; BorderImageLengthBox box(convertSide(SideTop), convertSide(SideRight), convertSide(SideBottom), convertSide(SideLeft)); BorderImageLengthBoxPropertyFunctions::setBorderImageLengthBox( cssProperty(), *environment.state().style(), box); }
void CSSImageSliceInterpolationType::apply(const InterpolableValue& interpolableValue, const NonInterpolableValue* nonInterpolableValue, InterpolationEnvironment& environment) const { ComputedStyle& style = *environment.state().style(); const InterpolableList& list = toInterpolableList(interpolableValue); const SliceTypes& types = toCSSImageSliceNonInterpolableValue(nonInterpolableValue)->types(); const auto& convertSide = [&types, &list, &style](size_t index) { float value = clampTo<float>(toInterpolableNumber(list.get(index))->value(), 0); return types.isNumber[index] ? Length(value * style.effectiveZoom(), Fixed) : Length(value, Percent); }; LengthBox box( convertSide(SideTop), convertSide(SideRight), convertSide(SideBottom), convertSide(SideLeft)); ImageSlicePropertyFunctions::setImageSlice(cssProperty(), style, ImageSlice(box, types.fill)); }