| 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 AnimatableValueKeyframe* create() |
| 17 { | 17 { |
| 18 return adoptRefWillBeNoop(new AnimatableValueKeyframe); | 18 return new AnimatableValueKeyframe; |
| 19 } | 19 } |
| 20 void setPropertyValue(CSSPropertyID property, PassRefPtrWillBeRawPtr<Animata
bleValue> value) | 20 void setPropertyValue(CSSPropertyID property, AnimatableValue* value) |
| 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 virtual PropertyHandleSet properties() const override; | 30 virtual PropertyHandleSet properties() const override; |
| 31 | 31 |
| 32 DECLARE_VIRTUAL_TRACE(); | 32 DECLARE_VIRTUAL_TRACE(); |
| 33 | 33 |
| 34 class PropertySpecificKeyframe : public Keyframe::PropertySpecificKeyframe { | 34 class PropertySpecificKeyframe : public Keyframe::PropertySpecificKeyframe { |
| 35 public: | 35 public: |
| 36 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin
g, const AnimatableValue*, AnimationEffect::CompositeOperation); | 36 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin
g, const AnimatableValue*, AnimationEffect::CompositeOperation); |
| 37 | 37 |
| 38 AnimatableValue* value() const { return m_value.get(); } | 38 AnimatableValue* value() const { return m_value.get(); } |
| 39 virtual const PassRefPtrWillBeRawPtr<AnimatableValue> getAnimatableValue
() const override final { return m_value; } | 39 virtual const AnimatableValue* getAnimatableValue() const override final
{ return m_value; } |
| 40 | 40 |
| 41 virtual PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> neutr
alKeyframe(double offset, PassRefPtr<TimingFunction> easing) const override fina
l; | 41 virtual Keyframe::PropertySpecificKeyframe* neutralKeyframe(double offse
t, PassRefPtr<TimingFunction> easing) const override final; |
| 42 virtual PassRefPtrWillBeRawPtr<Interpolation> maybeCreateInterpolation(P
ropertyHandle, Keyframe::PropertySpecificKeyframe& end, Element*, const Computed
Style*) const override final; | 42 virtual Interpolation* maybeCreateInterpolation(PropertyHandle, Keyframe
::PropertySpecificKeyframe& end, Element*, const ComputedStyle*) const override
final; |
| 43 | 43 |
| 44 DECLARE_VIRTUAL_TRACE(); | 44 DECLARE_VIRTUAL_TRACE(); |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin
g, PassRefPtrWillBeRawPtr<AnimatableValue>); | 47 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin
g, AnimatableValue*); |
| 48 | 48 |
| 49 virtual PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> clone
WithOffset(double offset) const override; | 49 virtual Keyframe::PropertySpecificKeyframe* cloneWithOffset(double offse
t) const override; |
| 50 virtual bool isAnimatableValuePropertySpecificKeyframe() const override
{ return true; } | 50 virtual bool isAnimatableValuePropertySpecificKeyframe() const override
{ return true; } |
| 51 | 51 |
| 52 RefPtrWillBeMember<AnimatableValue> m_value; | 52 Member<AnimatableValue> m_value; |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 AnimatableValueKeyframe() { } | 56 AnimatableValueKeyframe() { } |
| 57 | 57 |
| 58 AnimatableValueKeyframe(const AnimatableValueKeyframe& copyFrom); | 58 AnimatableValueKeyframe(const AnimatableValueKeyframe& copyFrom); |
| 59 | 59 |
| 60 virtual PassRefPtrWillBeRawPtr<Keyframe> clone() const override; | 60 virtual Keyframe* clone() const override; |
| 61 virtual PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> createPro
pertySpecificKeyframe(PropertyHandle) const override; | 61 virtual Keyframe::PropertySpecificKeyframe* createPropertySpecificKeyframe(P
ropertyHandle) const override; |
| 62 | 62 |
| 63 virtual bool isAnimatableValueKeyframe() const override { return true; } | 63 virtual bool isAnimatableValueKeyframe() const override { return true; } |
| 64 | 64 |
| 65 using PropertyValueMap = WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember
<AnimatableValue>>; | 65 using PropertyValueMap = HeapHashMap<CSSPropertyID, Member<AnimatableValue>>
; |
| 66 PropertyValueMap m_propertyValues; | 66 PropertyValueMap m_propertyValues; |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 using AnimatableValuePropertySpecificKeyframe = AnimatableValueKeyframe::Propert
ySpecificKeyframe; | 69 using AnimatableValuePropertySpecificKeyframe = AnimatableValueKeyframe::Propert
ySpecificKeyframe; |
| 70 | 70 |
| 71 DEFINE_TYPE_CASTS(AnimatableValueKeyframe, Keyframe, value, value->isAnimatableV
alueKeyframe(), value.isAnimatableValueKeyframe()); | 71 DEFINE_TYPE_CASTS(AnimatableValueKeyframe, Keyframe, value, value->isAnimatableV
alueKeyframe(), value.isAnimatableValueKeyframe()); |
| 72 DEFINE_TYPE_CASTS(AnimatableValuePropertySpecificKeyframe, Keyframe::PropertySpe
cificKeyframe, value, value->isAnimatableValuePropertySpecificKeyframe(), value.
isAnimatableValuePropertySpecificKeyframe()); | 72 DEFINE_TYPE_CASTS(AnimatableValuePropertySpecificKeyframe, Keyframe::PropertySpe
cificKeyframe, value, value->isAnimatableValuePropertySpecificKeyframe(), value.
isAnimatableValuePropertySpecificKeyframe()); |
| 73 | 73 |
| 74 } | 74 } |
| 75 | 75 |
| 76 #endif | 76 #endif |
| OLD | NEW |