Index: Source/core/animation/AnimatableRepeatable.h |
diff --git a/Source/core/animation/AnimatableLengthSize.h b/Source/core/animation/AnimatableRepeatable.h |
similarity index 64% |
copy from Source/core/animation/AnimatableLengthSize.h |
copy to Source/core/animation/AnimatableRepeatable.h |
index c436045962ccb467a15a68235c2629b0bf64e73f..a484f6efc46ce6eadc364f556c9702d2a1ca8531 100644 |
--- a/Source/core/animation/AnimatableLengthSize.h |
+++ b/Source/core/animation/AnimatableRepeatable.h |
@@ -28,46 +28,49 @@ |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
-#ifndef AnimatableLengthSize_h |
-#define AnimatableLengthSize_h |
+#ifndef AnimatableRepeatable_h |
+#define AnimatableRepeatable_h |
#include "core/animation/AnimatableValue.h" |
+#include "wtf/Vector.h" |
namespace WebCore { |
-class AnimatableLengthSize : public AnimatableValue { |
+// This class represents collections of values that animate in a repeated fashion as described by the CSS Transitions spec: |
+// http://www.w3.org/TR/css3-transitions/#animtype-repeatable-list |
+class AnimatableRepeatable : public AnimatableValue { |
public: |
- virtual ~AnimatableLengthSize() { } |
- static PassRefPtr<AnimatableLengthSize> create(PassRefPtr<AnimatableValue> width, PassRefPtr<AnimatableValue> height) |
+ virtual ~AnimatableRepeatable() { } |
+ |
+ // This will consume the vector passed into it. |
+ static PassRefPtr<AnimatableRepeatable> create(Vector<RefPtr<AnimatableValue> >& values) |
{ |
- return adoptRef(new AnimatableLengthSize(width, height)); |
+ return adoptRef(new AnimatableRepeatable(values)); |
} |
- const AnimatableValue* width() const { return m_width.get(); } |
- const AnimatableValue* height() const { return m_height.get(); } |
-protected: |
- virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, double fraction) const OVERRIDE; |
- virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const OVERRIDE; |
+ const Vector<RefPtr<AnimatableValue> >& values() const { return m_values; } |
private: |
- AnimatableLengthSize(PassRefPtr<AnimatableValue> width, PassRefPtr<AnimatableValue> height) |
- : m_width(width) |
- , m_height(height) |
+ AnimatableRepeatable(Vector<RefPtr<AnimatableValue> >& values) |
{ |
+ m_values.swap(values); |
} |
- virtual AnimatableType type() const OVERRIDE { return TypeLengthSize; } |
+ |
+ virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, double fraction) const OVERRIDE; |
+ virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const OVERRIDE; |
+ |
+ virtual AnimatableType type() const OVERRIDE { return TypeRepeatable; } |
virtual bool equalTo(const AnimatableValue*) const OVERRIDE; |
- RefPtr<AnimatableValue> m_width; |
- RefPtr<AnimatableValue> m_height; |
+ Vector<RefPtr<AnimatableValue> > m_values; |
}; |
-inline const AnimatableLengthSize* toAnimatableLengthSize(const AnimatableValue* value) |
+inline const AnimatableRepeatable* toAnimatableRepeatable(const AnimatableValue* value) |
{ |
- ASSERT_WITH_SECURITY_IMPLICATION(value && value->isLengthSize()); |
- return static_cast<const AnimatableLengthSize*>(value); |
+ ASSERT_WITH_SECURITY_IMPLICATION(value && value->isRepeatable()); |
+ return static_cast<const AnimatableRepeatable*>(value); |
} |
} // namespace WebCore |
-#endif // AnimatableLengthSize_h |
+#endif // AnimatableRepeatable_h |