| 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_KEYFRAME_H_ | |
| 6 #define SKY_ENGINE_CORE_ANIMATION_KEYFRAME_H_ | |
| 7 | |
| 8 #include "gen/sky/core/CSSPropertyNames.h" | |
| 9 #include "sky/engine/core/animation/AnimationEffect.h" | |
| 10 #include "sky/engine/core/animation/AnimationNode.h" | |
| 11 #include "sky/engine/core/animation/animatable/AnimatableValue.h" | |
| 12 | |
| 13 namespace blink { | |
| 14 | |
| 15 typedef HashSet<CSSPropertyID> PropertySet; | |
| 16 | |
| 17 class Element; | |
| 18 | |
| 19 // FIXME: Make Keyframe immutable | |
| 20 class Keyframe : public RefCounted<Keyframe> { | |
| 21 public: | |
| 22 virtual ~Keyframe() { } | |
| 23 | |
| 24 void setOffset(double offset) { m_offset = offset; } | |
| 25 double offset() const { return m_offset; } | |
| 26 | |
| 27 void setComposite(AnimationEffect::CompositeOperation composite) { m_composi
te = composite; } | |
| 28 AnimationEffect::CompositeOperation composite() const { return m_composite;
} | |
| 29 | |
| 30 void setEasing(PassRefPtr<TimingFunction> easing) { m_easing = easing; } | |
| 31 TimingFunction& easing() const { return *m_easing; } | |
| 32 | |
| 33 static bool compareOffsets(const RefPtr<Keyframe>& a, const RefPtr<Keyframe>
& b) | |
| 34 { | |
| 35 return a->offset() < b->offset(); | |
| 36 } | |
| 37 | |
| 38 virtual PropertySet properties() const = 0; | |
| 39 | |
| 40 virtual PassRefPtr<Keyframe> clone() const = 0; | |
| 41 PassRefPtr<Keyframe> cloneWithOffset(double offset) const | |
| 42 { | |
| 43 RefPtr<Keyframe> theClone = clone(); | |
| 44 theClone->setOffset(offset); | |
| 45 return theClone.release(); | |
| 46 } | |
| 47 | |
| 48 virtual bool isAnimatableValueKeyframe() const { return false; } | |
| 49 virtual bool isStringKeyframe() const { return false; } | |
| 50 | |
| 51 class PropertySpecificKeyframe { | |
| 52 public: | |
| 53 virtual ~PropertySpecificKeyframe() { } | |
| 54 double offset() const { return m_offset; } | |
| 55 TimingFunction& easing() const { return *m_easing; } | |
| 56 AnimationEffect::CompositeOperation composite() const { return m_composi
te; } | |
| 57 virtual PassOwnPtr<PropertySpecificKeyframe> cloneWithOffset(double offs
et) const = 0; | |
| 58 | |
| 59 virtual const PassRefPtr<AnimatableValue> getAnimatableValue() const = 0
; | |
| 60 | |
| 61 virtual bool isAnimatableValuePropertySpecificKeyframe() const { return
false; } | |
| 62 virtual bool isStringPropertySpecificKeyframe() const { return false; } | |
| 63 | |
| 64 virtual PassOwnPtr<PropertySpecificKeyframe> neutralKeyframe(double offs
et, PassRefPtr<TimingFunction> easing) const = 0; | |
| 65 virtual PassRefPtr<Interpolation> createInterpolation(CSSPropertyID, bli
nk::Keyframe::PropertySpecificKeyframe* end, Element*) const = 0; | |
| 66 | |
| 67 protected: | |
| 68 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin
g, AnimationEffect::CompositeOperation); | |
| 69 | |
| 70 double m_offset; | |
| 71 RefPtr<TimingFunction> m_easing; | |
| 72 AnimationEffect::CompositeOperation m_composite; | |
| 73 }; | |
| 74 | |
| 75 virtual PassOwnPtr<PropertySpecificKeyframe> createPropertySpecificKeyframe(
CSSPropertyID) const = 0; | |
| 76 | |
| 77 protected: | |
| 78 Keyframe() | |
| 79 : m_offset(nullValue()) | |
| 80 , m_composite(AnimationEffect::CompositeReplace) | |
| 81 , m_easing(LinearTimingFunction::shared()) | |
| 82 { | |
| 83 } | |
| 84 Keyframe(double offset, AnimationEffect::CompositeOperation composite, PassR
efPtr<TimingFunction> easing) | |
| 85 : m_offset(offset) | |
| 86 , m_composite(composite) | |
| 87 , m_easing(easing) | |
| 88 { | |
| 89 } | |
| 90 | |
| 91 double m_offset; | |
| 92 AnimationEffect::CompositeOperation m_composite; | |
| 93 RefPtr<TimingFunction> m_easing; | |
| 94 }; | |
| 95 | |
| 96 } | |
| 97 | |
| 98 #endif // SKY_ENGINE_CORE_ANIMATION_KEYFRAME_H_ | |
| OLD | NEW |