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