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