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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 bool isClipPathOperation() const { return type() == TypeClipPathOperation; } | 49 bool isClipPathOperation() const { return type() == TypeClipPathOperation; } |
50 bool isColor() const { return type() == TypeColor; } | 50 bool isColor() const { return type() == TypeColor; } |
51 bool isDouble() const { return type() == TypeDouble; } | 51 bool isDouble() const { return type() == TypeDouble; } |
52 bool isImage() const { return type() == TypeImage; } | 52 bool isImage() const { return type() == TypeImage; } |
53 bool isLength() const { return type() == TypeLength; } | 53 bool isLength() const { return type() == TypeLength; } |
54 bool isLengthBox() const { return type() == TypeLengthBox; } | 54 bool isLengthBox() const { return type() == TypeLengthBox; } |
55 bool isLengthSize() const { return type() == TypeLengthSize; } | 55 bool isLengthSize() const { return type() == TypeLengthSize; } |
56 bool isNeutral() const { return type() == TypeNeutral; } | 56 bool isNeutral() const { return type() == TypeNeutral; } |
57 bool isShapeValue() const { return type() == TypeShapeValue; } | 57 bool isShapeValue() const { return type() == TypeShapeValue; } |
| 58 bool isSVGPaint() const { return type() == TypeSVGPaint; } |
58 bool isTransform() const { return type() == TypeTransform; } | 59 bool isTransform() const { return type() == TypeTransform; } |
59 bool isUnknown() const { return type() == TypeUnknown; } | 60 bool isUnknown() const { return type() == TypeUnknown; } |
60 bool isVisibility() const { return type() == TypeVisibility; } | 61 bool isVisibility() const { return type() == TypeVisibility; } |
61 | 62 |
62 protected: | 63 protected: |
63 enum AnimatableType { | 64 enum AnimatableType { |
64 TypeClipPathOperation, | 65 TypeClipPathOperation, |
65 TypeColor, | 66 TypeColor, |
66 TypeDouble, | 67 TypeDouble, |
67 TypeImage, | 68 TypeImage, |
68 TypeLength, | 69 TypeLength, |
69 TypeLengthBox, | 70 TypeLengthBox, |
70 TypeLengthSize, | 71 TypeLengthSize, |
71 TypeNeutral, | 72 TypeNeutral, |
72 TypeShapeValue, | 73 TypeShapeValue, |
| 74 TypeSVGPaint, |
73 TypeTransform, | 75 TypeTransform, |
74 TypeUnknown, | 76 TypeUnknown, |
75 TypeVisibility, | 77 TypeVisibility, |
76 }; | 78 }; |
77 | 79 |
78 bool isSameType(const AnimatableValue* value) const | 80 bool isSameType(const AnimatableValue* value) const |
79 { | 81 { |
80 ASSERT(value); | 82 ASSERT(value); |
81 return value->type() == type(); | 83 return value->type() == type(); |
82 } | 84 } |
83 | 85 |
84 virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, do
uble fraction) const = 0; | 86 virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, do
uble fraction) const = 0; |
85 static PassRefPtr<AnimatableValue> defaultInterpolateTo(const AnimatableValu
e* left, const AnimatableValue* right, double fraction) { return takeConstRef((f
raction < 0.5) ? left : right); } | 87 static PassRefPtr<AnimatableValue> defaultInterpolateTo(const AnimatableValu
e* left, const AnimatableValue* right, double fraction) { return takeConstRef((f
raction < 0.5) ? left : right); } |
86 | 88 |
87 // For noncommutative values read A->addWith(B) to mean the value A with B c
omposed onto it. | 89 // For noncommutative values read A->addWith(B) to mean the value A with B c
omposed onto it. |
88 virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const; | 90 virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const; |
89 static PassRefPtr<AnimatableValue> defaultAddWith(const AnimatableValue* lef
t, const AnimatableValue* right) { return takeConstRef(right); } | 91 static PassRefPtr<AnimatableValue> defaultAddWith(const AnimatableValue* lef
t, const AnimatableValue* right) { return takeConstRef(right); } |
90 | 92 |
91 template <class T> | 93 template <class T> |
92 static PassRefPtr<T> takeConstRef(const T* value) { return PassRefPtr<T>(con
st_cast<T*>(value)); } | 94 static PassRefPtr<T> takeConstRef(const T* value) { return PassRefPtr<T>(con
st_cast<T*>(value)); } |
93 | 95 |
94 private: | 96 private: |
95 virtual AnimatableType type() const = 0; | 97 virtual AnimatableType type() const = 0; |
96 }; | 98 }; |
97 | 99 |
98 } // namespace WebCore | 100 } // namespace WebCore |
99 | 101 |
100 #endif // AnimatableValue_h | 102 #endif // AnimatableValue_h |
OLD | NEW |