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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 return takeConstRef((fraction < 0.5) ? left : right); | 128 return takeConstRef((fraction < 0.5) ? left : right); |
129 } | 129 } |
130 | 130 |
131 template <class T> | 131 template <class T> |
132 static PassRefPtr<T> takeConstRef(const T* value) { | 132 static PassRefPtr<T> takeConstRef(const T* value) { |
133 return PassRefPtr<T>(const_cast<T*>(value)); | 133 return PassRefPtr<T>(const_cast<T*>(value)); |
134 } | 134 } |
135 | 135 |
136 private: | 136 private: |
137 virtual AnimatableType type() const = 0; | 137 virtual AnimatableType type() const = 0; |
138 // Implementations can assume that the object being compared has the same type
as the object this is called on | 138 // Implementations can assume that the object being compared has the same type |
| 139 // as the object this is called on |
139 virtual bool equalTo(const AnimatableValue*) const = 0; | 140 virtual bool equalTo(const AnimatableValue*) const = 0; |
140 | 141 |
141 template <class Keyframe> | 142 template <class Keyframe> |
142 friend class KeyframeEffectModel; | 143 friend class KeyframeEffectModel; |
143 }; | 144 }; |
144 | 145 |
145 #define DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(thisType, predicate) \ | 146 #define DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(thisType, predicate) \ |
146 DEFINE_TYPE_CASTS(thisType, AnimatableValue, value, value->predicate, \ | 147 DEFINE_TYPE_CASTS(thisType, AnimatableValue, value, value->predicate, \ |
147 value.predicate) | 148 value.predicate) |
148 | 149 |
149 } // namespace blink | 150 } // namespace blink |
150 | 151 |
151 #endif // AnimatableValue_h | 152 #endif // AnimatableValue_h |
OLD | NEW |