OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef AnimatableValueKeyframe_h | 5 #ifndef AnimatableValueKeyframe_h |
6 #define AnimatableValueKeyframe_h | 6 #define AnimatableValueKeyframe_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/animation/Keyframe.h" | 9 #include "core/animation/Keyframe.h" |
10 #include "core/animation/animatable/AnimatableValue.h" | 10 #include "core/animation/animatable/AnimatableValue.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 void clearPropertyValue(CSSPropertyID property) { m_propertyValues.remove(pr
operty); } | 24 void clearPropertyValue(CSSPropertyID property) { m_propertyValues.remove(pr
operty); } |
25 AnimatableValue* propertyValue(CSSPropertyID property) const | 25 AnimatableValue* propertyValue(CSSPropertyID property) const |
26 { | 26 { |
27 ASSERT(m_propertyValues.contains(property)); | 27 ASSERT(m_propertyValues.contains(property)); |
28 return m_propertyValues.get(property); | 28 return m_propertyValues.get(property); |
29 } | 29 } |
30 PropertyHandleSet properties() const override; | 30 PropertyHandleSet properties() const override; |
31 | 31 |
32 class PropertySpecificKeyframe : public Keyframe::PropertySpecificKeyframe { | 32 class PropertySpecificKeyframe : public Keyframe::PropertySpecificKeyframe { |
33 public: | 33 public: |
34 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin
g, const AnimatableValue*, EffectModel::CompositeOperation); | 34 static PassRefPtr<PropertySpecificKeyframe> create(double offset, PassRe
fPtr<TimingFunction> easing, PassRefPtr<AnimatableValue> value, EffectModel::Com
positeOperation composite) |
| 35 { |
| 36 return adoptRef(new PropertySpecificKeyframe(offset, easing, value,
composite)); |
| 37 } |
35 | 38 |
36 AnimatableValue* value() const { return m_value.get(); } | 39 AnimatableValue* value() const { return m_value.get(); } |
37 const PassRefPtr<AnimatableValue> getAnimatableValue() const final { ret
urn m_value; } | 40 const PassRefPtr<AnimatableValue> getAnimatableValue() const final { ret
urn m_value; } |
38 | 41 |
39 PassOwnPtr<Keyframe::PropertySpecificKeyframe> neutralKeyframe(double of
fset, PassRefPtr<TimingFunction> easing) const final; | 42 PassRefPtr<Keyframe::PropertySpecificKeyframe> neutralKeyframe(double of
fset, PassRefPtr<TimingFunction> easing) const final; |
40 PassRefPtr<Interpolation> maybeCreateInterpolation(PropertyHandle, Keyfr
ame::PropertySpecificKeyframe& end, Element*, const ComputedStyle*) const final; | 43 PassRefPtr<Interpolation> maybeCreateInterpolation(PropertyHandle, Keyfr
ame::PropertySpecificKeyframe& end, Element*, const ComputedStyle*) const final; |
41 | 44 |
42 private: | 45 private: |
43 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin
g, PassRefPtr<AnimatableValue>); | 46 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin
g, PassRefPtr<AnimatableValue> value, EffectModel::CompositeOperation composite) |
| 47 : Keyframe::PropertySpecificKeyframe(offset, easing, composite) |
| 48 , m_value(value) |
| 49 { } |
44 | 50 |
45 PassOwnPtr<Keyframe::PropertySpecificKeyframe> cloneWithOffset(double of
fset) const override; | 51 PassRefPtr<Keyframe::PropertySpecificKeyframe> cloneWithOffset(double of
fset) const override; |
46 bool isAnimatableValuePropertySpecificKeyframe() const override { return
true; } | 52 bool isAnimatableValuePropertySpecificKeyframe() const override { return
true; } |
47 | 53 |
48 RefPtr<AnimatableValue> m_value; | 54 RefPtr<AnimatableValue> m_value; |
49 }; | 55 }; |
50 | 56 |
51 private: | 57 private: |
52 AnimatableValueKeyframe() { } | 58 AnimatableValueKeyframe() { } |
53 | 59 |
54 AnimatableValueKeyframe(const AnimatableValueKeyframe& copyFrom); | 60 AnimatableValueKeyframe(const AnimatableValueKeyframe& copyFrom); |
55 | 61 |
56 PassRefPtr<Keyframe> clone() const override; | 62 PassRefPtr<Keyframe> clone() const override; |
57 PassOwnPtr<Keyframe::PropertySpecificKeyframe> createPropertySpecificKeyfram
e(PropertyHandle) const override; | 63 PassRefPtr<Keyframe::PropertySpecificKeyframe> createPropertySpecificKeyfram
e(PropertyHandle) const override; |
58 | 64 |
59 bool isAnimatableValueKeyframe() const override { return true; } | 65 bool isAnimatableValueKeyframe() const override { return true; } |
60 | 66 |
61 using PropertyValueMap = HashMap<CSSPropertyID, RefPtr<AnimatableValue>>; | 67 using PropertyValueMap = HashMap<CSSPropertyID, RefPtr<AnimatableValue>>; |
62 PropertyValueMap m_propertyValues; | 68 PropertyValueMap m_propertyValues; |
63 }; | 69 }; |
64 | 70 |
65 using AnimatableValuePropertySpecificKeyframe = AnimatableValueKeyframe::Propert
ySpecificKeyframe; | 71 using AnimatableValuePropertySpecificKeyframe = AnimatableValueKeyframe::Propert
ySpecificKeyframe; |
66 | 72 |
67 DEFINE_TYPE_CASTS(AnimatableValueKeyframe, Keyframe, value, value->isAnimatableV
alueKeyframe(), value.isAnimatableValueKeyframe()); | 73 DEFINE_TYPE_CASTS(AnimatableValueKeyframe, Keyframe, value, value->isAnimatableV
alueKeyframe(), value.isAnimatableValueKeyframe()); |
68 DEFINE_TYPE_CASTS(AnimatableValuePropertySpecificKeyframe, Keyframe::PropertySpe
cificKeyframe, value, value->isAnimatableValuePropertySpecificKeyframe(), value.
isAnimatableValuePropertySpecificKeyframe()); | 74 DEFINE_TYPE_CASTS(AnimatableValuePropertySpecificKeyframe, Keyframe::PropertySpe
cificKeyframe, value, value->isAnimatableValuePropertySpecificKeyframe(), value.
isAnimatableValuePropertySpecificKeyframe()); |
69 | 75 |
70 } // namespace blink | 76 } // namespace blink |
71 | 77 |
72 #endif | 78 #endif |
OLD | NEW |