| 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 26 matching lines...) Expand all Loading... |
| 37 namespace { | 37 namespace { |
| 38 | 38 |
| 39 const double defaultDistance = 1; | 39 const double defaultDistance = 1; |
| 40 | 40 |
| 41 } // namespace | 41 } // namespace |
| 42 | 42 |
| 43 namespace WebCore { | 43 namespace WebCore { |
| 44 | 44 |
| 45 const AnimatableValue* AnimatableValue::neutralValue() | 45 const AnimatableValue* AnimatableValue::neutralValue() |
| 46 { | 46 { |
| 47 #if ENABLE_OILPAN |
| 48 DEFINE_STATIC_LOCAL(Persistent<AnimatableNeutral>, neutralSentinelValue, (An
imatableNeutral::create())); |
| 49 #else |
| 47 DEFINE_STATIC_REF(AnimatableNeutral, neutralSentinelValue, (AnimatableNeutra
l::create())); | 50 DEFINE_STATIC_REF(AnimatableNeutral, neutralSentinelValue, (AnimatableNeutra
l::create())); |
| 48 return neutralSentinelValue; | 51 #endif |
| 52 return neutralSentinelValue.get(); |
| 49 } | 53 } |
| 50 | 54 |
| 51 PassRefPtr<AnimatableValue> AnimatableValue::interpolate(const AnimatableValue*
left, const AnimatableValue* right, double fraction) | 55 PassRefPtrWillBeRawPtr<AnimatableValue> AnimatableValue::interpolate(const Anima
tableValue* left, const AnimatableValue* right, double fraction) |
| 52 { | 56 { |
| 53 ASSERT(left); | 57 ASSERT(left); |
| 54 ASSERT(right); | 58 ASSERT(right); |
| 55 ASSERT(!left->isNeutral()); | 59 ASSERT(!left->isNeutral()); |
| 56 ASSERT(!right->isNeutral()); | 60 ASSERT(!right->isNeutral()); |
| 57 | 61 |
| 58 if (fraction && fraction != 1 && left->isSameType(right)) | 62 if (fraction && fraction != 1 && left->isSameType(right)) |
| 59 return left->interpolateTo(right, fraction); | 63 return left->interpolateTo(right, fraction); |
| 60 | 64 |
| 61 return defaultInterpolateTo(left, right, fraction); | 65 return defaultInterpolateTo(left, right, fraction); |
| 62 } | 66 } |
| 63 | 67 |
| 64 PassRefPtr<AnimatableValue> AnimatableValue::add(const AnimatableValue* left, co
nst AnimatableValue* right) | 68 PassRefPtrWillBeRawPtr<AnimatableValue> AnimatableValue::add(const AnimatableVal
ue* left, const AnimatableValue* right) |
| 65 { | 69 { |
| 66 ASSERT(left); | 70 ASSERT(left); |
| 67 ASSERT(right); | 71 ASSERT(right); |
| 68 | 72 |
| 69 if (left->isNeutral()) | 73 if (left->isNeutral()) |
| 70 return takeConstRef(right); | 74 return takeConstRef(right); |
| 71 if (right->isNeutral()) | 75 if (right->isNeutral()) |
| 72 return takeConstRef(left); | 76 return takeConstRef(left); |
| 73 | 77 |
| 74 if (left->isSameType(right)) | 78 if (left->isSameType(right)) |
| 75 return left->addWith(right); | 79 return left->addWith(right); |
| 76 | 80 |
| 77 return defaultAddWith(left, right); | 81 return defaultAddWith(left, right); |
| 78 } | 82 } |
| 79 | 83 |
| 80 PassRefPtr<AnimatableValue> AnimatableValue::addWith(const AnimatableValue* valu
e) const | 84 PassRefPtrWillBeRawPtr<AnimatableValue> AnimatableValue::addWith(const Animatabl
eValue* value) const |
| 81 { | 85 { |
| 82 return defaultAddWith(this, value); | 86 return defaultAddWith(this, value); |
| 83 } | 87 } |
| 84 | 88 |
| 85 double AnimatableValue::distance(const AnimatableValue* left, const AnimatableVa
lue* right) | 89 double AnimatableValue::distance(const AnimatableValue* left, const AnimatableVa
lue* right) |
| 86 { | 90 { |
| 87 ASSERT(left); | 91 ASSERT(left); |
| 88 ASSERT(right); | 92 ASSERT(right); |
| 89 | 93 |
| 90 if (left->isSameType(right)) | 94 if (left->isSameType(right)) |
| 91 return left->distanceTo(right); | 95 return left->distanceTo(right); |
| 92 | 96 |
| 93 return defaultDistance; | 97 return defaultDistance; |
| 94 } | 98 } |
| 95 | 99 |
| 96 double AnimatableValue::distanceTo(const AnimatableValue*) const | 100 double AnimatableValue::distanceTo(const AnimatableValue*) const |
| 97 { | 101 { |
| 98 return defaultDistance; | 102 return defaultDistance; |
| 99 } | 103 } |
| 100 | 104 |
| 101 } // namespace WebCore | 105 } // namespace WebCore |
| OLD | NEW |