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

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

Issue 2286233002: Replaced PassRefPtr copies with moves in Source/core/animation. (Closed)
Patch Set: Created 4 years, 3 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
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, const CSSValue* value, EffectModel::CompositeOpe ration 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, std::move(ea sing), value, composite));
56 } 56 }
57 57
58 const CSSValue* value() const { return m_value.get(); } 58 const CSSValue* value() const { return m_value.get(); }
59 59
60 bool populateAnimatableValue(CSSPropertyID, Element&, const ComputedStyl e& baseStyle, const ComputedStyle* parentStyle) const final; 60 bool populateAnimatableValue(CSSPropertyID, Element&, const ComputedStyl e& baseStyle, const ComputedStyle* parentStyle) const final;
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, const 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, std::move(easing), comp osite)
70 , m_value(const_cast<CSSValue*>(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 // TODO(sashab): Make this a const CSSValue.
79 Persistent<CSSValue> m_value; 79 Persistent<CSSValue> m_value;
80 mutable RefPtr<AnimatableValue> m_animatableValueCache; 80 mutable RefPtr<AnimatableValue> m_animatableValueCache;
81 }; 81 };
82 82
83 class SVGPropertySpecificKeyframe : public Keyframe::PropertySpecificKeyfram e { 83 class SVGPropertySpecificKeyframe : public Keyframe::PropertySpecificKeyfram e {
84 public: 84 public:
85 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)
86 { 86 {
87 return adoptRef(new SVGPropertySpecificKeyframe(offset, easing, valu e, composite)); 87 return adoptRef(new SVGPropertySpecificKeyframe(offset, std::move(ea sing), value, composite));
88 } 88 }
89 89
90 const String& value() const { return m_value; } 90 const String& value() const { return m_value; }
91 91
92 PassRefPtr<PropertySpecificKeyframe> cloneWithOffset(double offset) cons t final; 92 PassRefPtr<PropertySpecificKeyframe> cloneWithOffset(double offset) cons t final;
93 93
94 const PassRefPtr<AnimatableValue> getAnimatableValue() const final { ret urn nullptr; } 94 const PassRefPtr<AnimatableValue> getAnimatableValue() const final { ret urn nullptr; }
95 95
96 bool isNeutral() const final { return m_value.isNull(); } 96 bool isNeutral() const final { return m_value.isNull(); }
97 PassRefPtr<PropertySpecificKeyframe> neutralKeyframe(double offset, Pass RefPtr<TimingFunction> easing) const final; 97 PassRefPtr<PropertySpecificKeyframe> neutralKeyframe(double offset, Pass RefPtr<TimingFunction> easing) const final;
98 98
99 private: 99 private:
100 SVGPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> ea sing, const String& value, EffectModel::CompositeOperation composite) 100 SVGPropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> ea sing, const String& value, EffectModel::CompositeOperation composite)
101 : Keyframe::PropertySpecificKeyframe(offset, easing, composite) 101 : Keyframe::PropertySpecificKeyframe(offset, std::move(easing), comp osite)
102 , m_value(value) 102 , m_value(value)
103 { } 103 { }
104 104
105 bool isSVGPropertySpecificKeyframe() const override { return true; } 105 bool isSVGPropertySpecificKeyframe() const override { return true; }
106 106
107 String m_value; 107 String m_value;
108 }; 108 };
109 109
110 private: 110 private:
111 StringKeyframe() 111 StringKeyframe()
(...skipping 16 matching lines...) Expand all
128 using CSSPropertySpecificKeyframe = StringKeyframe::CSSPropertySpecificKeyframe; 128 using CSSPropertySpecificKeyframe = StringKeyframe::CSSPropertySpecificKeyframe;
129 using SVGPropertySpecificKeyframe = StringKeyframe::SVGPropertySpecificKeyframe; 129 using SVGPropertySpecificKeyframe = StringKeyframe::SVGPropertySpecificKeyframe;
130 130
131 DEFINE_TYPE_CASTS(StringKeyframe, Keyframe, value, value->isStringKeyframe(), va lue.isStringKeyframe()); 131 DEFINE_TYPE_CASTS(StringKeyframe, Keyframe, value, value->isStringKeyframe(), va lue.isStringKeyframe());
132 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());
133 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());
134 134
135 } // namespace blink 135 } // namespace blink
136 136
137 #endif 137 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698