| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef SKY_ENGINE_CORE_ANIMATION_ANIMATABLE_ANIMATABLEVALUEKEYFRAME_H_ | |
| 6 #define SKY_ENGINE_CORE_ANIMATION_ANIMATABLE_ANIMATABLEVALUEKEYFRAME_H_ | |
| 7 | |
| 8 #include "sky/engine/core/animation/Keyframe.h" | |
| 9 #include "sky/engine/core/animation/animatable/AnimatableValue.h" | |
| 10 | |
| 11 namespace blink { | |
| 12 | |
| 13 class AnimatableValueKeyframe : public Keyframe { | |
| 14 public: | |
| 15 static PassRefPtr<AnimatableValueKeyframe> create() | |
| 16 { | |
| 17 return adoptRef(new AnimatableValueKeyframe); | |
| 18 } | |
| 19 void setPropertyValue(CSSPropertyID property, PassRefPtr<AnimatableValue> va
lue) | |
| 20 { | |
| 21 m_propertyValues.add(property, value); | |
| 22 } | |
| 23 void clearPropertyValue(CSSPropertyID property) { m_propertyValues.remove(pr
operty); } | |
| 24 AnimatableValue* propertyValue(CSSPropertyID property) const | |
| 25 { | |
| 26 ASSERT(m_propertyValues.contains(property)); | |
| 27 return m_propertyValues.get(property); | |
| 28 } | |
| 29 virtual PropertySet properties() const override; | |
| 30 | |
| 31 class PropertySpecificKeyframe : public Keyframe::PropertySpecificKeyframe { | |
| 32 public: | |
| 33 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin
g, const AnimatableValue*, AnimationEffect::CompositeOperation); | |
| 34 | |
| 35 AnimatableValue* value() const { return m_value.get(); } | |
| 36 virtual const PassRefPtr<AnimatableValue> getAnimatableValue() const ove
rride final { return m_value; } | |
| 37 | |
| 38 virtual PassOwnPtr<Keyframe::PropertySpecificKeyframe> neutralKeyframe(d
ouble offset, PassRefPtr<TimingFunction> easing) const override final; | |
| 39 virtual PassRefPtr<Interpolation> createInterpolation(CSSPropertyID, bli
nk::Keyframe::PropertySpecificKeyframe* end, Element*) const override final; | |
| 40 | |
| 41 private: | |
| 42 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin
g, PassRefPtr<AnimatableValue>); | |
| 43 | |
| 44 virtual PassOwnPtr<Keyframe::PropertySpecificKeyframe> cloneWithOffset(d
ouble offset) const override; | |
| 45 virtual bool isAnimatableValuePropertySpecificKeyframe() const override
{ return true; } | |
| 46 | |
| 47 RefPtr<AnimatableValue> m_value; | |
| 48 }; | |
| 49 | |
| 50 private: | |
| 51 AnimatableValueKeyframe() { } | |
| 52 | |
| 53 AnimatableValueKeyframe(const AnimatableValueKeyframe& copyFrom); | |
| 54 | |
| 55 virtual PassRefPtr<Keyframe> clone() const override; | |
| 56 virtual PassOwnPtr<Keyframe::PropertySpecificKeyframe> createPropertySpecifi
cKeyframe(CSSPropertyID) const override; | |
| 57 | |
| 58 virtual bool isAnimatableValueKeyframe() const override { return true; } | |
| 59 | |
| 60 typedef HashMap<CSSPropertyID, RefPtr<AnimatableValue> > PropertyValueMap; | |
| 61 PropertyValueMap m_propertyValues; | |
| 62 }; | |
| 63 | |
| 64 typedef AnimatableValueKeyframe::PropertySpecificKeyframe AnimatableValuePropert
ySpecificKeyframe; | |
| 65 | |
| 66 DEFINE_TYPE_CASTS(AnimatableValueKeyframe, Keyframe, value, value->isAnimatableV
alueKeyframe(), value.isAnimatableValueKeyframe()); | |
| 67 DEFINE_TYPE_CASTS(AnimatableValuePropertySpecificKeyframe, Keyframe::PropertySpe
cificKeyframe, value, value->isAnimatableValuePropertySpecificKeyframe(), value.
isAnimatableValuePropertySpecificKeyframe()); | |
| 68 | |
| 69 } | |
| 70 | |
| 71 #endif // SKY_ENGINE_CORE_ANIMATION_ANIMATABLE_ANIMATABLEVALUEKEYFRAME_H_ | |
| OLD | NEW |