Rename rendering/RenderFileUploadControl to layout/LayoutFileUploadControl.
[chromium-blink-merge.git] / third_party / WebKit / Source / core / animation / Keyframe.h
blobace7dda84292811b87f1a07ac76de854246da68a
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.
5 #ifndef Keyframe_h
6 #define Keyframe_h
8 #include "core/CSSPropertyNames.h"
9 #include "core/animation/AnimationEffect.h"
10 #include "core/animation/AnimationNode.h"
11 #include "core/animation/animatable/AnimatableValue.h"
13 namespace blink {
15 using PropertySet = HashSet<CSSPropertyID>;
17 class Element;
19 // FIXME: Make Keyframe immutable
20 class Keyframe : public RefCountedWillBeGarbageCollectedFinalized<Keyframe> {
21 public:
22 virtual ~Keyframe() { }
24 void setOffset(double offset) { m_offset = offset; }
25 double offset() const { return m_offset; }
27 void setComposite(AnimationEffect::CompositeOperation composite) { m_composite = composite; }
28 AnimationEffect::CompositeOperation composite() const { return m_composite; }
30 void setEasing(PassRefPtr<TimingFunction> easing) { m_easing = easing; }
31 TimingFunction& easing() const { return *m_easing; }
33 static bool compareOffsets(const RefPtrWillBeMember<Keyframe>& a, const RefPtrWillBeMember<Keyframe>& b)
35 return a->offset() < b->offset();
38 virtual PropertySet properties() const = 0;
40 virtual PassRefPtrWillBeRawPtr<Keyframe> clone() const = 0;
41 PassRefPtrWillBeRawPtr<Keyframe> cloneWithOffset(double offset) const
43 RefPtrWillBeRawPtr<Keyframe> theClone = clone();
44 theClone->setOffset(offset);
45 return theClone.release();
48 virtual bool isAnimatableValueKeyframe() const { return false; }
49 virtual bool isStringKeyframe() const { return false; }
51 DEFINE_INLINE_VIRTUAL_TRACE() { }
53 class PropertySpecificKeyframe : public NoBaseWillBeGarbageCollectedFinalized<PropertySpecificKeyframe> {
54 public:
55 virtual ~PropertySpecificKeyframe() { }
56 double offset() const { return m_offset; }
57 TimingFunction& easing() const { return *m_easing; }
58 AnimationEffect::CompositeOperation composite() const { return m_composite; }
59 virtual PassOwnPtrWillBeRawPtr<PropertySpecificKeyframe> cloneWithOffset(double offset) const = 0;
61 virtual const PassRefPtrWillBeRawPtr<AnimatableValue> getAnimatableValue() const = 0;
63 virtual bool isAnimatableValuePropertySpecificKeyframe() const { return false; }
64 virtual bool isStringPropertySpecificKeyframe() const { return false; }
66 virtual PassOwnPtrWillBeRawPtr<PropertySpecificKeyframe> neutralKeyframe(double offset, PassRefPtr<TimingFunction> easing) const = 0;
67 virtual PassRefPtrWillBeRawPtr<Interpolation> maybeCreateInterpolation(CSSPropertyID, blink::Keyframe::PropertySpecificKeyframe& end, Element*) const = 0;
69 DEFINE_INLINE_VIRTUAL_TRACE() { }
71 protected:
72 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, AnimationEffect::CompositeOperation);
74 double m_offset;
75 RefPtr<TimingFunction> m_easing;
76 AnimationEffect::CompositeOperation m_composite;
79 virtual PassOwnPtrWillBeRawPtr<PropertySpecificKeyframe> createPropertySpecificKeyframe(CSSPropertyID) const = 0;
81 protected:
82 Keyframe()
83 : m_offset(nullValue())
84 , m_composite(AnimationEffect::CompositeReplace)
85 , m_easing(LinearTimingFunction::shared())
88 Keyframe(double offset, AnimationEffect::CompositeOperation composite, PassRefPtr<TimingFunction> easing)
89 : m_offset(offset)
90 , m_composite(composite)
91 , m_easing(easing)
95 double m_offset;
96 AnimationEffect::CompositeOperation m_composite;
97 RefPtr<TimingFunction> m_easing;
100 } // namespace blink
102 #endif // Keyframe_h