| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 InterpolableValue_h | 5 #ifndef InterpolableValue_h |
| 6 #define InterpolableValue_h | 6 #define InterpolableValue_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/animation/animatable/AnimatableValue.h" | 9 #include "core/animation/animatable/AnimatableValue.h" |
| 10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 class CORE_EXPORT InterpolableBool final : public InterpolableValue { | 77 class CORE_EXPORT InterpolableBool final : public InterpolableValue { |
| 78 public: | 78 public: |
| 79 static std::unique_ptr<InterpolableBool> create(bool value) | 79 static std::unique_ptr<InterpolableBool> create(bool value) |
| 80 { | 80 { |
| 81 return wrapUnique(new InterpolableBool(value)); | 81 return wrapUnique(new InterpolableBool(value)); |
| 82 } | 82 } |
| 83 | 83 |
| 84 bool isBool() const final { return true; } | 84 bool isBool() const final { return true; } |
| 85 bool value() const { return m_value; } | 85 bool value() const { return m_value; } |
| 86 bool equals(const InterpolableValue&) const final { ASSERT_NOT_REACHED(); re
turn false; } | 86 bool equals(const InterpolableValue&) const final { NOTREACHED(); return fal
se; } |
| 87 std::unique_ptr<InterpolableValue> clone() const final { return create(m_val
ue); } | 87 std::unique_ptr<InterpolableValue> clone() const final { return create(m_val
ue); } |
| 88 std::unique_ptr<InterpolableValue> cloneAndZero() const final { ASSERT_NOT_R
EACHED(); return nullptr; } | 88 std::unique_ptr<InterpolableValue> cloneAndZero() const final { NOTREACHED()
; return nullptr; } |
| 89 void scale(double scale) final { ASSERT_NOT_REACHED(); } | 89 void scale(double scale) final { NOTREACHED(); } |
| 90 void scaleAndAdd(double scale, const InterpolableValue& other) final { ASSER
T_NOT_REACHED(); } | 90 void scaleAndAdd(double scale, const InterpolableValue& other) final { NOTRE
ACHED(); } |
| 91 | 91 |
| 92 private: | 92 private: |
| 93 void interpolate(const InterpolableValue& to, const double progress, Interpo
lableValue& result) const final; | 93 void interpolate(const InterpolableValue& to, const double progress, Interpo
lableValue& result) const final; |
| 94 bool m_value; | 94 bool m_value; |
| 95 | 95 |
| 96 explicit InterpolableBool(bool value) | 96 explicit InterpolableBool(bool value) |
| 97 : m_value(value) | 97 : m_value(value) |
| 98 { | 98 { |
| 99 } | 99 } |
| 100 | 100 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // FIXME: Remove this when we can. | 166 // FIXME: Remove this when we can. |
| 167 class InterpolableAnimatableValue : public InterpolableValue { | 167 class InterpolableAnimatableValue : public InterpolableValue { |
| 168 public: | 168 public: |
| 169 static std::unique_ptr<InterpolableAnimatableValue> create(PassRefPtr<Animat
ableValue> value) | 169 static std::unique_ptr<InterpolableAnimatableValue> create(PassRefPtr<Animat
ableValue> value) |
| 170 { | 170 { |
| 171 return wrapUnique(new InterpolableAnimatableValue(value)); | 171 return wrapUnique(new InterpolableAnimatableValue(value)); |
| 172 } | 172 } |
| 173 | 173 |
| 174 bool isAnimatableValue() const final { return true; } | 174 bool isAnimatableValue() const final { return true; } |
| 175 AnimatableValue* value() const { return m_value.get(); } | 175 AnimatableValue* value() const { return m_value.get(); } |
| 176 bool equals(const InterpolableValue&) const final { ASSERT_NOT_REACHED(); re
turn false; } | 176 bool equals(const InterpolableValue&) const final { NOTREACHED(); return fal
se; } |
| 177 std::unique_ptr<InterpolableValue> clone() const final { return create(m_val
ue); } | 177 std::unique_ptr<InterpolableValue> clone() const final { return create(m_val
ue); } |
| 178 std::unique_ptr<InterpolableValue> cloneAndZero() const final { ASSERT_NOT_R
EACHED(); return nullptr; } | 178 std::unique_ptr<InterpolableValue> cloneAndZero() const final { NOTREACHED()
; return nullptr; } |
| 179 void scale(double scale) final { ASSERT_NOT_REACHED(); } | 179 void scale(double scale) final { NOTREACHED(); } |
| 180 void scaleAndAdd(double scale, const InterpolableValue& other) final { ASSER
T_NOT_REACHED(); } | 180 void scaleAndAdd(double scale, const InterpolableValue& other) final { NOTRE
ACHED(); } |
| 181 | 181 |
| 182 private: | 182 private: |
| 183 void interpolate(const InterpolableValue &to, const double progress, Interpo
lableValue& result) const final; | 183 void interpolate(const InterpolableValue &to, const double progress, Interpo
lableValue& result) const final; |
| 184 RefPtr<AnimatableValue> m_value; | 184 RefPtr<AnimatableValue> m_value; |
| 185 | 185 |
| 186 InterpolableAnimatableValue(PassRefPtr<AnimatableValue> value) | 186 InterpolableAnimatableValue(PassRefPtr<AnimatableValue> value) |
| 187 : m_value(value) | 187 : m_value(value) |
| 188 { | 188 { |
| 189 } | 189 } |
| 190 }; | 190 }; |
| 191 | 191 |
| 192 DEFINE_TYPE_CASTS(InterpolableNumber, InterpolableValue, value, value->isNumber(
), value.isNumber()); | 192 DEFINE_TYPE_CASTS(InterpolableNumber, InterpolableValue, value, value->isNumber(
), value.isNumber()); |
| 193 DEFINE_TYPE_CASTS(InterpolableBool, InterpolableValue, value, value->isBool(), v
alue.isBool()); | 193 DEFINE_TYPE_CASTS(InterpolableBool, InterpolableValue, value, value->isBool(), v
alue.isBool()); |
| 194 DEFINE_TYPE_CASTS(InterpolableList, InterpolableValue, value, value->isList(), v
alue.isList()); | 194 DEFINE_TYPE_CASTS(InterpolableList, InterpolableValue, value, value->isList(), v
alue.isList()); |
| 195 DEFINE_TYPE_CASTS(InterpolableAnimatableValue, InterpolableValue, value, value->
isAnimatableValue(), value.isAnimatableValue()); | 195 DEFINE_TYPE_CASTS(InterpolableAnimatableValue, InterpolableValue, value, value->
isAnimatableValue(), value.isAnimatableValue()); |
| 196 | 196 |
| 197 } // namespace blink | 197 } // namespace blink |
| 198 | 198 |
| 199 #endif | 199 #endif |
| OLD | NEW |