| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 namespace blink { | 38 namespace blink { |
| 39 | 39 |
| 40 class AnimatableValue : public RefCountedWillBeGarbageCollectedFinalized<Animata
bleValue> { | 40 class AnimatableValue : public RefCountedWillBeGarbageCollectedFinalized<Animata
bleValue> { |
| 41 public: | 41 public: |
| 42 virtual ~AnimatableValue() { } | 42 virtual ~AnimatableValue() { } |
| 43 | 43 |
| 44 static const AnimatableValue* neutralValue(); | 44 static const AnimatableValue* neutralValue(); |
| 45 | 45 |
| 46 static PassRefPtrWillBeRawPtr<AnimatableValue> interpolate(const AnimatableV
alue*, const AnimatableValue*, double fraction); | 46 static PassRefPtrWillBeRawPtr<AnimatableValue> interpolate(const AnimatableV
alue*, const AnimatableValue*, double fraction); |
| 47 static double distance(const AnimatableValue* from, const AnimatableValue* t
o); | |
| 48 static bool usesDefaultInterpolation(const AnimatableValue* from, const Anim
atableValue* to) | 47 static bool usesDefaultInterpolation(const AnimatableValue* from, const Anim
atableValue* to) |
| 49 { | 48 { |
| 50 return !from->isSameType(to) || from->usesDefaultInterpolationWith(to); | 49 return !from->isSameType(to) || from->usesDefaultInterpolationWith(to); |
| 51 } | 50 } |
| 52 | 51 |
| 53 bool equals(const AnimatableValue* value) const | 52 bool equals(const AnimatableValue* value) const |
| 54 { | 53 { |
| 55 return isSameType(value) && equalTo(value); | 54 return isSameType(value) && equalTo(value); |
| 56 } | 55 } |
| 57 bool equals(const AnimatableValue& value) const | 56 bool equals(const AnimatableValue& value) const |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 static PassRefPtrWillBeRawPtr<AnimatableValue> defaultInterpolateTo(const An
imatableValue* left, const AnimatableValue* right, double fraction) { return tak
eConstRef((fraction < 0.5) ? left : right); } | 120 static PassRefPtrWillBeRawPtr<AnimatableValue> defaultInterpolateTo(const An
imatableValue* left, const AnimatableValue* right, double fraction) { return tak
eConstRef((fraction < 0.5) ? left : right); } |
| 122 | 121 |
| 123 template <class T> | 122 template <class T> |
| 124 static PassRefPtrWillBeRawPtr<T> takeConstRef(const T* value) { return PassR
efPtrWillBeRawPtr<T>(const_cast<T*>(value)); } | 123 static PassRefPtrWillBeRawPtr<T> takeConstRef(const T* value) { return PassR
efPtrWillBeRawPtr<T>(const_cast<T*>(value)); } |
| 125 | 124 |
| 126 private: | 125 private: |
| 127 virtual AnimatableType type() const = 0; | 126 virtual AnimatableType type() const = 0; |
| 128 // Implementations can assume that the object being compared has the same ty
pe as the object this is called on | 127 // Implementations can assume that the object being compared has the same ty
pe as the object this is called on |
| 129 virtual bool equalTo(const AnimatableValue*) const = 0; | 128 virtual bool equalTo(const AnimatableValue*) const = 0; |
| 130 | 129 |
| 131 virtual double distanceTo(const AnimatableValue*) const; | |
| 132 | |
| 133 template <class Keyframe> friend class KeyframeEffectModel; | 130 template <class Keyframe> friend class KeyframeEffectModel; |
| 134 }; | 131 }; |
| 135 | 132 |
| 136 #define DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(thisType, predicate) \ | 133 #define DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(thisType, predicate) \ |
| 137 DEFINE_TYPE_CASTS(thisType, AnimatableValue, value, value->predicate, value.
predicate) | 134 DEFINE_TYPE_CASTS(thisType, AnimatableValue, value, value->predicate, value.
predicate) |
| 138 | 135 |
| 139 } // namespace blink | 136 } // namespace blink |
| 140 | 137 |
| 141 #endif // AnimatableValue_h | 138 #endif // AnimatableValue_h |
| OLD | NEW |