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 StringKeyframe_h | 5 #ifndef StringKeyframe_h |
6 #define StringKeyframe_h | 6 #define StringKeyframe_h |
7 | 7 |
8 #include "core/animation/Keyframe.h" | 8 #include "core/animation/Keyframe.h" |
9 #include "core/css/StylePropertySet.h" | 9 #include "core/css/StylePropertySet.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 class StyleSheetContents; | 13 class StyleSheetContents; |
14 | 14 |
15 class StringKeyframe : public Keyframe { | 15 class StringKeyframe : public Keyframe { |
16 public: | 16 public: |
17 static PassRefPtrWillBeRawPtr<StringKeyframe> create() | 17 static PassRefPtrWillBeRawPtr<StringKeyframe> create() |
18 { | 18 { |
19 return adoptRefWillBeNoop(new StringKeyframe); | 19 return adoptRefWillBeNoop(new StringKeyframe); |
20 } | 20 } |
21 void setPropertyValue(CSSPropertyID, const String& value, StyleSheetContents
*); | 21 void setPropertyValue(CSSPropertyID, const String& value, StyleSheetContents
*); |
22 void clearPropertyValue(CSSPropertyID property) { m_propertySet->removePrope
rty(property); } | 22 void clearPropertyValue(CSSPropertyID property) { m_propertySet->removePrope
rty(property); } |
23 CSSValue* propertyValue(CSSPropertyID property) const | 23 CSSValue* propertyValue(CSSPropertyID property) const |
24 { | 24 { |
25 int index = m_propertySet->findPropertyIndex(property); | 25 int index = m_propertySet->findPropertyIndex(property); |
26 RELEASE_ASSERT(index >= 0); | 26 RELEASE_ASSERT(index >= 0); |
27 return m_propertySet->propertyAt(static_cast<unsigned>(index)).value(); | 27 return m_propertySet->propertyAt(static_cast<unsigned>(index)).value(); |
28 } | 28 } |
29 virtual PropertySet properties() const OVERRIDE; | 29 virtual PropertySet properties() const override; |
30 | 30 |
31 virtual void trace(Visitor*) OVERRIDE; | 31 virtual void trace(Visitor*) override; |
32 | 32 |
33 class PropertySpecificKeyframe : public Keyframe::PropertySpecificKeyframe { | 33 class PropertySpecificKeyframe : public Keyframe::PropertySpecificKeyframe { |
34 public: | 34 public: |
35 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin
g, CSSValue*, AnimationEffect::CompositeOperation); | 35 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin
g, CSSValue*, AnimationEffect::CompositeOperation); |
36 | 36 |
37 CSSValue* value() const { return m_value.get(); } | 37 CSSValue* value() const { return m_value.get(); } |
38 virtual const PassRefPtrWillBeRawPtr<AnimatableValue> getAnimatableValue
() const OVERRIDE FINAL { | 38 virtual const PassRefPtrWillBeRawPtr<AnimatableValue> getAnimatableValue
() const override final { return m_animatableValueCache.get(); } |
39 return m_animatableValueCache.get(); | |
40 } | |
41 | 39 |
42 virtual PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> neutr
alKeyframe(double offset, PassRefPtr<TimingFunction> easing) const OVERRIDE FINA
L; | 40 virtual PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> neutr
alKeyframe(double offset, PassRefPtr<TimingFunction> easing) const override fina
l; |
43 virtual PassRefPtrWillBeRawPtr<Interpolation> createInterpolation(CSSPro
pertyID, blink::Keyframe::PropertySpecificKeyframe* end, Element*) const OVERRID
E FINAL; | 41 virtual PassRefPtrWillBeRawPtr<Interpolation> createInterpolation(CSSPro
pertyID, blink::Keyframe::PropertySpecificKeyframe* end, Element*) const overrid
e final; |
44 | 42 |
45 virtual void trace(Visitor*) OVERRIDE; | 43 virtual void trace(Visitor*) override; |
46 | 44 |
47 private: | 45 private: |
48 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin
g, CSSValue*); | 46 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin
g, CSSValue*); |
49 | 47 |
50 virtual PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> clone
WithOffset(double offset) const; | 48 virtual PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> clone
WithOffset(double offset) const; |
51 virtual bool isStringPropertySpecificKeyframe() const OVERRIDE { return
true; } | 49 virtual bool isStringPropertySpecificKeyframe() const override { return
true; } |
52 | 50 |
53 RefPtrWillBeMember<CSSValue> m_value; | 51 RefPtrWillBeMember<CSSValue> m_value; |
54 mutable RefPtrWillBeMember<AnimatableValue> m_animatableValueCache; | 52 mutable RefPtrWillBeMember<AnimatableValue> m_animatableValueCache; |
55 }; | 53 }; |
56 | 54 |
57 private: | 55 private: |
58 StringKeyframe() | 56 StringKeyframe() |
59 : m_propertySet(MutableStylePropertySet::create()) | 57 : m_propertySet(MutableStylePropertySet::create()) |
60 { } | 58 { } |
61 | 59 |
62 StringKeyframe(const StringKeyframe& copyFrom); | 60 StringKeyframe(const StringKeyframe& copyFrom); |
63 | 61 |
64 virtual PassRefPtrWillBeRawPtr<Keyframe> clone() const OVERRIDE; | 62 virtual PassRefPtrWillBeRawPtr<Keyframe> clone() const override; |
65 virtual PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> createPro
pertySpecificKeyframe(CSSPropertyID) const OVERRIDE; | 63 virtual PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> createPro
pertySpecificKeyframe(CSSPropertyID) const override; |
66 | 64 |
67 virtual bool isStringKeyframe() const OVERRIDE { return true; } | 65 virtual bool isStringKeyframe() const override { return true; } |
68 | 66 |
69 RefPtrWillBeMember<MutableStylePropertySet> m_propertySet; | 67 RefPtrWillBeMember<MutableStylePropertySet> m_propertySet; |
70 }; | 68 }; |
71 | 69 |
72 typedef StringKeyframe::PropertySpecificKeyframe StringPropertySpecificKeyframe; | 70 typedef StringKeyframe::PropertySpecificKeyframe StringPropertySpecificKeyframe; |
73 | 71 |
74 DEFINE_TYPE_CASTS(StringKeyframe, Keyframe, value, value->isStringKeyframe(), va
lue.isStringKeyframe()); | 72 DEFINE_TYPE_CASTS(StringKeyframe, Keyframe, value, value->isStringKeyframe(), va
lue.isStringKeyframe()); |
75 DEFINE_TYPE_CASTS(StringPropertySpecificKeyframe, Keyframe::PropertySpecificKeyf
rame, value, value->isStringPropertySpecificKeyframe(), value.isStringPropertySp
ecificKeyframe()); | 73 DEFINE_TYPE_CASTS(StringPropertySpecificKeyframe, Keyframe::PropertySpecificKeyf
rame, value, value->isStringPropertySpecificKeyframe(), value.isStringPropertySp
ecificKeyframe()); |
76 | 74 |
77 } | 75 } |
78 | 76 |
79 #endif | 77 #endif |
OLD | NEW |