| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PrimitiveInterpolation_h | 5 #ifndef PrimitiveInterpolation_h |
| 6 #define PrimitiveInterpolation_h | 6 #define PrimitiveInterpolation_h |
| 7 | 7 |
| 8 #include "core/animation/TypedInterpolationValue.h" | 8 #include "core/animation/TypedInterpolationValue.h" |
| 9 #include "platform/animation/AnimationUtilities.h" | 9 #include "platform/animation/AnimationUtilities.h" |
| 10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 // eg. "0px" and "100px". | 41 // eg. "0px" and "100px". |
| 42 class PairwisePrimitiveInterpolation : public PrimitiveInterpolation { | 42 class PairwisePrimitiveInterpolation : public PrimitiveInterpolation { |
| 43 public: | 43 public: |
| 44 ~PairwisePrimitiveInterpolation() override {} | 44 ~PairwisePrimitiveInterpolation() override {} |
| 45 | 45 |
| 46 static std::unique_ptr<PairwisePrimitiveInterpolation> create( | 46 static std::unique_ptr<PairwisePrimitiveInterpolation> create( |
| 47 const InterpolationType& type, | 47 const InterpolationType& type, |
| 48 std::unique_ptr<InterpolableValue> start, | 48 std::unique_ptr<InterpolableValue> start, |
| 49 std::unique_ptr<InterpolableValue> end, | 49 std::unique_ptr<InterpolableValue> end, |
| 50 PassRefPtr<NonInterpolableValue> nonInterpolableValue) { | 50 PassRefPtr<NonInterpolableValue> nonInterpolableValue) { |
| 51 return wrapUnique(new PairwisePrimitiveInterpolation( | 51 return WTF::wrapUnique(new PairwisePrimitiveInterpolation( |
| 52 type, std::move(start), std::move(end), | 52 type, std::move(start), std::move(end), |
| 53 std::move(nonInterpolableValue))); | 53 std::move(nonInterpolableValue))); |
| 54 } | 54 } |
| 55 | 55 |
| 56 const InterpolationType& type() const { return m_type; } | 56 const InterpolationType& type() const { return m_type; } |
| 57 | 57 |
| 58 std::unique_ptr<TypedInterpolationValue> initialValue() const { | 58 std::unique_ptr<TypedInterpolationValue> initialValue() const { |
| 59 return TypedInterpolationValue::create(m_type, m_start->clone(), | 59 return TypedInterpolationValue::create(m_type, m_start->clone(), |
| 60 m_nonInterpolableValue); | 60 m_nonInterpolableValue); |
| 61 } | 61 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 // Represents a pair of incompatible keyframes that fall back to 50% flip | 99 // Represents a pair of incompatible keyframes that fall back to 50% flip |
| 100 // behaviour eg. "auto" and "0px". | 100 // behaviour eg. "auto" and "0px". |
| 101 class FlipPrimitiveInterpolation : public PrimitiveInterpolation { | 101 class FlipPrimitiveInterpolation : public PrimitiveInterpolation { |
| 102 public: | 102 public: |
| 103 ~FlipPrimitiveInterpolation() override {} | 103 ~FlipPrimitiveInterpolation() override {} |
| 104 | 104 |
| 105 static std::unique_ptr<FlipPrimitiveInterpolation> create( | 105 static std::unique_ptr<FlipPrimitiveInterpolation> create( |
| 106 std::unique_ptr<TypedInterpolationValue> start, | 106 std::unique_ptr<TypedInterpolationValue> start, |
| 107 std::unique_ptr<TypedInterpolationValue> end) { | 107 std::unique_ptr<TypedInterpolationValue> end) { |
| 108 return wrapUnique( | 108 return WTF::wrapUnique( |
| 109 new FlipPrimitiveInterpolation(std::move(start), std::move(end))); | 109 new FlipPrimitiveInterpolation(std::move(start), std::move(end))); |
| 110 } | 110 } |
| 111 | 111 |
| 112 private: | 112 private: |
| 113 FlipPrimitiveInterpolation(std::unique_ptr<TypedInterpolationValue> start, | 113 FlipPrimitiveInterpolation(std::unique_ptr<TypedInterpolationValue> start, |
| 114 std::unique_ptr<TypedInterpolationValue> end) | 114 std::unique_ptr<TypedInterpolationValue> end) |
| 115 : m_start(std::move(start)), | 115 : m_start(std::move(start)), |
| 116 m_end(std::move(end)), | 116 m_end(std::move(end)), |
| 117 m_lastFraction(std::numeric_limits<double>::quiet_NaN()) {} | 117 m_lastFraction(std::numeric_limits<double>::quiet_NaN()) {} |
| 118 | 118 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 137 bool isFlip() const final { return true; } | 137 bool isFlip() const final { return true; } |
| 138 | 138 |
| 139 std::unique_ptr<TypedInterpolationValue> m_start; | 139 std::unique_ptr<TypedInterpolationValue> m_start; |
| 140 std::unique_ptr<TypedInterpolationValue> m_end; | 140 std::unique_ptr<TypedInterpolationValue> m_end; |
| 141 mutable double m_lastFraction; | 141 mutable double m_lastFraction; |
| 142 }; | 142 }; |
| 143 | 143 |
| 144 } // namespace blink | 144 } // namespace blink |
| 145 | 145 |
| 146 #endif // PrimitiveInterpolation_h | 146 #endif // PrimitiveInterpolation_h |
| OLD | NEW |