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" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class CORE_EXPORT AnimatableValueKeyframe : public Keyframe { | 14 class CORE_EXPORT AnimatableValueKeyframe : public Keyframe { |
15 public: | 15 public: |
16 static PassRefPtrWillBeRawPtr<AnimatableValueKeyframe> create() | 16 static PassRefPtr<AnimatableValueKeyframe> create() |
17 { | 17 { |
18 return adoptRefWillBeNoop(new AnimatableValueKeyframe); | 18 return adoptRef(new AnimatableValueKeyframe); |
19 } | 19 } |
20 void setPropertyValue(CSSPropertyID property, PassRefPtrWillBeRawPtr<Animata
bleValue> value) | 20 void setPropertyValue(CSSPropertyID property, PassRefPtr<AnimatableValue> va
lue) |
21 { | 21 { |
22 m_propertyValues.set(property, value); | 22 m_propertyValues.set(property, value); |
23 } | 23 } |
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 DECLARE_VIRTUAL_TRACE(); | |
33 | |
34 class PropertySpecificKeyframe : public Keyframe::PropertySpecificKeyframe { | 32 class PropertySpecificKeyframe : public Keyframe::PropertySpecificKeyframe { |
35 public: | 33 public: |
36 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin
g, const AnimatableValue*, EffectModel::CompositeOperation); | 34 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin
g, const AnimatableValue*, EffectModel::CompositeOperation); |
37 | 35 |
38 AnimatableValue* value() const { return m_value.get(); } | 36 AnimatableValue* value() const { return m_value.get(); } |
39 const PassRefPtrWillBeRawPtr<AnimatableValue> getAnimatableValue() const
final { return m_value; } | 37 const PassRefPtr<AnimatableValue> getAnimatableValue() const final { ret
urn m_value; } |
40 | 38 |
41 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> neutralKeyfra
me(double offset, PassRefPtr<TimingFunction> easing) const final; | 39 PassOwnPtr<Keyframe::PropertySpecificKeyframe> neutralKeyframe(double of
fset, PassRefPtr<TimingFunction> easing) const final; |
42 PassRefPtrWillBeRawPtr<Interpolation> maybeCreateInterpolation(PropertyH
andle, Keyframe::PropertySpecificKeyframe& end, Element*, const ComputedStyle*)
const final; | 40 PassRefPtr<Interpolation> maybeCreateInterpolation(PropertyHandle, Keyfr
ame::PropertySpecificKeyframe& end, Element*, const ComputedStyle*) const final; |
43 | |
44 DECLARE_VIRTUAL_TRACE(); | |
45 | 41 |
46 private: | 42 private: |
47 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin
g, PassRefPtrWillBeRawPtr<AnimatableValue>); | 43 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin
g, PassRefPtr<AnimatableValue>); |
48 | 44 |
49 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> cloneWithOffs
et(double offset) const override; | 45 PassOwnPtr<Keyframe::PropertySpecificKeyframe> cloneWithOffset(double of
fset) const override; |
50 bool isAnimatableValuePropertySpecificKeyframe() const override { return
true; } | 46 bool isAnimatableValuePropertySpecificKeyframe() const override { return
true; } |
51 | 47 |
52 RefPtrWillBeMember<AnimatableValue> m_value; | 48 RefPtr<AnimatableValue> m_value; |
53 }; | 49 }; |
54 | 50 |
55 private: | 51 private: |
56 AnimatableValueKeyframe() { } | 52 AnimatableValueKeyframe() { } |
57 | 53 |
58 AnimatableValueKeyframe(const AnimatableValueKeyframe& copyFrom); | 54 AnimatableValueKeyframe(const AnimatableValueKeyframe& copyFrom); |
59 | 55 |
60 PassRefPtrWillBeRawPtr<Keyframe> clone() const override; | 56 PassRefPtr<Keyframe> clone() const override; |
61 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> createPropertySpe
cificKeyframe(PropertyHandle) const override; | 57 PassOwnPtr<Keyframe::PropertySpecificKeyframe> createPropertySpecificKeyfram
e(PropertyHandle) const override; |
62 | 58 |
63 bool isAnimatableValueKeyframe() const override { return true; } | 59 bool isAnimatableValueKeyframe() const override { return true; } |
64 | 60 |
65 using PropertyValueMap = WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember
<AnimatableValue>>; | 61 using PropertyValueMap = HashMap<CSSPropertyID, RefPtr<AnimatableValue>>; |
66 PropertyValueMap m_propertyValues; | 62 PropertyValueMap m_propertyValues; |
67 }; | 63 }; |
68 | 64 |
69 using AnimatableValuePropertySpecificKeyframe = AnimatableValueKeyframe::Propert
ySpecificKeyframe; | 65 using AnimatableValuePropertySpecificKeyframe = AnimatableValueKeyframe::Propert
ySpecificKeyframe; |
70 | 66 |
71 DEFINE_TYPE_CASTS(AnimatableValueKeyframe, Keyframe, value, value->isAnimatableV
alueKeyframe(), value.isAnimatableValueKeyframe()); | 67 DEFINE_TYPE_CASTS(AnimatableValueKeyframe, Keyframe, value, value->isAnimatableV
alueKeyframe(), value.isAnimatableValueKeyframe()); |
72 DEFINE_TYPE_CASTS(AnimatableValuePropertySpecificKeyframe, Keyframe::PropertySpe
cificKeyframe, value, value->isAnimatableValuePropertySpecificKeyframe(), value.
isAnimatableValuePropertySpecificKeyframe()); | 68 DEFINE_TYPE_CASTS(AnimatableValuePropertySpecificKeyframe, Keyframe::PropertySpe
cificKeyframe, value, value->isAnimatableValuePropertySpecificKeyframe(), value.
isAnimatableValuePropertySpecificKeyframe()); |
73 | 69 |
74 } | 70 } |
75 | 71 |
76 #endif | 72 #endif |
OLD | NEW |