Length CSSLengthInterpolationType::resolveInterpolableLength(const InterpolableValue& interpolableValue, const NonInterpolableValue* nonInterpolableValue, const CSSToLengthConversionData& conversionData, ValueRange range)
{
    const InterpolableList& interpolableList = toInterpolableList(interpolableValue);
    bool hasPercentage = CSSLengthNonInterpolableValue::hasPercentage(nonInterpolableValue);
    double pixels = 0;
    double percentage = 0;
    for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) {
        double value = toInterpolableNumber(*interpolableList.get(i)).value();
        if (i == CSSPrimitiveValue::UnitTypePercentage) {
            percentage = value;
        } else {
            CSSPrimitiveValue::UnitType type = CSSPrimitiveValue::lengthUnitTypeToUnitType(static_cast<CSSPrimitiveValue::LengthUnitType>(i));
            pixels += conversionData.zoomedComputedPixels(value, type);
        }
    }
    return createLength(pixels, percentage, hasPercentage, range);
}
Length LengthInterpolationFunctions::createLength(
    const InterpolableValue& interpolableValue,
    const NonInterpolableValue* nonInterpolableValue,
    const CSSToLengthConversionData& conversionData,
    ValueRange range) {
  const InterpolableList& interpolableList =
      toInterpolableList(interpolableValue);
  bool hasPercentage =
      CSSLengthNonInterpolableValue::hasPercentage(nonInterpolableValue);
  double pixels = 0;
  double percentage = 0;
  for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) {
    double value = toInterpolableNumber(*interpolableList.get(i)).value();
    if (value == 0)
      continue;
    if (i == CSSPrimitiveValue::UnitTypePercentage) {
      percentage = value;
    } else {
      CSSPrimitiveValue::UnitType type =
          CSSPrimitiveValue::lengthUnitTypeToUnitType(
              static_cast<CSSPrimitiveValue::LengthUnitType>(i));
      pixels += conversionData.zoomedComputedPixels(value, type);
    }
  }

  if (percentage != 0)
    hasPercentage = true;
  if (pixels != 0 && hasPercentage)
    return Length(
        CalculationValue::create(PixelsAndPercent(pixels, percentage), range));
  if (hasPercentage)
    return Length(clampToRange(percentage, range), Percent);
  return Length(
      CSSPrimitiveValue::clampToCSSLengthRange(clampToRange(pixels, range)),
      Fixed);
}