| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 virtual void trace(Visitor*) override; | 102 virtual void trace(Visitor*) override; |
| 103 | 103 |
| 104 // FIXME: This is a hack used to resolve CSSValues to AnimatableValues while
we have a valid handle on an element. | 104 // FIXME: This is a hack used to resolve CSSValues to AnimatableValues while
we have a valid handle on an element. |
| 105 // This should be removed once StringKeyframes no longer uses InterpolableAn
imatableValues. | 105 // This should be removed once StringKeyframes no longer uses InterpolableAn
imatableValues. |
| 106 void forceConversionsToAnimatableValues(Element* element) | 106 void forceConversionsToAnimatableValues(Element* element) |
| 107 { | 107 { |
| 108 ensureKeyframeGroups(); | 108 ensureKeyframeGroups(); |
| 109 ensureInterpolationEffect(element); | 109 ensureInterpolationEffect(element); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void setDeferredInterpolationsOutdated() { m_interpolationEffect->setDeferre
dInterpolationsOutdated(); } |
| 113 |
| 114 void snapshotCompositableProperties(const Element*, const RenderStyle&); |
| 115 void updateNeutralKeyframeAnimatableValues(CSSPropertyID, PassRefPtrWillBeRa
wPtr<AnimatableValue>); |
| 116 void setNeutralKeyframeEasings(RefPtrWillBeRawPtr<TimingFunction>); |
| 117 |
| 112 static KeyframeVector normalizedKeyframesForInspector(const KeyframeVector&
keyframes) { return normalizedKeyframes(keyframes); } | 118 static KeyframeVector normalizedKeyframesForInspector(const KeyframeVector&
keyframes) { return normalizedKeyframes(keyframes); } |
| 113 | 119 |
| 114 protected: | 120 protected: |
| 115 static KeyframeVector normalizedKeyframes(const KeyframeVector& keyframes); | 121 static KeyframeVector normalizedKeyframes(const KeyframeVector& keyframes); |
| 116 | 122 |
| 117 // Lazily computes the groups of property-specific keyframes. | 123 // Lazily computes the groups of property-specific keyframes. |
| 118 void ensureKeyframeGroups() const; | 124 void ensureKeyframeGroups() const; |
| 119 void ensureInterpolationEffect(Element* = nullptr) const; | 125 void ensureInterpolationEffect(Element* = nullptr) const; |
| 120 | 126 |
| 121 KeyframeVector m_keyframes; | 127 KeyframeVector m_keyframes; |
| 122 // The spec describes filtering the normalized keyframes at sampling time | 128 // The spec describes filtering the normalized keyframes at sampling time |
| 123 // to get the 'property-specific keyframes'. For efficiency, we cache the | 129 // to get the 'property-specific keyframes'. For efficiency, we cache the |
| 124 // property-specific lists. | 130 // property-specific lists. |
| 125 using KeyframeGroupMap = WillBeHeapHashMap<CSSPropertyID, OwnPtrWillBeMember
<PropertySpecificKeyframeGroup>>; | 131 using KeyframeGroupMap = WillBeHeapHashMap<CSSPropertyID, OwnPtrWillBeMember
<PropertySpecificKeyframeGroup>>; |
| 126 mutable OwnPtrWillBeMember<KeyframeGroupMap> m_keyframeGroups; | 132 mutable OwnPtrWillBeMember<KeyframeGroupMap> m_keyframeGroups; |
| 127 mutable RefPtrWillBeMember<InterpolationEffect> m_interpolationEffect; | 133 mutable RefPtrWillBeMember<InterpolationEffect> m_interpolationEffect; |
| 128 | 134 |
| 129 mutable bool m_hasSyntheticKeyframes; | 135 mutable bool m_hasSyntheticKeyframes; |
| 130 | 136 |
| 131 friend class KeyframeEffectModelTest; | 137 friend class KeyframeEffectModelTest; |
| 132 | 138 |
| 133 bool affects(CSSPropertyID property) | 139 bool affects(CSSPropertyID property) const |
| 134 { | 140 { |
| 135 ensureKeyframeGroups(); | 141 ensureKeyframeGroups(); |
| 136 return m_keyframeGroups->contains(property); | 142 return m_keyframeGroups->contains(property); |
| 137 } | 143 } |
| 138 }; | 144 }; |
| 139 | 145 |
| 140 template <class Keyframe> | 146 template <class Keyframe> |
| 141 class KeyframeEffectModel final : public KeyframeEffectModelBase { | 147 class KeyframeEffectModel final : public KeyframeEffectModelBase { |
| 142 public: | 148 public: |
| 143 using KeyframeVector = WillBeHeapVector<RefPtrWillBeMember<Keyframe>>; | 149 using KeyframeVector = WillBeHeapVector<RefPtrWillBeMember<Keyframe>>; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 160 using AnimatableValueKeyframeEffectModel = KeyframeEffectModel<AnimatableValueKe
yframe>; | 166 using AnimatableValueKeyframeEffectModel = KeyframeEffectModel<AnimatableValueKe
yframe>; |
| 161 using AnimatableValueKeyframeVector = AnimatableValueKeyframeEffectModel::Keyfra
meVector; | 167 using AnimatableValueKeyframeVector = AnimatableValueKeyframeEffectModel::Keyfra
meVector; |
| 162 using AnimatableValuePropertySpecificKeyframeVector = AnimatableValueKeyframeEff
ectModel::PropertySpecificKeyframeVector; | 168 using AnimatableValuePropertySpecificKeyframeVector = AnimatableValueKeyframeEff
ectModel::PropertySpecificKeyframeVector; |
| 163 | 169 |
| 164 using StringKeyframeEffectModel = KeyframeEffectModel<StringKeyframe>; | 170 using StringKeyframeEffectModel = KeyframeEffectModel<StringKeyframe>; |
| 165 using StringKeyframeVector = StringKeyframeEffectModel::KeyframeVector; | 171 using StringKeyframeVector = StringKeyframeEffectModel::KeyframeVector; |
| 166 using StringPropertySpecificKeyframeVector = StringKeyframeEffectModel::Property
SpecificKeyframeVector; | 172 using StringPropertySpecificKeyframeVector = StringKeyframeEffectModel::Property
SpecificKeyframeVector; |
| 167 | 173 |
| 168 DEFINE_TYPE_CASTS(KeyframeEffectModelBase, AnimationEffect, value, value->isKeyf
rameEffectModel(), value.isKeyframeEffectModel()); | 174 DEFINE_TYPE_CASTS(KeyframeEffectModelBase, AnimationEffect, value, value->isKeyf
rameEffectModel(), value.isKeyframeEffectModel()); |
| 169 DEFINE_TYPE_CASTS(AnimatableValueKeyframeEffectModel, KeyframeEffectModelBase, v
alue, value->isAnimatableValueKeyframeEffectModel(), value.isAnimatableValueKeyf
rameEffectModel()); | 175 DEFINE_TYPE_CASTS(AnimatableValueKeyframeEffectModel, KeyframeEffectModelBase, v
alue, value->isAnimatableValueKeyframeEffectModel(), value.isAnimatableValueKeyf
rameEffectModel()); |
| 176 DEFINE_TYPE_CASTS(StringKeyframeEffectModel, KeyframeEffectModelBase, value, val
ue->isStringKeyframeEffectModel(), value.isStringKeyframeEffectModel()); |
| 170 | 177 |
| 171 inline const AnimatableValueKeyframeEffectModel* toAnimatableValueKeyframeEffect
Model(const AnimationEffect* base) | 178 inline const AnimatableValueKeyframeEffectModel* toAnimatableValueKeyframeEffect
Model(const AnimationEffect* base) |
| 172 { | 179 { |
| 173 return toAnimatableValueKeyframeEffectModel(toKeyframeEffectModelBase(base))
; | 180 return toAnimatableValueKeyframeEffectModel(toKeyframeEffectModelBase(base))
; |
| 174 } | 181 } |
| 175 | 182 |
| 176 inline AnimatableValueKeyframeEffectModel* toAnimatableValueKeyframeEffectModel(
AnimationEffect* base) | 183 inline AnimatableValueKeyframeEffectModel* toAnimatableValueKeyframeEffectModel(
AnimationEffect* base) |
| 177 { | 184 { |
| 178 return toAnimatableValueKeyframeEffectModel(toKeyframeEffectModelBase(base))
; | 185 return toAnimatableValueKeyframeEffectModel(toKeyframeEffectModelBase(base))
; |
| 179 } | 186 } |
| 180 | 187 |
| 188 inline const StringKeyframeEffectModel* toStringKeyframeEffectModel(const Animat
ionEffect* base) |
| 189 { |
| 190 return toStringKeyframeEffectModel(toKeyframeEffectModelBase(base)); |
| 191 } |
| 192 |
| 193 inline StringKeyframeEffectModel* toStringKeyframeEffectModel(AnimationEffect* b
ase) |
| 194 { |
| 195 return toStringKeyframeEffectModel(toKeyframeEffectModelBase(base)); |
| 196 } |
| 197 |
| 181 template <> | 198 template <> |
| 182 inline bool KeyframeEffectModel<AnimatableValueKeyframe>::isAnimatableValueKeyfr
ameEffectModel() const { return true; } | 199 inline bool KeyframeEffectModel<AnimatableValueKeyframe>::isAnimatableValueKeyfr
ameEffectModel() const { return true; } |
| 183 | 200 |
| 184 template <> | 201 template <> |
| 185 inline bool KeyframeEffectModel<StringKeyframe>::isStringKeyframeEffectModel() c
onst { return true; } | 202 inline bool KeyframeEffectModel<StringKeyframe>::isStringKeyframeEffectModel() c
onst { return true; } |
| 186 | 203 |
| 187 } // namespace blink | 204 } // namespace blink |
| 188 | 205 |
| 189 #endif // KeyframeEffectModel_h | 206 #endif // KeyframeEffectModel_h |
| OLD | NEW |