| 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 22 matching lines...) Expand all Loading... |
| 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 |
| 74 PassRefPtr<AnimatableValue> AnimatableValue::addWith(const AnimatableValue* valu
e) const | 80 PassRefPtr<AnimatableValue> AnimatableValue::addWith(const AnimatableValue* valu
e) const |
| 75 { | 81 { |
| 76 return defaultAddWith(this, value); | 82 return defaultAddWith(this, value); |
| 77 } | 83 } |
| 78 | 84 |
| 85 double AnimatableValue::distance(const AnimatableValue* left, const AnimatableVa
lue* right) |
| 86 { |
| 87 ASSERT(left); |
| 88 ASSERT(right); |
| 89 |
| 90 if (left->isSameType(right)) |
| 91 return left->distanceTo(right); |
| 92 |
| 93 return defaultDistance; |
| 94 } |
| 95 |
| 96 double AnimatableValue::distanceTo(const AnimatableValue*) const |
| 97 { |
| 98 return defaultDistance; |
| 99 } |
| 100 |
| 79 } // namespace WebCore | 101 } // namespace WebCore |
| OLD | NEW |