| 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 #include "core/animation/InterpolationEffect.h" | 37 #include "core/animation/InterpolationEffect.h" |
| 38 #include "core/animation/PropertyHandle.h" | 38 #include "core/animation/PropertyHandle.h" |
| 39 #include "core/animation/StringKeyframe.h" | 39 #include "core/animation/StringKeyframe.h" |
| 40 #include "core/animation/animatable/AnimatableValueKeyframe.h" | 40 #include "core/animation/animatable/AnimatableValueKeyframe.h" |
| 41 #include "platform/animation/TimingFunction.h" | 41 #include "platform/animation/TimingFunction.h" |
| 42 #include "platform/heap/Handle.h" | 42 #include "platform/heap/Handle.h" |
| 43 #include "wtf/HashMap.h" | 43 #include "wtf/HashMap.h" |
| 44 #include "wtf/HashSet.h" | 44 #include "wtf/HashSet.h" |
| 45 #include "wtf/PassRefPtr.h" | 45 #include "wtf/PassRefPtr.h" |
| 46 #include "wtf/Vector.h" | 46 #include "wtf/Vector.h" |
| 47 #include <memory> | |
| 48 | 47 |
| 49 namespace blink { | 48 namespace blink { |
| 50 | 49 |
| 51 class Element; | 50 class Element; |
| 52 class KeyframeEffectModelTest; | 51 class KeyframeEffectModelTest; |
| 53 | 52 |
| 54 class CORE_EXPORT KeyframeEffectModelBase : public EffectModel { | 53 class CORE_EXPORT KeyframeEffectModelBase : public EffectModel { |
| 55 public: | 54 public: |
| 56 // FIXME: Implement accumulation. | 55 // FIXME: Implement accumulation. |
| 57 | 56 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 77 using KeyframeVector = Vector<RefPtr<Keyframe>>; | 76 using KeyframeVector = Vector<RefPtr<Keyframe>>; |
| 78 const KeyframeVector& getFrames() const { return m_keyframes; } | 77 const KeyframeVector& getFrames() const { return m_keyframes; } |
| 79 void setFrames(KeyframeVector& keyframes); | 78 void setFrames(KeyframeVector& keyframes); |
| 80 | 79 |
| 81 const PropertySpecificKeyframeVector& getPropertySpecificKeyframes(PropertyH
andle property) const | 80 const PropertySpecificKeyframeVector& getPropertySpecificKeyframes(PropertyH
andle property) const |
| 82 { | 81 { |
| 83 ensureKeyframeGroups(); | 82 ensureKeyframeGroups(); |
| 84 return m_keyframeGroups->get(property)->keyframes(); | 83 return m_keyframeGroups->get(property)->keyframes(); |
| 85 } | 84 } |
| 86 | 85 |
| 87 using KeyframeGroupMap = HashMap<PropertyHandle, std::unique_ptr<PropertySpe
cificKeyframeGroup>>; | 86 using KeyframeGroupMap = HashMap<PropertyHandle, OwnPtr<PropertySpecificKeyf
rameGroup>>; |
| 88 const KeyframeGroupMap& getPropertySpecificKeyframeGroups() const | 87 const KeyframeGroupMap& getPropertySpecificKeyframeGroups() const |
| 89 { | 88 { |
| 90 ensureKeyframeGroups(); | 89 ensureKeyframeGroups(); |
| 91 return *m_keyframeGroups; | 90 return *m_keyframeGroups; |
| 92 } | 91 } |
| 93 | 92 |
| 94 // EffectModel implementation. | 93 // EffectModel implementation. |
| 95 bool sample(int iteration, double fraction, double iterationDuration, Vector
<RefPtr<Interpolation>>&) const override; | 94 bool sample(int iteration, double fraction, double iterationDuration, Vector
<RefPtr<Interpolation>>&) const override; |
| 96 | 95 |
| 97 bool isKeyframeEffectModel() const override { return true; } | 96 bool isKeyframeEffectModel() const override { return true; } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 static KeyframeVector normalizedKeyframes(const KeyframeVector& keyframes); | 133 static KeyframeVector normalizedKeyframes(const KeyframeVector& keyframes); |
| 135 | 134 |
| 136 // Lazily computes the groups of property-specific keyframes. | 135 // Lazily computes the groups of property-specific keyframes. |
| 137 void ensureKeyframeGroups() const; | 136 void ensureKeyframeGroups() const; |
| 138 void ensureInterpolationEffectPopulated() const; | 137 void ensureInterpolationEffectPopulated() const; |
| 139 | 138 |
| 140 KeyframeVector m_keyframes; | 139 KeyframeVector m_keyframes; |
| 141 // The spec describes filtering the normalized keyframes at sampling time | 140 // The spec describes filtering the normalized keyframes at sampling time |
| 142 // to get the 'property-specific keyframes'. For efficiency, we cache the | 141 // to get the 'property-specific keyframes'. For efficiency, we cache the |
| 143 // property-specific lists. | 142 // property-specific lists. |
| 144 mutable std::unique_ptr<KeyframeGroupMap> m_keyframeGroups; | 143 mutable OwnPtr<KeyframeGroupMap> m_keyframeGroups; |
| 145 mutable InterpolationEffect m_interpolationEffect; | 144 mutable InterpolationEffect m_interpolationEffect; |
| 146 mutable int m_lastIteration; | 145 mutable int m_lastIteration; |
| 147 mutable double m_lastFraction; | 146 mutable double m_lastFraction; |
| 148 mutable double m_lastIterationDuration; | 147 mutable double m_lastIterationDuration; |
| 149 RefPtr<TimingFunction> m_defaultKeyframeEasing; | 148 RefPtr<TimingFunction> m_defaultKeyframeEasing; |
| 150 | 149 |
| 151 mutable bool m_hasSyntheticKeyframes; | 150 mutable bool m_hasSyntheticKeyframes; |
| 152 | 151 |
| 153 friend class KeyframeEffectModelTest; | 152 friend class KeyframeEffectModelTest; |
| 154 }; | 153 }; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 210 |
| 212 template <> | 211 template <> |
| 213 inline bool KeyframeEffectModel<AnimatableValueKeyframe>::isAnimatableValueKeyfr
ameEffectModel() const { return true; } | 212 inline bool KeyframeEffectModel<AnimatableValueKeyframe>::isAnimatableValueKeyfr
ameEffectModel() const { return true; } |
| 214 | 213 |
| 215 template <> | 214 template <> |
| 216 inline bool KeyframeEffectModel<StringKeyframe>::isStringKeyframeEffectModel() c
onst { return true; } | 215 inline bool KeyframeEffectModel<StringKeyframe>::isStringKeyframeEffectModel() c
onst { return true; } |
| 217 | 216 |
| 218 } // namespace blink | 217 } // namespace blink |
| 219 | 218 |
| 220 #endif // KeyframeEffectModel_h | 219 #endif // KeyframeEffectModel_h |
| OLD | NEW |