| 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef AnimatableValue_h | 31 #ifndef AnimatableValue_h |
| 32 #define AnimatableValue_h | 32 #define AnimatableValue_h |
| 33 | 33 |
| 34 #include "core/animation/AnimationEffect.h" | |
| 35 #include "core/css/CSSValue.h" | 34 #include "core/css/CSSValue.h" |
| 36 #include "wtf/RefCounted.h" | 35 #include "wtf/RefCounted.h" |
| 37 | 36 |
| 38 namespace WebCore { | 37 namespace WebCore { |
| 39 | 38 |
| 40 class AnimatableValue : public AnimationEffect::CompositableValue { | 39 class AnimatableValue : public RefCounted<AnimatableValue> { |
| 41 public: | 40 public: |
| 42 virtual ~AnimatableValue() { } | 41 virtual ~AnimatableValue() { } |
| 43 | 42 |
| 44 static const AnimatableValue* neutralValue(); | 43 static const AnimatableValue* neutralValue(); |
| 45 | 44 |
| 46 static PassRefPtr<AnimatableValue> interpolate(const AnimatableValue*, const
AnimatableValue*, double fraction); | 45 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. | 46 // 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*); | 47 static PassRefPtr<AnimatableValue> add(const AnimatableValue*, const Animata
bleValue*); |
| 49 static double distance(const AnimatableValue* from, const AnimatableValue* t
o); | 48 static double distance(const AnimatableValue* from, const AnimatableValue* t
o); |
| 50 static bool usesDefaultInterpolation(const AnimatableValue* from, const Anim
atableValue* to) | 49 static bool usesDefaultInterpolation(const AnimatableValue* from, const Anim
atableValue* to) |
| 51 { | 50 { |
| 52 return !from->isSameType(to) || from->usesDefaultInterpolationWith(to); | 51 return !from->isSameType(to) || from->usesDefaultInterpolationWith(to); |
| 53 } | 52 } |
| 54 | 53 |
| 55 bool equals(const AnimatableValue* value) const | 54 bool equals(const AnimatableValue* value) const |
| 56 { | 55 { |
| 57 return isSameType(value) && equalTo(value); | 56 return isSameType(value) && equalTo(value); |
| 58 } | 57 } |
| 59 bool equals(const AnimatableValue& value) const | 58 bool equals(const AnimatableValue& value) const |
| 60 { | 59 { |
| 61 return equals(&value); | 60 return equals(&value); |
| 62 } | 61 } |
| 63 | 62 |
| 64 virtual bool dependsOnUnderlyingValue() const OVERRIDE FINAL { return false;
} | |
| 65 virtual PassRefPtr<AnimatableValue> compositeOnto(const AnimatableValue*) co
nst OVERRIDE FINAL { return takeConstRef(this); } | |
| 66 | |
| 67 bool isClipPathOperation() const { return type() == TypeClipPathOperation; } | 63 bool isClipPathOperation() const { return type() == TypeClipPathOperation; } |
| 68 bool isColor() const { return type() == TypeColor; } | 64 bool isColor() const { return type() == TypeColor; } |
| 69 bool isDouble() const { return type() == TypeDouble; } | 65 bool isDouble() const { return type() == TypeDouble; } |
| 70 bool isFilterOperations() const { return type() == TypeFilterOperations; } | 66 bool isFilterOperations() const { return type() == TypeFilterOperations; } |
| 71 bool isImage() const { return type() == TypeImage; } | 67 bool isImage() const { return type() == TypeImage; } |
| 72 bool isLength() const { return type() == TypeLength; } | 68 bool isLength() const { return type() == TypeLength; } |
| 73 bool isLengthBox() const { return type() == TypeLengthBox; } | 69 bool isLengthBox() const { return type() == TypeLengthBox; } |
| 74 bool isLengthBoxAndBool() const { return type() == TypeLengthBoxAndBool; } | 70 bool isLengthBoxAndBool() const { return type() == TypeLengthBoxAndBool; } |
| 75 bool isLengthPoint() const { return type() == TypeLengthPoint; } | 71 bool isLengthPoint() const { return type() == TypeLengthPoint; } |
| 76 bool isLengthSize() const { return type() == TypeLengthSize; } | 72 bool isLengthSize() const { return type() == TypeLengthSize; } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 133 |
| 138 friend class KeyframeEffectModel; | 134 friend class KeyframeEffectModel; |
| 139 }; | 135 }; |
| 140 | 136 |
| 141 #define DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(thisType, predicate) \ | 137 #define DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(thisType, predicate) \ |
| 142 DEFINE_TYPE_CASTS(thisType, AnimatableValue, value, value->predicate, value.
predicate) | 138 DEFINE_TYPE_CASTS(thisType, AnimatableValue, value, value->predicate, value.
predicate) |
| 143 | 139 |
| 144 } // namespace WebCore | 140 } // namespace WebCore |
| 145 | 141 |
| 146 #endif // AnimatableValue_h | 142 #endif // AnimatableValue_h |
| OLD | NEW |