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 22 matching lines...) Expand all Loading... |
33 | 33 |
34 #include "core/CoreExport.h" | 34 #include "core/CoreExport.h" |
35 #include "core/animation/animatable/AnimatableValue.h" | 35 #include "core/animation/animatable/AnimatableValue.h" |
36 #include "wtf/Vector.h" | 36 #include "wtf/Vector.h" |
37 | 37 |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
40 // This class represents collections of values that animate in a repeated | 40 // This class represents collections of values that animate in a repeated |
41 // fashion as described by the CSS Transitions spec: | 41 // fashion as described by the CSS Transitions spec: |
42 // http://www.w3.org/TR/css3-transitions/#animtype-repeatable-list | 42 // http://www.w3.org/TR/css3-transitions/#animtype-repeatable-list |
43 class CORE_EXPORT AnimatableRepeatable : public AnimatableValue { | 43 class AnimatableRepeatable : public AnimatableValue { |
44 public: | 44 public: |
45 ~AnimatableRepeatable() override {} | 45 ~AnimatableRepeatable() override {} |
46 | 46 |
47 // This will consume the vector passed into it. | 47 // This will consume the vector passed into it. |
48 static PassRefPtr<AnimatableRepeatable> create( | 48 static PassRefPtr<AnimatableRepeatable> create( |
49 Vector<RefPtr<AnimatableValue>>& values) { | 49 Vector<RefPtr<AnimatableValue>>& values) { |
50 return adoptRef(new AnimatableRepeatable(values)); | 50 return adoptRef(new AnimatableRepeatable(values)); |
51 } | 51 } |
52 | 52 |
53 const Vector<RefPtr<AnimatableValue>>& values() const { return m_values; } | |
54 | |
55 protected: | 53 protected: |
56 AnimatableRepeatable() {} | 54 AnimatableRepeatable() {} |
57 AnimatableRepeatable(Vector<RefPtr<AnimatableValue>>& values) { | 55 AnimatableRepeatable(Vector<RefPtr<AnimatableValue>>& values) { |
58 DCHECK(!values.isEmpty()); | 56 DCHECK(!values.isEmpty()); |
59 m_values.swap(values); | 57 m_values.swap(values); |
60 } | 58 } |
61 | 59 |
62 static bool interpolateLists( | |
63 const Vector<RefPtr<AnimatableValue>>& fromValues, | |
64 const Vector<RefPtr<AnimatableValue>>& toValues, | |
65 double fraction, | |
66 Vector<RefPtr<AnimatableValue>>& interpolatedValues); | |
67 | |
68 bool usesDefaultInterpolationWith(const AnimatableValue*) const override; | |
69 | |
70 Vector<RefPtr<AnimatableValue>> m_values; | 60 Vector<RefPtr<AnimatableValue>> m_values; |
71 | 61 |
72 private: | 62 private: |
73 PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, | |
74 double fraction) const override; | |
75 | |
76 AnimatableType type() const override { return TypeRepeatable; } | 63 AnimatableType type() const override { return TypeRepeatable; } |
77 bool equalTo(const AnimatableValue*) const final; | 64 bool equalTo(const AnimatableValue*) const final; |
78 }; | 65 }; |
79 | 66 |
80 DEFINE_TYPE_CASTS(AnimatableRepeatable, | 67 DEFINE_TYPE_CASTS(AnimatableRepeatable, |
81 AnimatableValue, | 68 AnimatableValue, |
82 value, | 69 value, |
83 (value->isRepeatable() || value->isStrokeDasharrayList()), | 70 (value->isRepeatable() || value->isStrokeDasharrayList()), |
84 (value.isRepeatable() || value.isStrokeDasharrayList())); | 71 (value.isRepeatable() || value.isStrokeDasharrayList())); |
85 | 72 |
86 } // namespace blink | 73 } // namespace blink |
87 | 74 |
88 #endif // AnimatableRepeatable_h | 75 #endif // AnimatableRepeatable_h |
OLD | NEW |