| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/animation/animatable/AnimatableValueKeyframe.h" | 6 #include "core/animation/animatable/AnimatableValueKeyframe.h" |
| 7 | 7 |
| 8 #include "core/animation/LegacyStyleInterpolation.h" | 8 #include "core/animation/LegacyStyleInterpolation.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 AnimatableValueKeyframe::AnimatableValueKeyframe(const AnimatableValueKeyframe&
copyFrom) | 12 AnimatableValueKeyframe::AnimatableValueKeyframe(const AnimatableValueKeyframe&
copyFrom) |
| 13 : Keyframe(copyFrom.m_offset, copyFrom.m_composite, copyFrom.m_easing) | 13 : Keyframe(copyFrom.m_offset, copyFrom.m_composite, copyFrom.m_easing) |
| 14 { | 14 { |
| 15 for (PropertyValueMap::const_iterator iter = copyFrom.m_propertyValues.begin
(); iter != copyFrom.m_propertyValues.end(); ++iter) | 15 for (PropertyValueMap::const_iterator iter = copyFrom.m_propertyValues.begin
(); iter != copyFrom.m_propertyValues.end(); ++iter) |
| 16 setPropertyValue(iter->key, iter->value.get()); | 16 setPropertyValue(iter->key, iter->value.get()); |
| 17 } | 17 } |
| 18 | 18 |
| 19 PropertyHandleSet AnimatableValueKeyframe::properties() const | 19 PropertyHandleSet AnimatableValueKeyframe::properties() const |
| 20 { | 20 { |
| 21 // This is not used in time-critical code, so we probably don't need to | 21 // This is not used in time-critical code, so we probably don't need to |
| 22 // worry about caching this result. | 22 // worry about caching this result. |
| 23 PropertyHandleSet properties; | 23 PropertyHandleSet properties; |
| 24 for (PropertyValueMap::const_iterator iter = m_propertyValues.begin(); iter
!= m_propertyValues.end(); ++iter) | 24 for (PropertyValueMap::const_iterator iter = m_propertyValues.begin(); iter
!= m_propertyValues.end(); ++iter) |
| 25 properties.add(PropertyHandle(*iter.keys())); | 25 properties.add(PropertyHandle(*iter.keys())); |
| 26 return properties; | 26 return properties; |
| 27 } | 27 } |
| 28 | 28 |
| 29 PassRefPtrWillBeRawPtr<Keyframe> AnimatableValueKeyframe::clone() const | 29 PassRefPtr<Keyframe> AnimatableValueKeyframe::clone() const |
| 30 { | 30 { |
| 31 return adoptRefWillBeNoop(new AnimatableValueKeyframe(*this)); | 31 return adoptRef(new AnimatableValueKeyframe(*this)); |
| 32 } | 32 } |
| 33 | 33 |
| 34 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> AnimatableValueKeyfra
me::createPropertySpecificKeyframe(PropertyHandle property) const | 34 PassOwnPtr<Keyframe::PropertySpecificKeyframe> AnimatableValueKeyframe::createPr
opertySpecificKeyframe(PropertyHandle property) const |
| 35 { | 35 { |
| 36 return adoptPtrWillBeNoop(new PropertySpecificKeyframe(offset(), &easing(),
propertyValue(property.cssProperty()), composite())); | 36 return adoptPtr(new PropertySpecificKeyframe(offset(), &easing(), propertyVa
lue(property.cssProperty()), composite())); |
| 37 } | |
| 38 | |
| 39 DEFINE_TRACE(AnimatableValueKeyframe) | |
| 40 { | |
| 41 #if ENABLE(OILPAN) | |
| 42 visitor->trace(m_propertyValues); | |
| 43 #endif | |
| 44 Keyframe::trace(visitor); | |
| 45 } | 37 } |
| 46 | 38 |
| 47 AnimatableValueKeyframe::PropertySpecificKeyframe::PropertySpecificKeyframe(doub
le offset, PassRefPtr<TimingFunction> easing, const AnimatableValue* value, Effe
ctModel::CompositeOperation op) | 39 AnimatableValueKeyframe::PropertySpecificKeyframe::PropertySpecificKeyframe(doub
le offset, PassRefPtr<TimingFunction> easing, const AnimatableValue* value, Effe
ctModel::CompositeOperation op) |
| 48 : Keyframe::PropertySpecificKeyframe(offset, easing, op) | 40 : Keyframe::PropertySpecificKeyframe(offset, easing, op) |
| 49 , m_value(const_cast<AnimatableValue*>(value)) | 41 , m_value(const_cast<AnimatableValue*>(value)) |
| 50 { } | 42 { } |
| 51 | 43 |
| 52 AnimatableValueKeyframe::PropertySpecificKeyframe::PropertySpecificKeyframe(doub
le offset, PassRefPtr<TimingFunction> easing, PassRefPtrWillBeRawPtr<AnimatableV
alue> value) | 44 AnimatableValueKeyframe::PropertySpecificKeyframe::PropertySpecificKeyframe(doub
le offset, PassRefPtr<TimingFunction> easing, PassRefPtr<AnimatableValue> value) |
| 53 : Keyframe::PropertySpecificKeyframe(offset, easing, EffectModel::CompositeR
eplace) | 45 : Keyframe::PropertySpecificKeyframe(offset, easing, EffectModel::CompositeR
eplace) |
| 54 , m_value(value) | 46 , m_value(value) |
| 55 { | 47 { |
| 56 ASSERT(!isNull(m_offset)); | 48 ASSERT(!isNull(m_offset)); |
| 57 } | 49 } |
| 58 | 50 |
| 59 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> AnimatableValueKeyfra
me::PropertySpecificKeyframe::cloneWithOffset(double offset) const | 51 PassOwnPtr<Keyframe::PropertySpecificKeyframe> AnimatableValueKeyframe::Property
SpecificKeyframe::cloneWithOffset(double offset) const |
| 60 { | 52 { |
| 61 Keyframe::PropertySpecificKeyframe* theClone = new PropertySpecificKeyframe(
offset, m_easing, m_value); | 53 return adoptPtr(new PropertySpecificKeyframe(offset, m_easing, m_value)); |
| 62 return adoptPtrWillBeNoop(theClone); | |
| 63 } | 54 } |
| 64 | 55 |
| 65 PassRefPtrWillBeRawPtr<Interpolation> AnimatableValueKeyframe::PropertySpecificK
eyframe::maybeCreateInterpolation(PropertyHandle property, Keyframe::PropertySpe
cificKeyframe& end, Element*, const ComputedStyle*) const | 56 PassRefPtr<Interpolation> AnimatableValueKeyframe::PropertySpecificKeyframe::may
beCreateInterpolation(PropertyHandle property, Keyframe::PropertySpecificKeyfram
e& end, Element*, const ComputedStyle*) const |
| 66 { | 57 { |
| 67 AnimatableValuePropertySpecificKeyframe& to = toAnimatableValuePropertySpeci
ficKeyframe(end); | 58 AnimatableValuePropertySpecificKeyframe& to = toAnimatableValuePropertySpeci
ficKeyframe(end); |
| 68 return LegacyStyleInterpolation::create(value(), to.value(), property.cssPro
perty()); | 59 return LegacyStyleInterpolation::create(value(), to.value(), property.cssPro
perty()); |
| 69 } | 60 } |
| 70 | 61 |
| 71 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> AnimatableValueKeyfra
me::PropertySpecificKeyframe::neutralKeyframe(double offset, PassRefPtr<TimingFu
nction> easing) const | 62 PassOwnPtr<Keyframe::PropertySpecificKeyframe> AnimatableValueKeyframe::Property
SpecificKeyframe::neutralKeyframe(double offset, PassRefPtr<TimingFunction> easi
ng) const |
| 72 { | 63 { |
| 73 return adoptPtrWillBeNoop(new AnimatableValueKeyframe::PropertySpecificKeyfr
ame(offset, easing, AnimatableValue::neutralValue(), EffectModel::CompositeAdd))
; | 64 return adoptPtr(new AnimatableValueKeyframe::PropertySpecificKeyframe(offset
, easing, AnimatableValue::neutralValue(), EffectModel::CompositeAdd)); |
| 74 } | |
| 75 | |
| 76 DEFINE_TRACE(AnimatableValueKeyframe::PropertySpecificKeyframe) | |
| 77 { | |
| 78 visitor->trace(m_value); | |
| 79 Keyframe::PropertySpecificKeyframe::trace(visitor); | |
| 80 } | 65 } |
| 81 | 66 |
| 82 } | 67 } |
| OLD | NEW |