| Index: Source/core/animation/LengthStyleInterpolation.cpp
 | 
| diff --git a/Source/core/animation/LengthStyleInterpolation.cpp b/Source/core/animation/LengthStyleInterpolation.cpp
 | 
| index 8d4996ed1979ebe80e13873e416c5ce50defcf8e..a58d6e0cccdc44b106697354629ddb037b5a9256 100644
 | 
| --- a/Source/core/animation/LengthStyleInterpolation.cpp
 | 
| +++ b/Source/core/animation/LengthStyleInterpolation.cpp
 | 
| @@ -26,18 +26,29 @@ bool LengthStyleInterpolation::canCreateFrom(const CSSValue& value)
 | 
|  
 | 
|  PassOwnPtrWillBeRawPtr<InterpolableValue> LengthStyleInterpolation::lengthToInterpolableValue(const CSSValue& value)
 | 
|  {
 | 
| -    OwnPtrWillBeRawPtr<InterpolableList> result = InterpolableList::create(CSSPrimitiveValue::LengthUnitTypeCount);
 | 
| +    OwnPtrWillBeRawPtr<InterpolableList> listOfValuesAndTypes = InterpolableList::create(2);
 | 
| +    OwnPtrWillBeRawPtr<InterpolableList> listOfValues = InterpolableList::create(CSSPrimitiveValue::LengthUnitTypeCount);
 | 
| +    OwnPtrWillBeRawPtr<InterpolableList> listOfTypes = InterpolableList::create(CSSPrimitiveValue::LengthUnitTypeCount);
 | 
| +
 | 
|      const CSSPrimitiveValue& primitive = toCSSPrimitiveValue(value);
 | 
|  
 | 
| -    CSSLengthArray array;
 | 
| +    CSSLengthArray arrayOfValues;
 | 
| +    CSSPrimitiveValue::CSSLengthTypeArray arrayOfTypes;
 | 
|      for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++)
 | 
| -        array.append(0);
 | 
| -    primitive.accumulateLengthArray(array);
 | 
| +        arrayOfValues.append(0);
 | 
|  
 | 
| -    for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++)
 | 
| -        result->set(i, InterpolableNumber::create(array.at(i)));
 | 
| +    arrayOfTypes.ensureSize(CSSPrimitiveValue::LengthUnitTypeCount);
 | 
| +    primitive.accumulateLengthArray(arrayOfValues, arrayOfTypes);
 | 
|  
 | 
| -    return result.release();
 | 
| +    for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) {
 | 
| +        listOfValues->set(i, InterpolableNumber::create(arrayOfValues.at(i)));
 | 
| +        listOfTypes->set(i, InterpolableNumber::create(arrayOfTypes.get(i)));
 | 
| +    }
 | 
| +
 | 
| +    listOfValuesAndTypes->set(0, listOfValues.release());
 | 
| +    listOfValuesAndTypes->set(1, listOfTypes.release());
 | 
| +
 | 
| +    return listOfValuesAndTypes.release();
 | 
|  }
 | 
|  
 | 
|  namespace {
 | 
| @@ -49,14 +60,17 @@ static CSSPrimitiveValue::UnitType toUnitType(int lengthUnitType)
 | 
|  
 | 
|  static PassRefPtrWillBeRawPtr<CSSCalcExpressionNode> constructCalcExpression(PassRefPtrWillBeRawPtr<CSSCalcExpressionNode> previous, const InterpolableList* list, size_t position)
 | 
|  {
 | 
| +    const InterpolableList* listOfValues = toInterpolableList(list->get(0));
 | 
| +    const InterpolableList* listOfTypes = toInterpolableList(list->get(1));
 | 
|      while (position != CSSPrimitiveValue::LengthUnitTypeCount) {
 | 
| -        const InterpolableNumber *subValue = toInterpolableNumber(list->get(position));
 | 
| -        if (subValue->value()) {
 | 
| +        const InterpolableNumber *subValueType = toInterpolableNumber(listOfTypes->get(position));
 | 
| +        if (subValueType->value()) {
 | 
|              RefPtrWillBeRawPtr<CSSCalcExpressionNode> next;
 | 
| +            double value = toInterpolableNumber(listOfValues->get(position))->value();
 | 
|              if (previous)
 | 
| -                next = CSSCalcValue::createExpressionNode(previous, CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(subValue->value(), toUnitType(position))), CalcAdd);
 | 
| +                next = CSSCalcValue::createExpressionNode(previous, CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(value, toUnitType(position))), CalcAdd);
 | 
|              else
 | 
| -                next = CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(subValue->value(), toUnitType(position)));
 | 
| +                next = CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(value, toUnitType(position)));
 | 
|              return constructCalcExpression(next, list, position + 1);
 | 
|          }
 | 
|          position++;
 | 
| @@ -68,23 +82,25 @@ static PassRefPtrWillBeRawPtr<CSSCalcExpressionNode> constructCalcExpression(Pas
 | 
|  
 | 
|  PassRefPtrWillBeRawPtr<CSSValue> LengthStyleInterpolation::interpolableValueToLength(const InterpolableValue* value, ValueRange range)
 | 
|  {
 | 
| -    const InterpolableList* listValue = toInterpolableList(value);
 | 
| -    unsigned unitCount = 0;
 | 
| +    const InterpolableList* listOfValuesAndTypes = toInterpolableList(value);
 | 
| +    const InterpolableList* listOfValues = toInterpolableList(listOfValuesAndTypes->get(0));
 | 
| +    const InterpolableList* listOfTypes = toInterpolableList(listOfValuesAndTypes->get(1));
 | 
| +    unsigned unitTypeCount = 0;
 | 
|      for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) {
 | 
| -        const InterpolableNumber* subValue = toInterpolableNumber(listValue->get(i));
 | 
| -        if (subValue->value()) {
 | 
| -            unitCount++;
 | 
| +        const InterpolableNumber* subType = toInterpolableNumber(listOfTypes->get(i));
 | 
| +        if (subType->value()) {
 | 
| +            unitTypeCount++;
 | 
|          }
 | 
|      }
 | 
|  
 | 
| -    switch (unitCount) {
 | 
| +    switch (unitTypeCount) {
 | 
|      case 0:
 | 
| -        return CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_PX);
 | 
| +        ASSERT_NOT_REACHED();
 | 
|      case 1:
 | 
|          for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) {
 | 
| -            const InterpolableNumber* subValue = toInterpolableNumber(listValue->get(i));
 | 
| -            double value = subValue->value();
 | 
| -            if (value) {
 | 
| +            const InterpolableNumber *subValueType = toInterpolableNumber(listOfTypes->get(i));
 | 
| +            if (subValueType->value()) {
 | 
| +                double value = toInterpolableNumber(listOfValues->get(i))->value();
 | 
|                  if (range == ValueRangeNonNegative && value < 0)
 | 
|                      value = 0;
 | 
|                  return CSSPrimitiveValue::create(value, toUnitType(i));
 | 
| @@ -92,7 +108,7 @@ PassRefPtrWillBeRawPtr<CSSValue> LengthStyleInterpolation::interpolableValueToLe
 | 
|          }
 | 
|          ASSERT_NOT_REACHED();
 | 
|      default:
 | 
| -        return CSSPrimitiveValue::create(CSSCalcValue::create(constructCalcExpression(nullptr, listValue, 0), range));
 | 
| +        return CSSPrimitiveValue::create(CSSCalcValue::create(constructCalcExpression(nullptr, listOfValuesAndTypes, 0), range));
 | 
|      }
 | 
|  }
 | 
|  
 | 
| 
 |