| 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 SKY_ENGINE_CORE_ANIMATION_STRINGKEYFRAME_H_ | |
| 6 #define SKY_ENGINE_CORE_ANIMATION_STRINGKEYFRAME_H_ | |
| 7 | |
| 8 #include "sky/engine/core/animation/Keyframe.h" | |
| 9 #include "sky/engine/core/css/StylePropertySet.h" | |
| 10 | |
| 11 namespace blink { | |
| 12 | |
| 13 class StyleSheetContents; | |
| 14 | |
| 15 class StringKeyframe : public Keyframe { | |
| 16 public: | |
| 17 static PassRefPtr<StringKeyframe> create() | |
| 18 { | |
| 19 return adoptRef(new StringKeyframe); | |
| 20 } | |
| 21 void setPropertyValue(CSSPropertyID, const String& value, StyleSheetContents
*); | |
| 22 void clearPropertyValue(CSSPropertyID property) { m_propertySet->removePrope
rty(property); } | |
| 23 CSSValue* propertyValue(CSSPropertyID property) const | |
| 24 { | |
| 25 int index = m_propertySet->findPropertyIndex(property); | |
| 26 RELEASE_ASSERT(index >= 0); | |
| 27 return m_propertySet->propertyAt(static_cast<unsigned>(index)).value(); | |
| 28 } | |
| 29 virtual PropertySet properties() const override; | |
| 30 | |
| 31 class PropertySpecificKeyframe : public Keyframe::PropertySpecificKeyframe { | |
| 32 public: | |
| 33 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin
g, CSSValue*, AnimationEffect::CompositeOperation); | |
| 34 | |
| 35 CSSValue* value() const { return m_value.get(); } | |
| 36 virtual const PassRefPtr<AnimatableValue> getAnimatableValue() const ove
rride final { | |
| 37 return m_animatableValueCache.get(); | |
| 38 } | |
| 39 | |
| 40 virtual PassOwnPtr<Keyframe::PropertySpecificKeyframe> neutralKeyframe(d
ouble offset, PassRefPtr<TimingFunction> easing) const override final; | |
| 41 virtual PassRefPtr<Interpolation> createInterpolation(CSSPropertyID, bli
nk::Keyframe::PropertySpecificKeyframe* end, Element*) const override final; | |
| 42 | |
| 43 private: | |
| 44 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin
g, CSSValue*); | |
| 45 | |
| 46 virtual PassOwnPtr<Keyframe::PropertySpecificKeyframe> cloneWithOffset(d
ouble offset) const; | |
| 47 virtual bool isStringPropertySpecificKeyframe() const override { return
true; } | |
| 48 | |
| 49 RefPtr<CSSValue> m_value; | |
| 50 mutable RefPtr<AnimatableValue> m_animatableValueCache; | |
| 51 }; | |
| 52 | |
| 53 private: | |
| 54 StringKeyframe() | |
| 55 : m_propertySet(MutableStylePropertySet::create()) | |
| 56 { } | |
| 57 | |
| 58 StringKeyframe(const StringKeyframe& copyFrom); | |
| 59 | |
| 60 virtual PassRefPtr<Keyframe> clone() const override; | |
| 61 virtual PassOwnPtr<Keyframe::PropertySpecificKeyframe> createPropertySpecifi
cKeyframe(CSSPropertyID) const override; | |
| 62 | |
| 63 virtual bool isStringKeyframe() const override { return true; } | |
| 64 | |
| 65 RefPtr<MutableStylePropertySet> m_propertySet; | |
| 66 }; | |
| 67 | |
| 68 typedef StringKeyframe::PropertySpecificKeyframe StringPropertySpecificKeyframe; | |
| 69 | |
| 70 DEFINE_TYPE_CASTS(StringKeyframe, Keyframe, value, value->isStringKeyframe(), va
lue.isStringKeyframe()); | |
| 71 DEFINE_TYPE_CASTS(StringPropertySpecificKeyframe, Keyframe::PropertySpecificKeyf
rame, value, value->isStringPropertySpecificKeyframe(), value.isStringPropertySp
ecificKeyframe()); | |
| 72 | |
| 73 } | |
| 74 | |
| 75 #endif // SKY_ENGINE_CORE_ANIMATION_STRINGKEYFRAME_H_ | |
| OLD | NEW |