| Index: third_party/WebKit/Source/core/animation/PairwiseInterpolation.h
 | 
| diff --git a/third_party/WebKit/Source/core/animation/PairwiseInterpolation.h b/third_party/WebKit/Source/core/animation/PairwiseInterpolation.h
 | 
| new file mode 100644
 | 
| index 0000000000000000000000000000000000000000..5043b5af43ea00dc76c128adcc0ddc90747aa315
 | 
| --- /dev/null
 | 
| +++ b/third_party/WebKit/Source/core/animation/PairwiseInterpolation.h
 | 
| @@ -0,0 +1,75 @@
 | 
| +// Copyright 2016 The Chromium Authors. All rights reserved.
 | 
| +// Use of this source code is governed by a BSD-style license that can be
 | 
| +// found in the LICENSE file.
 | 
| +
 | 
| +#ifndef PairwiseInterpolation_h
 | 
| +#define PairwiseInterpolation_h
 | 
| +
 | 
| +#include "core/animation/PrimitiveInterpolation.h"
 | 
| +#include "core/animation/StackableInterpolation.h"
 | 
| +#include "core/animation/TypedInterpolationValue.h"
 | 
| +
 | 
| +namespace blink {
 | 
| +
 | 
| +class PairwiseInterpolation : public StackableInterpolation {
 | 
| +public:
 | 
| +    static PassRefPtr<PairwiseInterpolation> maybeCreate(const InterpolationType& type, InterpolationValue&& start, InterpolationValue&& end)
 | 
| +    {
 | 
| +        PairwiseInterpolationValue merge = type.maybeMergeSingles(start.clone(), end.clone());
 | 
| +        if (!merge)
 | 
| +            return nullptr;
 | 
| +        return adoptRef(new PairwiseInterpolation(type, std::move(start), std::move(end), std::move(merge)));
 | 
| +    }
 | 
| +
 | 
| +    bool isPairwiseInterpolation() const final { return true; }
 | 
| +
 | 
| +    PropertyHandle getProperty() const final
 | 
| +    {
 | 
| +        return m_property;
 | 
| +    }
 | 
| +
 | 
| +protected:
 | 
| +    PairwiseInterpolation(const InterpolationType& type, InterpolationValue&& start, InterpolationValue&& end, PairwiseInterpolationValue&& merge)
 | 
| +        : m_property(type.getProperty())
 | 
| +        , m_start(TypedInterpolationValue::create(type, std::move(start)))
 | 
| +        , m_end(TypedInterpolationValue::create(type, std::move(end)))
 | 
| +        , m_pairwisePrimitiveInterpolation(PairwisePrimitiveInterpolation::create(type, std::move(merge)))
 | 
| +        , m_currentValue(m_pairwisePrimitiveInterpolation->initialValue())
 | 
| +    { }
 | 
| +
 | 
| +    void interpolateImpl() final
 | 
| +    {
 | 
| +        if (m_currentFraction == 0)
 | 
| +            m_currentValue->mutableValue() = m_start->value().clone();
 | 
| +        else if (m_currentFraction == 1)
 | 
| +            m_currentValue->mutableValue() = m_end->value().clone();
 | 
| +        else
 | 
| +            m_pairwisePrimitiveInterpolation->interpolateValue(m_currentFraction, m_currentValue);
 | 
| +    }
 | 
| +
 | 
| +    std::unique_ptr<TypedInterpolationValue> maybeConvertUnderlyingValue(const InterpolationEnvironment&) const final
 | 
| +    {
 | 
| +        NOTREACHED();
 | 
| +        return nullptr;
 | 
| +    }
 | 
| +
 | 
| +    const TypedInterpolationValue* ensureValidInterpolation(const InterpolationEnvironment&, const UnderlyingValueOwner&) const final
 | 
| +    {
 | 
| +        return m_currentValue.get();
 | 
| +    }
 | 
| +
 | 
| +    double underlyingFraction() const final
 | 
| +    {
 | 
| +        return 0;
 | 
| +    }
 | 
| +
 | 
| +    const PropertyHandle m_property;
 | 
| +    const std::unique_ptr<TypedInterpolationValue> m_start;
 | 
| +    const std::unique_ptr<TypedInterpolationValue> m_end;
 | 
| +    const std::unique_ptr<PairwisePrimitiveInterpolation> m_pairwisePrimitiveInterpolation;
 | 
| +    std::unique_ptr<TypedInterpolationValue> m_currentValue;
 | 
| +};
 | 
| +
 | 
| +} // namespace blink
 | 
| +
 | 
| +#endif // PairwiseInterpolation_h
 | 
| 
 |