Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: Source/core/animation/KeyframeEffectModel.h

Issue 194733002: Web Animations: Use StringKeyframes for element.animate() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: More comments Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/animation/Keyframe.h ('k') | Source/core/animation/KeyframeEffectModel.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 29 matching lines...) Expand all
40 #include "platform/animation/TimingFunction.h" 40 #include "platform/animation/TimingFunction.h"
41 #include "wtf/HashMap.h" 41 #include "wtf/HashMap.h"
42 #include "wtf/HashSet.h" 42 #include "wtf/HashSet.h"
43 #include "wtf/PassOwnPtr.h" 43 #include "wtf/PassOwnPtr.h"
44 #include "wtf/PassRefPtr.h" 44 #include "wtf/PassRefPtr.h"
45 #include "wtf/RefCounted.h" 45 #include "wtf/RefCounted.h"
46 #include "wtf/Vector.h" 46 #include "wtf/Vector.h"
47 47
48 namespace WebCore { 48 namespace WebCore {
49 49
50 class Element;
50 class KeyframeEffectModelTest; 51 class KeyframeEffectModelTest;
51 52
52 class KeyframeEffectModelBase : public AnimationEffect { 53 class KeyframeEffectModelBase : public AnimationEffect {
53 public: 54 public:
54 // FIXME: Implement accumulation. 55 // FIXME: Implement accumulation.
55 56
56 typedef WillBeHeapVector<OwnPtrWillBeMember<Keyframe::PropertySpecificKeyfra me> > PropertySpecificKeyframeVector; 57 typedef WillBeHeapVector<OwnPtrWillBeMember<Keyframe::PropertySpecificKeyfra me> > PropertySpecificKeyframeVector;
57 class PropertySpecificKeyframeGroup : public NoBaseWillBeGarbageCollected<Pr opertySpecificKeyframeGroup> { 58 class PropertySpecificKeyframeGroup : public NoBaseWillBeGarbageCollected<Pr opertySpecificKeyframeGroup> {
58 public: 59 public:
59 void appendKeyframe(PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKey frame>); 60 void appendKeyframe(PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKey frame>);
(...skipping 27 matching lines...) Expand all
87 // AnimationEffect implementation. 88 // AnimationEffect implementation.
88 virtual PassOwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpola tion> > > sample(int iteration, double fraction, double iterationDuration) const OVERRIDE; 89 virtual PassOwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpola tion> > > sample(int iteration, double fraction, double iterationDuration) const OVERRIDE;
89 90
90 virtual bool isKeyframeEffectModel() const OVERRIDE { return true; } 91 virtual bool isKeyframeEffectModel() const OVERRIDE { return true; }
91 92
92 virtual bool isAnimatableValueKeyframeEffectModel() const { return false; } 93 virtual bool isAnimatableValueKeyframeEffectModel() const { return false; }
93 virtual bool isStringKeyframeEffectModel() const { return false; } 94 virtual bool isStringKeyframeEffectModel() const { return false; }
94 95
95 virtual void trace(Visitor*) OVERRIDE; 96 virtual void trace(Visitor*) OVERRIDE;
96 97
98 // FIXME: This is a hack used to resolve CSSValues to AnimatableValues while we have a valid handle on an element.
99 // This should be removed once StringKeyframes no longer uses InterpolableAn imatableValues.
100 void forceConversionsToAnimatableValues(Element* element)
101 {
102 ensureKeyframeGroups();
103 ensureInterpolationEffect(element);
104 }
105
97 protected: 106 protected:
98 static KeyframeVector normalizedKeyframes(const KeyframeVector& keyframes); 107 static KeyframeVector normalizedKeyframes(const KeyframeVector& keyframes);
99 108
100 // Lazily computes the groups of property-specific keyframes. 109 // Lazily computes the groups of property-specific keyframes.
101 void ensureKeyframeGroups() const; 110 void ensureKeyframeGroups() const;
102 void ensureInterpolationEffect() const; 111 void ensureInterpolationEffect(Element* = 0) const;
103 112
104 KeyframeVector m_keyframes; 113 KeyframeVector m_keyframes;
105 // The spec describes filtering the normalized keyframes at sampling time 114 // The spec describes filtering the normalized keyframes at sampling time
106 // to get the 'property-specific keyframes'. For efficiency, we cache the 115 // to get the 'property-specific keyframes'. For efficiency, we cache the
107 // property-specific lists. 116 // property-specific lists.
108 typedef WillBeHeapHashMap<CSSPropertyID, OwnPtrWillBeMember<PropertySpecific KeyframeGroup> > KeyframeGroupMap; 117 typedef WillBeHeapHashMap<CSSPropertyID, OwnPtrWillBeMember<PropertySpecific KeyframeGroup> > KeyframeGroupMap;
109 mutable OwnPtrWillBeMember<KeyframeGroupMap> m_keyframeGroups; 118 mutable OwnPtrWillBeMember<KeyframeGroupMap> m_keyframeGroups;
110 mutable RefPtrWillBeMember<InterpolationEffect> m_interpolationEffect; 119 mutable RefPtrWillBeMember<InterpolationEffect> m_interpolationEffect;
111 120
112 friend class KeyframeEffectModelTest; 121 friend class KeyframeEffectModelTest;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 170
162 template <> 171 template <>
163 inline bool KeyframeEffectModel<AnimatableValueKeyframe>::isAnimatableValueKeyfr ameEffectModel() const { return true; } 172 inline bool KeyframeEffectModel<AnimatableValueKeyframe>::isAnimatableValueKeyfr ameEffectModel() const { return true; }
164 173
165 template <> 174 template <>
166 inline bool KeyframeEffectModel<StringKeyframe>::isStringKeyframeEffectModel() c onst { return true; } 175 inline bool KeyframeEffectModel<StringKeyframe>::isStringKeyframeEffectModel() c onst { return true; }
167 176
168 } // namespace WebCore 177 } // namespace WebCore
169 178
170 #endif // KeyframeEffectModel_h 179 #endif // KeyframeEffectModel_h
OLDNEW
« no previous file with comments | « Source/core/animation/Keyframe.h ('k') | Source/core/animation/KeyframeEffectModel.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698