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

Side by Side Diff: Source/core/animation/InterpolableValue.h

Issue 1082293003: Componentization: make core/animation,clipboard,css,dom,editing,frame,html visible for blink_web. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: WIP Created 5 years, 8 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 | « Source/core/animation/AnimationTranslationUtil.h ('k') | Source/core/animation/Keyframe.h » ('j') | 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 InterpolableValue_h 5 #ifndef InterpolableValue_h
6 #define InterpolableValue_h 6 #define InterpolableValue_h
7 7
8 #include "core/CoreExport.h"
8 #include "core/animation/animatable/AnimatableValue.h" 9 #include "core/animation/animatable/AnimatableValue.h"
9 #include "platform/heap/Handle.h" 10 #include "platform/heap/Handle.h"
11 #include "wtf/Noncopyable.h"
tasak 2015/04/15 06:08:15 No need to include wtf/Noncopyable.h.
10 #include "wtf/OwnPtr.h" 12 #include "wtf/OwnPtr.h"
11 #include "wtf/PassOwnPtr.h" 13 #include "wtf/PassOwnPtr.h"
12 #include "wtf/Vector.h" 14 #include "wtf/Vector.h"
13 15
14 namespace blink { 16 namespace blink {
15 17
16 class InterpolableValue : public NoBaseWillBeGarbageCollected<InterpolableValue> { 18 class CORE_EXPORT InterpolableValue : public NoBaseWillBeGarbageCollected<Interp olableValue> {
17 DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(InterpolableValue); 19 DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(InterpolableValue);
18 public: 20 public:
19 virtual bool isNumber() const { return false; } 21 virtual bool isNumber() const { return false; }
20 virtual bool isBool() const { return false; } 22 virtual bool isBool() const { return false; }
21 virtual bool isList() const { return false; } 23 virtual bool isList() const { return false; }
22 virtual bool isAnimatableValue() const { return false; } 24 virtual bool isAnimatableValue() const { return false; }
23 25
24 virtual PassOwnPtrWillBeRawPtr<InterpolableValue> clone() const = 0; 26 virtual PassOwnPtrWillBeRawPtr<InterpolableValue> clone() const = 0;
25 27
26 DEFINE_INLINE_VIRTUAL_TRACE() { } 28 DEFINE_INLINE_VIRTUAL_TRACE() { }
27 29
28 private: 30 private:
29 virtual void interpolate(const InterpolableValue& to, const double progress, InterpolableValue& result) const = 0; 31 virtual void interpolate(const InterpolableValue& to, const double progress, InterpolableValue& result) const = 0;
30 virtual void add(const InterpolableValue& rhs, InterpolableValue& result) co nst = 0; 32 virtual void add(const InterpolableValue& rhs, InterpolableValue& result) co nst = 0;
31 virtual void multiply(double scalar, InterpolableValue& result) const = 0; 33 virtual void multiply(double scalar, InterpolableValue& result) const = 0;
32 34
33 friend class Interpolation; 35 friend class Interpolation;
34 36
35 // Keep interpolate private, but allow calls within the hierarchy without 37 // Keep interpolate private, but allow calls within the hierarchy without
36 // knowledge of type. 38 // knowledge of type.
37 friend class DeferredLegacyStyleInterpolation; 39 friend class DeferredLegacyStyleInterpolation;
38 friend class InterpolableNumber; 40 friend class InterpolableNumber;
39 friend class InterpolableBool; 41 friend class InterpolableBool;
40 friend class InterpolableList; 42 friend class InterpolableList;
41 43
42 friend class AnimationInterpolableValueTest; 44 friend class AnimationInterpolableValueTest;
43 }; 45 };
44 46
45 class InterpolableNumber final : public InterpolableValue { 47 class CORE_EXPORT InterpolableNumber final : public InterpolableValue {
46 public: 48 public:
47 static PassOwnPtrWillBeRawPtr<InterpolableNumber> create(double value) 49 static PassOwnPtrWillBeRawPtr<InterpolableNumber> create(double value)
48 { 50 {
49 return adoptPtrWillBeNoop(new InterpolableNumber(value)); 51 return adoptPtrWillBeNoop(new InterpolableNumber(value));
50 } 52 }
51 53
52 virtual bool isNumber() const override final { return true; } 54 virtual bool isNumber() const override final { return true; }
53 double value() const { return m_value; } 55 double value() const { return m_value; }
54 virtual PassOwnPtrWillBeRawPtr<InterpolableValue> clone() const override fin al { return create(m_value); } 56 virtual PassOwnPtrWillBeRawPtr<InterpolableValue> clone() const override fin al { return create(m_value); }
55 57
56 private: 58 private:
57 virtual void interpolate(const InterpolableValue& to, const double progress, InterpolableValue& result) const override final; 59 virtual void interpolate(const InterpolableValue& to, const double progress, InterpolableValue& result) const override final;
58 virtual void add(const InterpolableValue& rhs, InterpolableValue& result) co nst override final; 60 virtual void add(const InterpolableValue& rhs, InterpolableValue& result) co nst override final;
59 virtual void multiply(double scalar, InterpolableValue& result) const overri de final; 61 virtual void multiply(double scalar, InterpolableValue& result) const overri de final;
60 double m_value; 62 double m_value;
61 63
62 explicit InterpolableNumber(double value) 64 explicit InterpolableNumber(double value)
63 : m_value(value) 65 : m_value(value)
64 { 66 {
65 } 67 }
66 68
67 }; 69 };
68 70
69 class InterpolableBool final : public InterpolableValue { 71 class CORE_EXPORT InterpolableBool final : public InterpolableValue {
70 public: 72 public:
71 static PassOwnPtrWillBeRawPtr<InterpolableBool> create(bool value) 73 static PassOwnPtrWillBeRawPtr<InterpolableBool> create(bool value)
72 { 74 {
73 return adoptPtrWillBeNoop(new InterpolableBool(value)); 75 return adoptPtrWillBeNoop(new InterpolableBool(value));
74 } 76 }
75 77
76 virtual bool isBool() const override final { return true; } 78 virtual bool isBool() const override final { return true; }
77 bool value() const { return m_value; } 79 bool value() const { return m_value; }
78 virtual PassOwnPtrWillBeRawPtr<InterpolableValue> clone() const override fin al { return create(m_value); } 80 virtual PassOwnPtrWillBeRawPtr<InterpolableValue> clone() const override fin al { return create(m_value); }
79 81
80 private: 82 private:
81 virtual void interpolate(const InterpolableValue& to, const double progress, InterpolableValue& result) const override final; 83 virtual void interpolate(const InterpolableValue& to, const double progress, InterpolableValue& result) const override final;
82 virtual void add(const InterpolableValue& rhs, InterpolableValue& result) co nst override final; 84 virtual void add(const InterpolableValue& rhs, InterpolableValue& result) co nst override final;
83 virtual void multiply(double scalar, InterpolableValue& result) const overri de final { ASSERT_NOT_REACHED(); } 85 virtual void multiply(double scalar, InterpolableValue& result) const overri de final { ASSERT_NOT_REACHED(); }
84 bool m_value; 86 bool m_value;
85 87
86 explicit InterpolableBool(bool value) 88 explicit InterpolableBool(bool value)
87 : m_value(value) 89 : m_value(value)
88 { 90 {
89 } 91 }
90 92
91 }; 93 };
92 94
93 class InterpolableList : public InterpolableValue { 95 class CORE_EXPORT InterpolableList : public InterpolableValue {
94 public: 96 public:
97 InterpolableList& operator=(const InterpolableList&) = delete;
tasak 2015/04/15 06:08:15 We cannot use MAKE_WTF_NONCOPYABLE because Interpo
98
95 static PassOwnPtrWillBeRawPtr<InterpolableList> create(const InterpolableLis t &other) 99 static PassOwnPtrWillBeRawPtr<InterpolableList> create(const InterpolableLis t &other)
96 { 100 {
97 return adoptPtrWillBeNoop(new InterpolableList(other)); 101 return adoptPtrWillBeNoop(new InterpolableList(other));
98 } 102 }
99 103
100 static PassOwnPtrWillBeRawPtr<InterpolableList> create(size_t size) 104 static PassOwnPtrWillBeRawPtr<InterpolableList> create(size_t size)
101 { 105 {
102 return adoptPtrWillBeNoop(new InterpolableList(size)); 106 return adoptPtrWillBeNoop(new InterpolableList(size));
103 } 107 }
104 108
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 }; 171 };
168 172
169 DEFINE_TYPE_CASTS(InterpolableNumber, InterpolableValue, value, value->isNumber( ), value.isNumber()); 173 DEFINE_TYPE_CASTS(InterpolableNumber, InterpolableValue, value, value->isNumber( ), value.isNumber());
170 DEFINE_TYPE_CASTS(InterpolableBool, InterpolableValue, value, value->isBool(), v alue.isBool()); 174 DEFINE_TYPE_CASTS(InterpolableBool, InterpolableValue, value, value->isBool(), v alue.isBool());
171 DEFINE_TYPE_CASTS(InterpolableList, InterpolableValue, value, value->isList(), v alue.isList()); 175 DEFINE_TYPE_CASTS(InterpolableList, InterpolableValue, value, value->isList(), v alue.isList());
172 DEFINE_TYPE_CASTS(InterpolableAnimatableValue, InterpolableValue, value, value-> isAnimatableValue(), value.isAnimatableValue()); 176 DEFINE_TYPE_CASTS(InterpolableAnimatableValue, InterpolableValue, value, value-> isAnimatableValue(), value.isAnimatableValue());
173 177
174 } 178 }
175 179
176 #endif 180 #endif
OLDNEW
« no previous file with comments | « Source/core/animation/AnimationTranslationUtil.h ('k') | Source/core/animation/Keyframe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698