Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: third_party/WebKit/Source/core/animation/StringKeyframe.h

Issue 2088683002: Make StringKeyframe constructor take a const CSSValue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_make_csspropertyspecifickeyframe_take_const
Patch Set: Removed the persistent const Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 String svgPropertyValue(const QualifiedName& attributeName) const 44 String svgPropertyValue(const QualifiedName& attributeName) const
45 { 45 {
46 return m_svgAttributeMap.get(&attributeName); 46 return m_svgAttributeMap.get(&attributeName);
47 } 47 }
48 48
49 PropertyHandleSet properties() const override; 49 PropertyHandleSet properties() const override;
50 50
51 class CSSPropertySpecificKeyframe : public Keyframe::PropertySpecificKeyfram e { 51 class CSSPropertySpecificKeyframe : public Keyframe::PropertySpecificKeyfram e {
52 public: 52 public:
53 static PassRefPtr<CSSPropertySpecificKeyframe> create(double offset, Pas sRefPtr<TimingFunction> easing, CSSValue* value, EffectModel::CompositeOperation composite) 53 static PassRefPtr<CSSPropertySpecificKeyframe> create(double offset, Pas sRefPtr<TimingFunction> easing, const CSSValue* value, EffectModel::CompositeOpe ration composite)
54 { 54 {
55 return adoptRef(new CSSPropertySpecificKeyframe(offset, easing, valu e, composite)); 55 return adoptRef(new CSSPropertySpecificKeyframe(offset, easing, valu e, composite));
56 } 56 }
57 57
58 CSSValue* value() const { return m_value.get(); } 58 const CSSValue* value() const { return m_value.get(); }
59 59
60 virtual bool populateAnimatableValue(CSSPropertyID, Element&, const Comp utedStyle* baseStyle, bool force) const; 60 virtual bool populateAnimatableValue(CSSPropertyID, Element&, const Comp utedStyle* baseStyle, bool force) const;
61 const PassRefPtr<AnimatableValue> getAnimatableValue() const final { ret urn m_animatableValueCache.get(); } 61 const PassRefPtr<AnimatableValue> getAnimatableValue() const final { ret urn m_animatableValueCache.get(); }
62 void setAnimatableValue(PassRefPtr<AnimatableValue> value) { m_animatabl eValueCache = value; } 62 void setAnimatableValue(PassRefPtr<AnimatableValue> value) { m_animatabl eValueCache = value; }
63 63
64 bool isNeutral() const final { return !m_value; } 64 bool isNeutral() const final { return !m_value; }
65 PassRefPtr<Keyframe::PropertySpecificKeyframe> neutralKeyframe(double of fset, PassRefPtr<TimingFunction> easing) const final; 65 PassRefPtr<Keyframe::PropertySpecificKeyframe> neutralKeyframe(double of fset, PassRefPtr<TimingFunction> easing) const final;
66 66
67 private: 67 private:
68 CSSPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> ea sing, CSSValue* value, EffectModel::CompositeOperation composite) 68 CSSPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> ea sing, const CSSValue* value, EffectModel::CompositeOperation composite)
69 : Keyframe::PropertySpecificKeyframe(offset, easing, composite) 69 : Keyframe::PropertySpecificKeyframe(offset, easing, composite)
70 , m_value(value) 70 , m_value(const_cast<CSSValue*>(value))
71 { } 71 { }
72 72
73 virtual PassRefPtr<Keyframe::PropertySpecificKeyframe> cloneWithOffset(d ouble offset) const; 73 virtual PassRefPtr<Keyframe::PropertySpecificKeyframe> cloneWithOffset(d ouble offset) const;
74 bool isCSSPropertySpecificKeyframe() const override { return true; } 74 bool isCSSPropertySpecificKeyframe() const override { return true; }
75 75
76 void populateAnimatableValueCaches(CSSPropertyID, Keyframe::PropertySpec ificKeyframe&, Element*, CSSValue& fromCSSValue, CSSValue& toCSSValue) const; 76 void populateAnimatableValueCaches(CSSPropertyID, Keyframe::PropertySpec ificKeyframe&, Element*, CSSValue& fromCSSValue, CSSValue& toCSSValue) const;
77 77
78 // TODO(sashab): Make this a const CSSValue.
78 Persistent<CSSValue> m_value; 79 Persistent<CSSValue> m_value;
79 mutable RefPtr<AnimatableValue> m_animatableValueCache; 80 mutable RefPtr<AnimatableValue> m_animatableValueCache;
80 }; 81 };
81 82
82 class SVGPropertySpecificKeyframe : public Keyframe::PropertySpecificKeyfram e { 83 class SVGPropertySpecificKeyframe : public Keyframe::PropertySpecificKeyfram e {
83 public: 84 public:
84 static PassRefPtr<SVGPropertySpecificKeyframe> create(double offset, Pas sRefPtr<TimingFunction> easing, const String& value, EffectModel::CompositeOpera tion composite) 85 static PassRefPtr<SVGPropertySpecificKeyframe> create(double offset, Pas sRefPtr<TimingFunction> easing, const String& value, EffectModel::CompositeOpera tion composite)
85 { 86 {
86 return adoptRef(new SVGPropertySpecificKeyframe(offset, easing, valu e, composite)); 87 return adoptRef(new SVGPropertySpecificKeyframe(offset, easing, valu e, composite));
87 } 88 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 using CSSPropertySpecificKeyframe = StringKeyframe::CSSPropertySpecificKeyframe; 128 using CSSPropertySpecificKeyframe = StringKeyframe::CSSPropertySpecificKeyframe;
128 using SVGPropertySpecificKeyframe = StringKeyframe::SVGPropertySpecificKeyframe; 129 using SVGPropertySpecificKeyframe = StringKeyframe::SVGPropertySpecificKeyframe;
129 130
130 DEFINE_TYPE_CASTS(StringKeyframe, Keyframe, value, value->isStringKeyframe(), va lue.isStringKeyframe()); 131 DEFINE_TYPE_CASTS(StringKeyframe, Keyframe, value, value->isStringKeyframe(), va lue.isStringKeyframe());
131 DEFINE_TYPE_CASTS(CSSPropertySpecificKeyframe, Keyframe::PropertySpecificKeyfram e, value, value->isCSSPropertySpecificKeyframe(), value.isCSSPropertySpecificKey frame()); 132 DEFINE_TYPE_CASTS(CSSPropertySpecificKeyframe, Keyframe::PropertySpecificKeyfram e, value, value->isCSSPropertySpecificKeyframe(), value.isCSSPropertySpecificKey frame());
132 DEFINE_TYPE_CASTS(SVGPropertySpecificKeyframe, Keyframe::PropertySpecificKeyfram e, value, value->isSVGPropertySpecificKeyframe(), value.isSVGPropertySpecificKey frame()); 133 DEFINE_TYPE_CASTS(SVGPropertySpecificKeyframe, Keyframe::PropertySpecificKeyfram e, value, value->isSVGPropertySpecificKeyframe(), value.isSVGPropertySpecificKey frame());
133 134
134 } // namespace blink 135 } // namespace blink
135 136
136 #endif 137 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698