Rename rendering/RenderFileUploadControl to layout/LayoutFileUploadControl.
[chromium-blink-merge.git] / third_party / WebKit / Source / core / animation / StringKeyframe.h
blob6ebb99c3114d6f4bdf134ecbfa6d37ad9c89c1ab
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 StringKeyframe_h
6 #define StringKeyframe_h
8 #include "core/animation/Keyframe.h"
9 #include "core/css/StylePropertySet.h"
11 namespace blink {
13 class StyleSheetContents;
15 class StringKeyframe : public Keyframe {
16 public:
17 static PassRefPtrWillBeRawPtr<StringKeyframe> create()
19 return adoptRefWillBeNoop(new StringKeyframe);
21 void setPropertyValue(CSSPropertyID, const String& value, StyleSheetContents*);
22 void setPropertyValue(CSSPropertyID, PassRefPtrWillBeRawPtr<CSSValue>);
23 void clearPropertyValue(CSSPropertyID property) { m_propertySet->removeProperty(property); }
24 CSSValue* propertyValue(CSSPropertyID property) const
26 int index = m_propertySet->findPropertyIndex(property);
27 RELEASE_ASSERT(index >= 0);
28 return m_propertySet->propertyAt(static_cast<unsigned>(index)).value();
30 virtual PropertySet properties() const override;
31 RefPtrWillBeMember<MutableStylePropertySet> propertySetForInspector() const { return m_propertySet; }
33 DECLARE_VIRTUAL_TRACE();
35 class PropertySpecificKeyframe : public Keyframe::PropertySpecificKeyframe {
36 public:
37 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, CSSValue*, AnimationEffect::CompositeOperation);
39 CSSValue* value() const { return m_value.get(); }
40 void setEasing(PassRefPtrWillBeRawPtr<TimingFunction> easing) { m_easing = easing; }
41 virtual const PassRefPtrWillBeRawPtr<AnimatableValue> getAnimatableValue() const override final { return m_animatableValueCache.get(); }
42 void setAnimatableValue(PassRefPtrWillBeRawPtr<AnimatableValue>);
44 virtual PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> neutralKeyframe(double offset, PassRefPtr<TimingFunction> easing) const override final;
45 virtual PassRefPtrWillBeRawPtr<Interpolation> maybeCreateInterpolation(CSSPropertyID, blink::Keyframe::PropertySpecificKeyframe& end, Element*) const override final;
47 DECLARE_VIRTUAL_TRACE();
49 private:
50 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easing, CSSValue*);
52 virtual PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> cloneWithOffset(double offset) const;
53 virtual bool isStringPropertySpecificKeyframe() const override { return true; }
55 static bool createInterpolationsFromCSSValues(CSSPropertyID, CSSValue* fromCSSValue, CSSValue* toCSSValue, Element*, OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>>& interpolations);
57 void ensureAnimatableValueCaches(CSSPropertyID, Keyframe::PropertySpecificKeyframe&, Element*, CSSValue& fromCSSValue, CSSValue& toCSSValue) const;
59 RefPtrWillBeMember<CSSValue> m_value;
60 mutable RefPtrWillBeMember<AnimatableValue> m_animatableValueCache;
63 private:
64 StringKeyframe()
65 : m_propertySet(MutableStylePropertySet::create())
66 { }
68 StringKeyframe(const StringKeyframe& copyFrom);
70 virtual PassRefPtrWillBeRawPtr<Keyframe> clone() const override;
71 virtual PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> createPropertySpecificKeyframe(CSSPropertyID) const override;
73 virtual bool isStringKeyframe() const override { return true; }
75 RefPtrWillBeMember<MutableStylePropertySet> m_propertySet;
78 using StringPropertySpecificKeyframe = StringKeyframe::PropertySpecificKeyframe;
80 DEFINE_TYPE_CASTS(StringKeyframe, Keyframe, value, value->isStringKeyframe(), value.isStringKeyframe());
81 DEFINE_TYPE_CASTS(StringPropertySpecificKeyframe, Keyframe::PropertySpecificKeyframe, value, value->isStringPropertySpecificKeyframe(), value.isStringPropertySpecificKeyframe());
85 #endif