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

Side by Side Diff: Source/core/animation/css/CSSAnimations.h

Issue 814083003: Update animation when changes in animation keyframes are detected. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address comments Created 5 years, 10 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
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 14 matching lines...) Expand all
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef CSSAnimations_h 31 #ifndef CSSAnimations_h
32 #define CSSAnimations_h 32 #define CSSAnimations_h
33 33
34 #include "core/animation/InertAnimation.h" 34 #include "core/animation/InertAnimation.h"
35 #include "core/animation/Interpolation.h"
36 #include "core/animation/css/CSSAnimationData.h"
35 #include "core/animation/css/CSSAnimationUpdate.h" 37 #include "core/animation/css/CSSAnimationUpdate.h"
38 #include "core/css/CSSKeyframesRule.h"
36 #include "core/css/StylePropertySet.h" 39 #include "core/css/StylePropertySet.h"
37 #include "core/dom/Document.h" 40 #include "core/dom/Document.h"
38 #include "wtf/HashMap.h" 41 #include "wtf/HashMap.h"
39 #include "wtf/text/AtomicString.h" 42 #include "wtf/text/AtomicString.h"
40 43
41 namespace blink { 44 namespace blink {
42 45
43 class CSSTransitionData; 46 class CSSTransitionData;
44 class Element; 47 class Element;
45 class StylePropertyShorthand; 48 class StylePropertyShorthand;
46 class StyleResolver; 49 class StyleResolver;
47 class StyleRuleKeyframes;
48 50
49 class CSSAnimations final { 51 class CSSAnimations final {
50 WTF_MAKE_NONCOPYABLE(CSSAnimations); 52 WTF_MAKE_NONCOPYABLE(CSSAnimations);
51 DISALLOW_ALLOCATION(); 53 DISALLOW_ALLOCATION();
52 public: 54 public:
53 CSSAnimations(); 55 CSSAnimations();
54 56
55 const AtomicString getAnimationNameForInspector(const AnimationPlayer&); 57 const AtomicString getAnimationNameForInspector(const AnimationPlayer&);
56 bool isTransitionAnimationForInspector(const AnimationPlayer&) const; 58 bool isTransitionAnimationForInspector(const AnimationPlayer&) const;
57 59
58 static const StylePropertyShorthand& animatableProperties(); 60 static const StylePropertyShorthand& animatableProperties();
59 static bool isAllowedAnimation(CSSPropertyID); 61 static bool isAllowedAnimation(CSSPropertyID);
60 static PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> calculateUpdate(const Elem ent* animatingElement, Element&, const RenderStyle&, RenderStyle* parentStyle, S tyleResolver*); 62 static PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> calculateUpdate(const Elem ent* animatingElement, Element&, const RenderStyle&, RenderStyle* parentStyle, S tyleResolver*);
61 63
62 void setPendingUpdate(PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> update) { m _pendingUpdate = update; } 64 void setPendingUpdate(PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> update) { m _pendingUpdate = update; }
63 void maybeApplyPendingUpdate(Element*); 65 void maybeApplyPendingUpdate(Element*);
64 bool isEmpty() const { return m_animations.isEmpty() && m_transitions.isEmpt y() && !m_pendingUpdate; } 66 bool isEmpty() const { return m_animations.isEmpty() && m_transitions.isEmpt y() && !m_pendingUpdate; }
65 void cancel(); 67 void cancel();
66 68
67 void trace(Visitor*); 69 void trace(Visitor*);
68 70
69 private: 71 private:
72 class RunningAnimation : public RefCountedWillBeGarbageCollected<RunningAnim ation> {
esprehn 2015/02/02 00:11:20 final
shend 2015/02/02 00:53:54 Done.
73 public:
74 RunningAnimation(PassRefPtrWillBeRawPtr<AnimationPlayer> player, CSSAnim ationUpdate::NewAnimation animation)
75 : player(player)
76 , specifiedTiming(animation.timing)
77 , styleRule(animation.styleRule)
78 , styleRuleVersion(animation.styleRuleVersion)
79 {
80 }
81
82 void update(CSSAnimationUpdate::UpdatedAnimation update)
83 {
84 styleRule = update.styleRule;
85 styleRuleVersion = update.styleRuleVersion;
86 specifiedTiming = update.specifiedTiming;
87 }
88
89 void trace(Visitor* visitor)
90 {
91 visitor->trace(player);
92 visitor->trace(styleRule);
93 }
94
95 RefPtrWillBeMember<AnimationPlayer> player;
96 Timing specifiedTiming;
97 RefPtrWillBeMember<StyleRuleKeyframes> styleRule;
98 unsigned styleRuleVersion;
99 };
100
70 struct RunningTransition { 101 struct RunningTransition {
71 ALLOW_ONLY_INLINE_ALLOCATION(); 102 ALLOW_ONLY_INLINE_ALLOCATION();
72 public: 103 public:
73 void trace(Visitor* visitor) 104 void trace(Visitor* visitor)
74 { 105 {
75 visitor->trace(player); 106 visitor->trace(player);
76 visitor->trace(from); 107 visitor->trace(from);
77 visitor->trace(to); 108 visitor->trace(to);
78 } 109 }
79 110
80 RefPtrWillBeMember<AnimationPlayer> player; 111 RefPtrWillBeMember<AnimationPlayer> player;
81 RawPtrWillBeMember<const AnimatableValue> from; 112 RawPtrWillBeMember<const AnimatableValue> from;
82 RawPtrWillBeMember<const AnimatableValue> to; 113 RawPtrWillBeMember<const AnimatableValue> to;
83 }; 114 };
84 115
85 using AnimationMap = WillBeHeapHashMap<AtomicString, RefPtrWillBeMember<Anim ationPlayer>>; 116 using AnimationMap = WillBeHeapHashMap<AtomicString, RefPtrWillBeMember<Runn ingAnimation>>;
86 AnimationMap m_animations; 117 AnimationMap m_animations;
87 118
88 using TransitionMap = WillBeHeapHashMap<CSSPropertyID, RunningTransition>; 119 using TransitionMap = WillBeHeapHashMap<CSSPropertyID, RunningTransition>;
89 TransitionMap m_transitions; 120 TransitionMap m_transitions;
90 121
91 OwnPtrWillBeMember<CSSAnimationUpdate> m_pendingUpdate; 122 OwnPtrWillBeMember<CSSAnimationUpdate> m_pendingUpdate;
92 123
93 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation>> m_previo usActiveInterpolationsForAnimations; 124 WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation>> m_previo usActiveInterpolationsForAnimations;
94 125
95 static void calculateAnimationUpdate(CSSAnimationUpdate*, const Element* ani matingElement, Element&, const RenderStyle&, RenderStyle* parentStyle, StyleReso lver*); 126 static void calculateAnimationUpdate(CSSAnimationUpdate*, const Element* ani matingElement, Element&, const RenderStyle&, RenderStyle* parentStyle, StyleReso lver*);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 private: 166 private:
136 RawPtrWillBeMember<Element> m_target; 167 RawPtrWillBeMember<Element> m_target;
137 const CSSPropertyID m_property; 168 const CSSPropertyID m_property;
138 AnimationNode::Phase m_previousPhase; 169 AnimationNode::Phase m_previousPhase;
139 }; 170 };
140 }; 171 };
141 172
142 } // namespace blink 173 } // namespace blink
143 174
144 #endif 175 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698