| 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 "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/animation/AnimationEffect.h" | 9 #include "core/animation/AnimationEffect.h" |
| 10 #include "core/animation/EffectModel.h" | 10 #include "core/animation/EffectModel.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 { | 49 { |
| 50 RefPtr<Keyframe> theClone = clone(); | 50 RefPtr<Keyframe> theClone = clone(); |
| 51 theClone->setOffset(offset); | 51 theClone->setOffset(offset); |
| 52 return theClone.release(); | 52 return theClone.release(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 virtual bool isAnimatableValueKeyframe() const { return false; } | 55 virtual bool isAnimatableValueKeyframe() const { return false; } |
| 56 virtual bool isStringKeyframe() const { return false; } | 56 virtual bool isStringKeyframe() const { return false; } |
| 57 | 57 |
| 58 // Represents a property-value pair in a keyframe. | 58 // Represents a property-value pair in a keyframe. |
| 59 class PropertySpecificKeyframe { | 59 class PropertySpecificKeyframe : public RefCounted<PropertySpecificKeyframe>
{ |
| 60 USING_FAST_MALLOC(PropertySpecificKeyframe); | 60 USING_FAST_MALLOC(PropertySpecificKeyframe); |
| 61 WTF_MAKE_NONCOPYABLE(PropertySpecificKeyframe); | 61 WTF_MAKE_NONCOPYABLE(PropertySpecificKeyframe); |
| 62 public: | 62 public: |
| 63 virtual ~PropertySpecificKeyframe() { } | 63 virtual ~PropertySpecificKeyframe() { } |
| 64 double offset() const { return m_offset; } | 64 double offset() const { return m_offset; } |
| 65 TimingFunction& easing() const { return *m_easing; } | 65 TimingFunction& easing() const { return *m_easing; } |
| 66 EffectModel::CompositeOperation composite() const { return m_composite;
} | 66 EffectModel::CompositeOperation composite() const { return m_composite;
} |
| 67 double underlyingFraction() const { return m_composite == EffectModel::C
ompositeReplace ? 0 : 1; } | 67 double underlyingFraction() const { return m_composite == EffectModel::C
ompositeReplace ? 0 : 1; } |
| 68 virtual bool isNeutral() const { ASSERT_NOT_REACHED(); return false; } | 68 virtual bool isNeutral() const { ASSERT_NOT_REACHED(); return false; } |
| 69 virtual PassOwnPtr<PropertySpecificKeyframe> cloneWithOffset(double offs
et) const = 0; | 69 virtual PassRefPtr<PropertySpecificKeyframe> cloneWithOffset(double offs
et) const = 0; |
| 70 | 70 |
| 71 // FIXME: Remove this once CompositorAnimations no longer depends on Ani
matableValues | 71 // FIXME: Remove this once CompositorAnimations no longer depends on Ani
matableValues |
| 72 virtual bool populateAnimatableValue(CSSPropertyID, Element&, const Comp
utedStyle* baseStyle, bool force) const { return false; } | 72 virtual bool populateAnimatableValue(CSSPropertyID, Element&, const Comp
utedStyle* baseStyle, bool force) const { return false; } |
| 73 virtual const PassRefPtr<AnimatableValue> getAnimatableValue() const = 0
; | 73 virtual const PassRefPtr<AnimatableValue> getAnimatableValue() const = 0
; |
| 74 | 74 |
| 75 virtual bool isAnimatableValuePropertySpecificKeyframe() const { return
false; } | 75 virtual bool isAnimatableValuePropertySpecificKeyframe() const { return
false; } |
| 76 virtual bool isCSSPropertySpecificKeyframe() const { return false; } | 76 virtual bool isCSSPropertySpecificKeyframe() const { return false; } |
| 77 virtual bool isSVGPropertySpecificKeyframe() const { return false; } | 77 virtual bool isSVGPropertySpecificKeyframe() const { return false; } |
| 78 | 78 |
| 79 virtual PassOwnPtr<PropertySpecificKeyframe> neutralKeyframe(double offs
et, PassRefPtr<TimingFunction> easing) const = 0; | 79 virtual PassRefPtr<PropertySpecificKeyframe> neutralKeyframe(double offs
et, PassRefPtr<TimingFunction> easing) const = 0; |
| 80 virtual PassRefPtr<Interpolation> maybeCreateInterpolation(PropertyHandl
e, Keyframe::PropertySpecificKeyframe& end, Element*, const ComputedStyle* baseS
tyle) const = 0; | 80 virtual PassRefPtr<Interpolation> maybeCreateInterpolation(PropertyHandl
e, Keyframe::PropertySpecificKeyframe& end, Element*, const ComputedStyle* baseS
tyle) const = 0; |
| 81 | 81 |
| 82 protected: | 82 protected: |
| 83 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin
g, EffectModel::CompositeOperation); | 83 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin
g, EffectModel::CompositeOperation); |
| 84 | 84 |
| 85 double m_offset; | 85 double m_offset; |
| 86 RefPtr<TimingFunction> m_easing; | 86 RefPtr<TimingFunction> m_easing; |
| 87 EffectModel::CompositeOperation m_composite; | 87 EffectModel::CompositeOperation m_composite; |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 virtual PassOwnPtr<PropertySpecificKeyframe> createPropertySpecificKeyframe(
PropertyHandle) const = 0; | 90 virtual PassRefPtr<PropertySpecificKeyframe> createPropertySpecificKeyframe(
PropertyHandle) const = 0; |
| 91 | 91 |
| 92 protected: | 92 protected: |
| 93 Keyframe() | 93 Keyframe() |
| 94 : m_offset(nullValue()) | 94 : m_offset(nullValue()) |
| 95 , m_composite(EffectModel::CompositeReplace) | 95 , m_composite(EffectModel::CompositeReplace) |
| 96 , m_easing(LinearTimingFunction::shared()) | 96 , m_easing(LinearTimingFunction::shared()) |
| 97 { | 97 { |
| 98 } | 98 } |
| 99 Keyframe(double offset, EffectModel::CompositeOperation composite, PassRefPt
r<TimingFunction> easing) | 99 Keyframe(double offset, EffectModel::CompositeOperation composite, PassRefPt
r<TimingFunction> easing) |
| 100 : m_offset(offset) | 100 : m_offset(offset) |
| 101 , m_composite(composite) | 101 , m_composite(composite) |
| 102 , m_easing(easing) | 102 , m_easing(easing) |
| 103 { | 103 { |
| 104 } | 104 } |
| 105 | 105 |
| 106 double m_offset; | 106 double m_offset; |
| 107 EffectModel::CompositeOperation m_composite; | 107 EffectModel::CompositeOperation m_composite; |
| 108 RefPtr<TimingFunction> m_easing; | 108 RefPtr<TimingFunction> m_easing; |
| 109 }; | 109 }; |
| 110 | 110 |
| 111 using PropertySpecificKeyframe = Keyframe::PropertySpecificKeyframe; | 111 using PropertySpecificKeyframe = Keyframe::PropertySpecificKeyframe; |
| 112 | 112 |
| 113 } // namespace blink | 113 } // namespace blink |
| 114 | 114 |
| 115 #endif // Keyframe_h | 115 #endif // Keyframe_h |
| OLD | NEW |