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

Side by Side Diff: Source/core/animation/AnimatableValue.cpp

Issue 19367002: Implement DeferredAnimatableValue (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rename class Created 7 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 | Annotate | Revision Log
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 16 matching lines...) Expand all
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "core/animation/AnimatableValue.h" 32 #include "core/animation/AnimatableValue.h"
33 33
34 #include "core/animation/AnimatableNeutral.h" 34 #include "core/animation/AnimatableNeutral.h"
35 #include "core/animation/AnimatableNumber.h" 35 #include "core/animation/AnimatableNumber.h"
36 #include "core/animation/AnimatableUnknown.h" 36 #include "core/animation/AnimatableUnknown.h"
37 #include "core/animation/DeferredAnimatableValue.h"
37 38
38 #include <algorithm> 39 #include <algorithm>
39 40
40 namespace WebCore { 41 namespace WebCore {
41 42
42 PassRefPtr<AnimatableValue> AnimatableValue::create(CSSValue* value) 43 PassRefPtr<AnimatableValue> AnimatableValue::create(CSSValue* value)
43 { 44 {
44 // FIXME: Move this logic to a separate factory class. 45 // FIXME: Move this logic to a separate factory class.
45 // FIXME: Handle all animatable CSSValue types. 46 // FIXME: Handle all animatable CSSValue types.
46 if (AnimatableNumber::canCreateFrom(value)) 47 if (AnimatableNumber::canCreateFrom(value))
47 return AnimatableNumber::create(value); 48 return AnimatableNumber::create(value);
48 return AnimatableUnknown::create(value); 49 return AnimatableUnknown::create(value);
49 } 50 }
50 51
51 const AnimatableValue* AnimatableValue::neutralValue() 52 const AnimatableValue* AnimatableValue::neutralValue()
52 { 53 {
53 static AnimatableNeutral* neutralSentinelValue = AnimatableNeutral::create() .leakRef(); 54 static AnimatableNeutral* neutralSentinelValue = AnimatableNeutral::create() .leakRef();
54 return neutralSentinelValue; 55 return neutralSentinelValue;
55 } 56 }
56 57
58 const AnimatableValue* AnimatableValue::deferredSnapshotValue()
Steve Block 2013/08/05 08:14:56 deferredValue() to match DeferredAnimatableValue?
59 {
60 static DeferredAnimatableValue* deferredAnimatableValueSentinel = DeferredAn imatableValue::create().leakRef();
61 return deferredAnimatableValueSentinel;
62 }
63
57 PassRefPtr<AnimatableValue> AnimatableValue::interpolate(const AnimatableValue* left, const AnimatableValue* right, double fraction) 64 PassRefPtr<AnimatableValue> AnimatableValue::interpolate(const AnimatableValue* left, const AnimatableValue* right, double fraction)
58 { 65 {
59 ASSERT(left); 66 ASSERT(left);
60 ASSERT(right); 67 ASSERT(right);
61 ASSERT(!left->isNeutral()); 68 ASSERT(!left->isNeutral());
62 ASSERT(!right->isNeutral()); 69 ASSERT(!right->isNeutral());
63 70
64 if (fraction && fraction != 1 && left->isSameType(right)) 71 if (fraction && fraction != 1 && left->isSameType(right))
65 return left->interpolateTo(right, fraction); 72 return left->interpolateTo(right, fraction);
66 73
(...skipping 10 matching lines...) Expand all
77 if (right->isNeutral()) 84 if (right->isNeutral())
78 return takeConstRef(left); 85 return takeConstRef(left);
79 86
80 if (left->isSameType(right)) 87 if (left->isSameType(right))
81 return left->addWith(right); 88 return left->addWith(right);
82 89
83 return defaultAddWith(left, right); 90 return defaultAddWith(left, right);
84 } 91 }
85 92
86 } // namespace WebCore 93 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698