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