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

Side by Side Diff: third_party/WebKit/Source/core/animation/ElementAnimations.h

Issue 1602343002: compositor-worker: cc->blink mutation plumbing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@compositor-worker-ian-patch
Patch Set: Use animation machinery instead of updating inline style Created 4 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 ElementAnimations_h 31 #ifndef ElementAnimations_h
32 #define ElementAnimations_h 32 #define ElementAnimations_h
33 33
34 #include "core/animation/AnimationStack.h" 34 #include "core/animation/AnimationStack.h"
35 #include "core/animation/CompositorMutationAnimations.h"
35 #include "core/animation/css/CSSAnimations.h" 36 #include "core/animation/css/CSSAnimations.h"
36 #include "wtf/HashCountedSet.h" 37 #include "wtf/HashCountedSet.h"
37 #include "wtf/HashMap.h" 38 #include "wtf/HashMap.h"
38 #include "wtf/RefPtr.h" 39 #include "wtf/RefPtr.h"
39 #include "wtf/Vector.h" 40 #include "wtf/Vector.h"
40 41
41 namespace blink { 42 namespace blink {
42 43
43 class CSSAnimations; 44 class CSSAnimations;
44 45
45 using AnimationCountedSet = HeapHashCountedSet<WeakMember<Animation>>; 46 using AnimationCountedSet = HeapHashCountedSet<WeakMember<Animation>>;
46 47
47 class ElementAnimations : public GarbageCollectedFinalized<ElementAnimations> { 48 class ElementAnimations : public GarbageCollectedFinalized<ElementAnimations> {
48 WTF_MAKE_NONCOPYABLE(ElementAnimations); 49 WTF_MAKE_NONCOPYABLE(ElementAnimations);
49 public: 50 public:
50 ElementAnimations(); 51 ElementAnimations();
51 ~ElementAnimations(); 52 ~ElementAnimations();
52 53
53 // Animations that are currently active for this element, their effects will be applied 54 // Animations that are currently active for this element, their effects will be applied
54 // during a style recalc. CSS Transitions are included in this stack. 55 // during a style recalc. CSS Transitions are included in this stack.
55 AnimationStack& animationStack() { return m_animationStack; } 56 AnimationStack& animationStack() { return m_animationStack; }
56 const AnimationStack& animationStack() const { return m_animationStack; } 57 const AnimationStack& animationStack() const { return m_animationStack; }
58 // Tracks long running animations that are responsible for applying mutation s
59 // from compositor worker.
60 CompositorMutationAnimations& compositorMutationAnimations() { return m_comp ositorMutationAnimations; }
61 const CompositorMutationAnimations& compositorMutationAnimations() const { r eturn m_compositorMutationAnimations; }
57 // Tracks the state of active CSS Animations and Transitions. The individual animations 62 // Tracks the state of active CSS Animations and Transitions. The individual animations
58 // will also be part of the animation stack, but the mapping betwen animatio n name and 63 // will also be part of the animation stack, but the mapping betwen animatio n name and
59 // animation is kept here. 64 // animation is kept here.
60 CSSAnimations& cssAnimations() { return m_cssAnimations; } 65 CSSAnimations& cssAnimations() { return m_cssAnimations; }
61 const CSSAnimations& cssAnimations() const { return m_cssAnimations; } 66 const CSSAnimations& cssAnimations() const { return m_cssAnimations; }
62 67
63 // Animations which have effects targeting this element. 68 // Animations which have effects targeting this element.
64 AnimationCountedSet& animations() { return m_animations; } 69 AnimationCountedSet& animations() { return m_animations; }
65 70
66 bool isEmpty() const { return m_animationStack.isEmpty() && m_cssAnimations. isEmpty() && m_animations.isEmpty(); } 71 bool isEmpty() const { return m_animationStack.isEmpty() && m_cssAnimations. isEmpty() && m_animations.isEmpty(); }
(...skipping 11 matching lines...) Expand all
78 void addEffect(KeyframeEffect* effect) { m_effects.add(effect); } 83 void addEffect(KeyframeEffect* effect) { m_effects.add(effect); }
79 void dispose(); 84 void dispose();
80 #endif 85 #endif
81 86
82 DECLARE_TRACE(); 87 DECLARE_TRACE();
83 88
84 private: 89 private:
85 bool isAnimationStyleChange() const; 90 bool isAnimationStyleChange() const;
86 91
87 AnimationStack m_animationStack; 92 AnimationStack m_animationStack;
93 CompositorMutationAnimations m_compositorMutationAnimations;
88 CSSAnimations m_cssAnimations; 94 CSSAnimations m_cssAnimations;
89 AnimationCountedSet m_animations; 95 AnimationCountedSet m_animations;
90 bool m_animationStyleChange; 96 bool m_animationStyleChange;
91 RefPtr<ComputedStyle> m_baseComputedStyle; 97 RefPtr<ComputedStyle> m_baseComputedStyle;
92 98
93 #if !ENABLE(OILPAN) 99 #if !ENABLE(OILPAN)
94 // TODO(oilpan): This is to avoid a reference cycle that keeps Elements 100 // TODO(oilpan): This is to avoid a reference cycle that keeps Elements
95 // alive and won't be needed once the Node hierarchy becomes traceable. 101 // alive and won't be needed once the Node hierarchy becomes traceable.
96 HeapHashSet<WeakMember<KeyframeEffect>> m_effects; 102 HeapHashSet<WeakMember<KeyframeEffect>> m_effects;
97 #endif 103 #endif
98 104
99 // CSSAnimations and DeferredLegacyStyleInterpolation checks if a style chan ge is due to animation. 105 // CSSAnimations and DeferredLegacyStyleInterpolation checks if a style chan ge is due to animation.
100 friend class CSSAnimations; 106 friend class CSSAnimations;
101 friend class DeferredLegacyStyleInterpolation; 107 friend class DeferredLegacyStyleInterpolation;
102 }; 108 };
103 109
104 } // namespace blink 110 } // namespace blink
105 111
106 #endif // ElementAnimations_h 112 #endif // ElementAnimations_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698