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

Side by Side Diff: Source/core/animation/animatable/AnimatableValue.h

Issue 1120003002: [Oilpan] Migrate most classes under core/animations to Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 4 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 20 matching lines...) Expand all
31 #ifndef AnimatableValue_h 31 #ifndef AnimatableValue_h
32 #define AnimatableValue_h 32 #define AnimatableValue_h
33 33
34 #include "core/CoreExport.h" 34 #include "core/CoreExport.h"
35 #include "core/css/CSSValue.h" 35 #include "core/css/CSSValue.h"
36 #include "platform/heap/Handle.h" 36 #include "platform/heap/Handle.h"
37 #include "wtf/RefCounted.h" 37 #include "wtf/RefCounted.h"
38 38
39 namespace blink { 39 namespace blink {
40 40
41 class CORE_EXPORT AnimatableValue : public RefCountedWillBeGarbageCollectedFinal ized<AnimatableValue> { 41 class CORE_EXPORT AnimatableValue : public GarbageCollectedFinalized<AnimatableV alue> {
42 public: 42 public:
43 virtual ~AnimatableValue() { } 43 virtual ~AnimatableValue() { }
44 44
45 static const AnimatableValue* neutralValue(); 45 static const AnimatableValue* neutralValue();
46 46
47 static PassRefPtrWillBeRawPtr<AnimatableValue> interpolate(const AnimatableV alue*, const AnimatableValue*, double fraction); 47 static AnimatableValue* interpolate(const AnimatableValue*, const Animatable Value*, double fraction);
48 static bool usesDefaultInterpolation(const AnimatableValue* from, const Anim atableValue* to) 48 static bool usesDefaultInterpolation(const AnimatableValue* from, const Anim atableValue* to)
49 { 49 {
50 return !from->isSameType(to) || from->usesDefaultInterpolationWith(to); 50 return !from->isSameType(to) || from->usesDefaultInterpolationWith(to);
51 } 51 }
52 52
53 bool equals(const AnimatableValue* value) const 53 bool equals(const AnimatableValue* value) const
54 { 54 {
55 return isSameType(value) && equalTo(value); 55 return isSameType(value) && equalTo(value);
56 } 56 }
57 bool equals(const AnimatableValue& value) const 57 bool equals(const AnimatableValue& value) const
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 TypeSVGPaint, 110 TypeSVGPaint,
111 TypeShadow, 111 TypeShadow,
112 TypeShapeValue, 112 TypeShapeValue,
113 TypeStrokeDasharrayList, 113 TypeStrokeDasharrayList,
114 TypeTransform, 114 TypeTransform,
115 TypeUnknown, 115 TypeUnknown,
116 TypeVisibility, 116 TypeVisibility,
117 }; 117 };
118 118
119 virtual bool usesDefaultInterpolationWith(const AnimatableValue* value) cons t { return false; } 119 virtual bool usesDefaultInterpolationWith(const AnimatableValue* value) cons t { return false; }
120 virtual PassRefPtrWillBeRawPtr<AnimatableValue> interpolateTo(const Animatab leValue*, double fraction) const = 0; 120 virtual AnimatableValue* interpolateTo(const AnimatableValue*, double fracti on) const = 0;
121 static PassRefPtrWillBeRawPtr<AnimatableValue> defaultInterpolateTo(const An imatableValue* left, const AnimatableValue* right, double fraction) { return tak eConstRef((fraction < 0.5) ? left : right); } 121 static AnimatableValue* defaultInterpolateTo(const AnimatableValue* left, co nst AnimatableValue* right, double fraction) { return takeConstRef((fraction < 0 .5) ? left : right); }
122 122
123 template <class T> 123 template <class T>
124 static PassRefPtrWillBeRawPtr<T> takeConstRef(const T* value) { return PassR efPtrWillBeRawPtr<T>(const_cast<T*>(value)); } 124 static T* takeConstRef(const T* value) { return const_cast<T*>(value); }
125 125
126 private: 126 private:
127 virtual AnimatableType type() const = 0; 127 virtual AnimatableType type() const = 0;
128 // Implementations can assume that the object being compared has the same ty pe as the object this is called on 128 // Implementations can assume that the object being compared has the same ty pe as the object this is called on
129 virtual bool equalTo(const AnimatableValue*) const = 0; 129 virtual bool equalTo(const AnimatableValue*) const = 0;
130 130
131 template <class Keyframe> friend class KeyframeEffectModel; 131 template <class Keyframe> friend class KeyframeEffectModel;
132 }; 132 };
133 133
134 #define DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(thisType, predicate) \ 134 #define DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(thisType, predicate) \
135 DEFINE_TYPE_CASTS(thisType, AnimatableValue, value, value->predicate, value. predicate) 135 DEFINE_TYPE_CASTS(thisType, AnimatableValue, value, value->predicate, value. predicate)
136 136
137 } // namespace blink 137 } // namespace blink
138 138
139 #endif // AnimatableValue_h 139 #endif // AnimatableValue_h
OLDNEW
« no previous file with comments | « Source/core/animation/animatable/AnimatableUnknownTest.cpp ('k') | Source/core/animation/animatable/AnimatableValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698