OLD | NEW |
---|---|
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 Loading... | |
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 #include "core/animation/AnimatableNeutral.h" | 33 #include "core/animation/AnimatableNeutral.h" |
34 #include "wtf/StdLibExtras.h" | 34 #include "wtf/StdLibExtras.h" |
35 #include <algorithm> | 35 #include <algorithm> |
36 | 36 |
37 namespace { | |
38 | |
39 const double defaultDistance = 1; | |
40 | |
41 } // namespace | |
42 | |
37 namespace WebCore { | 43 namespace WebCore { |
38 | 44 |
39 const AnimatableValue* AnimatableValue::neutralValue() | 45 const AnimatableValue* AnimatableValue::neutralValue() |
40 { | 46 { |
41 DEFINE_STATIC_REF(AnimatableNeutral, neutralSentinelValue, (AnimatableNeutra l::create())); | 47 DEFINE_STATIC_REF(AnimatableNeutral, neutralSentinelValue, (AnimatableNeutra l::create())); |
42 return neutralSentinelValue; | 48 return neutralSentinelValue; |
43 } | 49 } |
44 | 50 |
45 PassRefPtr<AnimatableValue> AnimatableValue::interpolate(const AnimatableValue* left, const AnimatableValue* right, double fraction) | 51 PassRefPtr<AnimatableValue> AnimatableValue::interpolate(const AnimatableValue* left, const AnimatableValue* right, double fraction) |
46 { | 52 { |
(...skipping 17 matching lines...) Expand all Loading... | |
64 return takeConstRef(right); | 70 return takeConstRef(right); |
65 if (right->isNeutral()) | 71 if (right->isNeutral()) |
66 return takeConstRef(left); | 72 return takeConstRef(left); |
67 | 73 |
68 if (left->isSameType(right)) | 74 if (left->isSameType(right)) |
69 return left->addWith(right); | 75 return left->addWith(right); |
70 | 76 |
71 return defaultAddWith(left, right); | 77 return defaultAddWith(left, right); |
72 } | 78 } |
73 | 79 |
80 | |
dstockwell
2014/03/05 03:16:57
extra line added
Eric Willigers
2014/03/05 03:54:49
Done.
| |
74 PassRefPtr<AnimatableValue> AnimatableValue::addWith(const AnimatableValue* valu e) const | 81 PassRefPtr<AnimatableValue> AnimatableValue::addWith(const AnimatableValue* valu e) const |
75 { | 82 { |
76 return defaultAddWith(this, value); | 83 return defaultAddWith(this, value); |
77 } | 84 } |
78 | 85 |
86 double AnimatableValue::distance(const AnimatableValue* left, const AnimatableVa lue* right) | |
87 { | |
88 ASSERT(left); | |
89 ASSERT(right); | |
90 | |
91 if (left->isSameType(right)) | |
92 return left->distanceTo(right); | |
93 | |
94 return defaultDistance; | |
95 } | |
96 | |
97 double AnimatableValue::distanceTo(const AnimatableValue*) const | |
98 { | |
99 return defaultDistance; | |
100 } | |
101 | |
79 } // namespace WebCore | 102 } // namespace WebCore |
OLD | NEW |