| 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 void snapshotCompositableProperties(const Element*, const RenderStyle&); |
| 114 bool snapshotCompositablePropertiesIfNeeded(const Element*, const RenderStyl
e&, const RenderStyle&); |
| 115 |
| 112 static KeyframeVector normalizedKeyframesForInspector(const KeyframeVector&
keyframes) { return normalizedKeyframes(keyframes); } | 116 static KeyframeVector normalizedKeyframesForInspector(const KeyframeVector&
keyframes) { return normalizedKeyframes(keyframes); } |
| 113 | 117 |
| 114 protected: | 118 protected: |
| 115 static KeyframeVector normalizedKeyframes(const KeyframeVector& keyframes); | 119 static KeyframeVector normalizedKeyframes(const KeyframeVector& keyframes); |
| 116 | 120 |
| 117 // Lazily computes the groups of property-specific keyframes. | 121 // Lazily computes the groups of property-specific keyframes. |
| 118 void ensureKeyframeGroups() const; | 122 void ensureKeyframeGroups() const; |
| 119 void ensureInterpolationEffect(Element* = nullptr) const; | 123 void ensureInterpolationEffect(Element* = nullptr) const; |
| 120 | 124 |
| 121 KeyframeVector m_keyframes; | 125 KeyframeVector m_keyframes; |
| 122 // The spec describes filtering the normalized keyframes at sampling time | 126 // The spec describes filtering the normalized keyframes at sampling time |
| 123 // to get the 'property-specific keyframes'. For efficiency, we cache the | 127 // to get the 'property-specific keyframes'. For efficiency, we cache the |
| 124 // property-specific lists. | 128 // property-specific lists. |
| 125 using KeyframeGroupMap = WillBeHeapHashMap<CSSPropertyID, OwnPtrWillBeMember
<PropertySpecificKeyframeGroup>>; | 129 using KeyframeGroupMap = WillBeHeapHashMap<CSSPropertyID, OwnPtrWillBeMember
<PropertySpecificKeyframeGroup>>; |
| 126 mutable OwnPtrWillBeMember<KeyframeGroupMap> m_keyframeGroups; | 130 mutable OwnPtrWillBeMember<KeyframeGroupMap> m_keyframeGroups; |
| 127 mutable RefPtrWillBeMember<InterpolationEffect> m_interpolationEffect; | 131 mutable RefPtrWillBeMember<InterpolationEffect> m_interpolationEffect; |
| 128 | 132 |
| 129 mutable bool m_hasSyntheticKeyframes; | 133 mutable bool m_hasSyntheticKeyframes; |
| 130 | 134 |
| 131 friend class KeyframeEffectModelTest; | 135 friend class KeyframeEffectModelTest; |
| 132 | 136 |
| 133 bool affects(CSSPropertyID property) | 137 bool affects(CSSPropertyID property) |
| 134 { | 138 { |
| 135 ensureKeyframeGroups(); | 139 ensureKeyframeGroups(); |
| 136 return m_keyframeGroups->contains(property); | 140 return m_keyframeGroups->contains(property); |
| 137 } | 141 } |
| 142 |
| 143 void snapshotCompositableProperty(CSSPropertyID, const Element*, const Rende
rStyle&); |
| 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>>; |
| 144 static PassRefPtrWillBeRawPtr<KeyframeEffectModel<Keyframe>> create(const Ke
yframeVector& keyframes) { return adoptRefWillBeNoop(new KeyframeEffectModel(key
frames)); } | 150 static PassRefPtrWillBeRawPtr<KeyframeEffectModel<Keyframe>> create(const Ke
yframeVector& keyframes) { return adoptRefWillBeNoop(new KeyframeEffectModel(key
frames)); } |
| 145 | 151 |
| 146 private: | 152 private: |
| 147 KeyframeEffectModel(const KeyframeVector& keyframes) | 153 KeyframeEffectModel(const KeyframeVector& keyframes) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 171 inline const AnimatableValueKeyframeEffectModel* toAnimatableValueKeyframeEffect
Model(const AnimationEffect* base) | 177 inline const AnimatableValueKeyframeEffectModel* toAnimatableValueKeyframeEffect
Model(const AnimationEffect* base) |
| 172 { | 178 { |
| 173 return toAnimatableValueKeyframeEffectModel(toKeyframeEffectModelBase(base))
; | 179 return toAnimatableValueKeyframeEffectModel(toKeyframeEffectModelBase(base))
; |
| 174 } | 180 } |
| 175 | 181 |
| 176 inline AnimatableValueKeyframeEffectModel* toAnimatableValueKeyframeEffectModel(
AnimationEffect* base) | 182 inline AnimatableValueKeyframeEffectModel* toAnimatableValueKeyframeEffectModel(
AnimationEffect* base) |
| 177 { | 183 { |
| 178 return toAnimatableValueKeyframeEffectModel(toKeyframeEffectModelBase(base))
; | 184 return toAnimatableValueKeyframeEffectModel(toKeyframeEffectModelBase(base))
; |
| 179 } | 185 } |
| 180 | 186 |
| 187 inline const StringKeyframeEffectModel* toStringKeyframeEffectModel(const Animat
ionEffect* base) |
| 188 { |
| 189 return toStringKeyframeEffectModel(toKeyframeEffectModelBase(base)); |
| 190 } |
| 191 |
| 192 inline StringKeyframeEffectModel* toStringKeyframeEffectModel(AnimationEffect* b
ase) |
| 193 { |
| 194 return toStringKeyframeEffectModel(toKeyframeEffectModelBase(base)); |
| 195 } |
| 196 |
| 181 template <> | 197 template <> |
| 182 inline bool KeyframeEffectModel<AnimatableValueKeyframe>::isAnimatableValueKeyfr
ameEffectModel() const { return true; } | 198 inline bool KeyframeEffectModel<AnimatableValueKeyframe>::isAnimatableValueKeyfr
ameEffectModel() const { return true; } |
| 183 | 199 |
| 184 template <> | 200 template <> |
| 185 inline bool KeyframeEffectModel<StringKeyframe>::isStringKeyframeEffectModel() c
onst { return true; } | 201 inline bool KeyframeEffectModel<StringKeyframe>::isStringKeyframeEffectModel() c
onst { return true; } |
| 186 | 202 |
| 187 } // namespace blink | 203 } // namespace blink |
| 188 | 204 |
| 189 #endif // KeyframeEffectModel_h | 205 #endif // KeyframeEffectModel_h |
| OLD | NEW |