| 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 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 class AnimatableValue : public AnimationEffect::CompositableValue { | 40 class AnimatableValue : public AnimationEffect::CompositableValue { |
| 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 PassRefPtr<AnimatableValue> interpolate(const AnimatableValue*, const
AnimatableValue*, double fraction); | 46 static PassRefPtr<AnimatableValue> interpolate(const AnimatableValue*, const
AnimatableValue*, double fraction); |
| 47 // For noncommutative values read add(A, B) to mean the value A with B compo
sed onto it. | 47 // For noncommutative values read add(A, B) to mean the value A with B compo
sed onto it. |
| 48 static PassRefPtr<AnimatableValue> add(const AnimatableValue*, const Animata
bleValue*); | 48 static PassRefPtr<AnimatableValue> add(const AnimatableValue*, const Animata
bleValue*); |
| 49 static double distance(const AnimatableValue* from, const AnimatableValue* t
o); |
| 49 static bool usesDefaultInterpolation(const AnimatableValue* from, const Anim
atableValue* to) | 50 static bool usesDefaultInterpolation(const AnimatableValue* from, const Anim
atableValue* to) |
| 50 { | 51 { |
| 51 return !from->isSameType(to) || from->usesDefaultInterpolationWith(to); | 52 return !from->isSameType(to) || from->usesDefaultInterpolationWith(to); |
| 52 } | 53 } |
| 53 | 54 |
| 54 bool equals(const AnimatableValue* value) const | 55 bool equals(const AnimatableValue* value) const |
| 55 { | 56 { |
| 56 return isSameType(value) && equalTo(value); | 57 return isSameType(value) && equalTo(value); |
| 57 } | 58 } |
| 58 bool equals(const AnimatableValue& value) const | 59 bool equals(const AnimatableValue& value) const |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 126 |
| 126 | 127 |
| 127 template <class T> | 128 template <class T> |
| 128 static PassRefPtr<T> takeConstRef(const T* value) { return PassRefPtr<T>(con
st_cast<T*>(value)); } | 129 static PassRefPtr<T> takeConstRef(const T* value) { return PassRefPtr<T>(con
st_cast<T*>(value)); } |
| 129 | 130 |
| 130 private: | 131 private: |
| 131 virtual AnimatableType type() const = 0; | 132 virtual AnimatableType type() const = 0; |
| 132 // Implementations can assume that the object being compared has the same ty
pe as the object this is called on | 133 // Implementations can assume that the object being compared has the same ty
pe as the object this is called on |
| 133 virtual bool equalTo(const AnimatableValue*) const = 0; | 134 virtual bool equalTo(const AnimatableValue*) const = 0; |
| 134 | 135 |
| 136 virtual double distanceTo(const AnimatableValue*) const; |
| 137 |
| 135 friend class KeyframeEffectModel; | 138 friend class KeyframeEffectModel; |
| 136 }; | 139 }; |
| 137 | 140 |
| 138 #define DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(thisType, predicate) \ | 141 #define DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(thisType, predicate) \ |
| 139 DEFINE_TYPE_CASTS(thisType, AnimatableValue, value, value->predicate, value.
predicate) | 142 DEFINE_TYPE_CASTS(thisType, AnimatableValue, value, value->predicate, value.
predicate) |
| 140 | 143 |
| 141 } // namespace WebCore | 144 } // namespace WebCore |
| 142 | 145 |
| 143 #endif // AnimatableValue_h | 146 #endif // AnimatableValue_h |
| OLD | NEW |