Chromium Code Reviews| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 AnimationEffect::CompositeOperation composite() const { return m_composite; } | 66 AnimationEffect::CompositeOperation composite() const { return m_composite; } |
| 67 void setEasing(PassRefPtr<TimingFunction>); | 67 void setEasing(PassRefPtr<TimingFunction>); |
| 68 TimingFunction* easing() const { return m_easing.get(); } | 68 TimingFunction* easing() const { return m_easing.get(); } |
| 69 void setPropertyValue(CSSPropertyID, const AnimatableValue*); | 69 void setPropertyValue(CSSPropertyID, const AnimatableValue*); |
| 70 void clearPropertyValue(CSSPropertyID); | 70 void clearPropertyValue(CSSPropertyID); |
| 71 const AnimatableValue* propertyValue(CSSPropertyID) const; | 71 const AnimatableValue* propertyValue(CSSPropertyID) const; |
| 72 PropertySet properties() const; | 72 PropertySet properties() const; |
| 73 PassRefPtrWillBeRawPtr<Keyframe> clone() const { return adoptRefWillBeNoop(n ew Keyframe(*this)); } | 73 PassRefPtrWillBeRawPtr<Keyframe> clone() const { return adoptRefWillBeNoop(n ew Keyframe(*this)); } |
| 74 PassRefPtrWillBeRawPtr<Keyframe> cloneWithOffset(double offset) const; | 74 PassRefPtrWillBeRawPtr<Keyframe> cloneWithOffset(double offset) const; |
| 75 | 75 |
| 76 void trace(Visitor*) { } | 76 void trace(Visitor*); |
| 77 | |
| 77 private: | 78 private: |
| 78 Keyframe(); | 79 Keyframe(); |
| 79 Keyframe(const Keyframe&); | 80 Keyframe(const Keyframe&); |
| 80 double m_offset; | 81 double m_offset; |
| 81 AnimationEffect::CompositeOperation m_composite; | 82 AnimationEffect::CompositeOperation m_composite; |
| 82 RefPtr<TimingFunction> m_easing; | 83 RefPtr<TimingFunction> m_easing; |
| 83 typedef HashMap<CSSPropertyID, RefPtr<AnimatableValue> > PropertyValueMap; | 84 typedef WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<AnimatableValue> > PropertyValueMap; |
| 84 PropertyValueMap m_propertyValues; | 85 PropertyValueMap m_propertyValues; |
| 85 }; | 86 }; |
| 86 | 87 |
| 87 class KeyframeEffectModel FINAL : public AnimationEffect { | 88 class KeyframeEffectModel FINAL : public AnimationEffect { |
| 88 public: | 89 public: |
| 89 class PropertySpecificKeyframe; | 90 class PropertySpecificKeyframe; |
| 90 typedef WillBeHeapVector<RefPtrWillBeMember<Keyframe> > KeyframeVector; | 91 typedef WillBeHeapVector<RefPtrWillBeMember<Keyframe> > KeyframeVector; |
| 91 typedef Vector<OwnPtr<PropertySpecificKeyframe> > PropertySpecificKeyframeVe ctor; | 92 typedef WillBeHeapVector<OwnPtrWillBeMember<PropertySpecificKeyframe> > Prop ertySpecificKeyframeVector; |
| 92 // FIXME: Implement accumulation. | 93 // FIXME: Implement accumulation. |
| 93 static PassRefPtrWillBeRawPtr<KeyframeEffectModel> create(const KeyframeVect or& keyframes) | 94 static PassRefPtrWillBeRawPtr<KeyframeEffectModel> create(const KeyframeVect or& keyframes) |
| 94 { | 95 { |
| 95 return adoptRefWillBeNoop(new KeyframeEffectModel(keyframes)); | 96 return adoptRefWillBeNoop(new KeyframeEffectModel(keyframes)); |
| 96 } | 97 } |
| 97 | 98 |
| 98 virtual bool affects(CSSPropertyID property) OVERRIDE | 99 virtual bool affects(CSSPropertyID property) OVERRIDE |
| 99 { | 100 { |
| 100 ensureKeyframeGroups(); | 101 ensureKeyframeGroups(); |
| 101 return m_keyframeGroups->contains(property); | 102 return m_keyframeGroups->contains(property); |
| 102 } | 103 } |
| 103 | 104 |
| 104 // AnimationEffect implementation. | 105 // AnimationEffect implementation. |
| 105 virtual PassOwnPtr<Vector<RefPtr<Interpolation> > > sample(int iteration, do uble fraction) const OVERRIDE; | 106 virtual PassOwnPtr<Vector<RefPtr<Interpolation> > > sample(int iteration, do uble fraction) const OVERRIDE; |
| 106 | 107 |
| 107 // FIXME: Implement setFrames() | 108 // FIXME: Implement setFrames() |
| 108 const KeyframeVector& getFrames() const { return m_keyframes; } | 109 const KeyframeVector& getFrames() const { return m_keyframes; } |
| 109 | 110 |
| 110 virtual bool isKeyframeEffectModel() const OVERRIDE { return true; } | 111 virtual bool isKeyframeEffectModel() const OVERRIDE { return true; } |
| 111 | 112 |
| 112 bool isReplaceOnly(); | 113 bool isReplaceOnly(); |
| 113 | 114 |
| 114 PropertySet properties() const; | 115 PropertySet properties() const; |
| 115 | 116 |
| 116 class PropertySpecificKeyframe { | 117 class PropertySpecificKeyframe : public NoBaseWillBeGarbageCollected<Propert ySpecificKeyframe> { |
| 117 public: | 118 public: |
| 118 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin g, const AnimatableValue*, CompositeOperation); | 119 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin g, const AnimatableValue*, CompositeOperation); |
| 119 double offset() const { return m_offset; } | 120 double offset() const { return m_offset; } |
| 120 TimingFunction* easing() const { return m_easing.get(); } | 121 TimingFunction* easing() const { return m_easing.get(); } |
| 121 const AnimatableValue* value() const { return m_value.get(); } | 122 const AnimatableValue* value() const { return m_value.get(); } |
| 122 AnimationEffect::CompositeOperation composite() const { return m_composi te; } | 123 AnimationEffect::CompositeOperation composite() const { return m_composi te; } |
| 123 PassOwnPtr<PropertySpecificKeyframe> cloneWithOffset(double offset) cons t; | 124 PassOwnPtrWillBeRawPtr<PropertySpecificKeyframe> cloneWithOffset(double offset) const; |
| 125 | |
| 126 void trace(Visitor* visitor) | |
| 127 { | |
| 128 visitor->trace(m_value); | |
| 129 } | |
| 130 | |
| 124 private: | 131 private: |
| 125 // Used by cloneWithOffset(). | 132 // Used by cloneWithOffset(). |
| 126 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin g, PassRefPtr<AnimatableValue>, CompositeOperation); | 133 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin g, PassRefPtrWillBeRawPtr<AnimatableValue>, CompositeOperation); |
| 127 double m_offset; | 134 double m_offset; |
| 128 RefPtr<TimingFunction> m_easing; | 135 RefPtr<TimingFunction> m_easing; |
| 129 RefPtr<AnimatableValue> m_value; | 136 RefPtrWillBeMember<AnimatableValue> m_value; |
| 130 AnimationEffect::CompositeOperation m_composite; | 137 AnimationEffect::CompositeOperation m_composite; |
| 131 }; | 138 }; |
| 132 | 139 |
| 133 class PropertySpecificKeyframeGroup { | 140 class PropertySpecificKeyframeGroup { |
| 134 public: | 141 public: |
| 135 void appendKeyframe(PassOwnPtr<PropertySpecificKeyframe>); | 142 void appendKeyframe(PassOwnPtrWillBeRawPtr<PropertySpecificKeyframe>); |
| 136 const PropertySpecificKeyframeVector& keyframes() const { return m_keyfr ames; } | 143 const PropertySpecificKeyframeVector& keyframes() const { return m_keyfr ames; } |
| 137 private: | 144 private: |
| 138 PropertySpecificKeyframeVector m_keyframes; | 145 PropertySpecificKeyframeVector m_keyframes; |
|
Mads Ager (chromium)
2014/03/21 14:08:06
OK, now it bubbles down here. You have a part obje
| |
| 139 void removeRedundantKeyframes(); | 146 void removeRedundantKeyframes(); |
| 140 void addSyntheticKeyframeIfRequired(); | 147 void addSyntheticKeyframeIfRequired(); |
| 141 | 148 |
| 142 friend class KeyframeEffectModel; | 149 friend class KeyframeEffectModel; |
| 143 }; | 150 }; |
| 144 | 151 |
| 145 const PropertySpecificKeyframeVector& getPropertySpecificKeyframes(CSSProper tyID id) const | 152 const PropertySpecificKeyframeVector& getPropertySpecificKeyframes(CSSProper tyID id) const |
| 146 { | 153 { |
| 147 ensureKeyframeGroups(); | 154 ensureKeyframeGroups(); |
| 148 return m_keyframeGroups->get(id)->keyframes(); | 155 return m_keyframeGroups->get(id)->keyframes(); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 169 mutable RefPtr<InterpolationEffect> m_interpolationEffect; | 176 mutable RefPtr<InterpolationEffect> m_interpolationEffect; |
| 170 | 177 |
| 171 friend class KeyframeEffectModelTest; | 178 friend class KeyframeEffectModelTest; |
| 172 }; | 179 }; |
| 173 | 180 |
| 174 DEFINE_TYPE_CASTS(KeyframeEffectModel, AnimationEffect, value, value->isKeyframe EffectModel(), value.isKeyframeEffectModel()); | 181 DEFINE_TYPE_CASTS(KeyframeEffectModel, AnimationEffect, value, value->isKeyframe EffectModel(), value.isKeyframeEffectModel()); |
| 175 | 182 |
| 176 } // namespace WebCore | 183 } // namespace WebCore |
| 177 | 184 |
| 178 #endif // KeyframeEffectModel_h | 185 #endif // KeyframeEffectModel_h |
| OLD | NEW |