/src/mozilla-central/gfx/layers/AnimationInfo.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #ifndef GFX_ANIMATIONINFO_H |
8 | | #define GFX_ANIMATIONINFO_H |
9 | | |
10 | | #include "nsAutoPtr.h" |
11 | | #include "nsDisplayItemTypes.h" |
12 | | |
13 | | struct RawServoAnimationValue; |
14 | | class nsIFrame; |
15 | | |
16 | | namespace mozilla { |
17 | | namespace layers { |
18 | | |
19 | | class Animation; |
20 | | class CompositorAnimations; |
21 | | class Layer; |
22 | | class LayerManager; |
23 | | struct AnimData; |
24 | | |
25 | | class AnimationInfo |
26 | | { |
27 | | typedef InfallibleTArray<Animation> AnimationArray; |
28 | | public: |
29 | | explicit AnimationInfo(LayerManager* aManager); |
30 | | virtual ~AnimationInfo(); |
31 | | |
32 | | // Ensure that this AnimationInfo has a valid (non-zero) animations id. This value is |
33 | | // unique across layers. |
34 | | void EnsureAnimationsId(); |
35 | | |
36 | | // Call AddAnimation to add a new animation to this layer from layout code. |
37 | | // Caller must fill in all the properties of the returned animation. |
38 | | // A later animation overrides an earlier one. |
39 | | Animation* AddAnimation(); |
40 | | |
41 | | // These are a parallel to AddAnimation and clearAnimations, except |
42 | | // they add pending animations that apply only when the next |
43 | | // transaction is begun. (See also |
44 | | // SetBaseTransformForNextTransaction.) |
45 | | Animation* AddAnimationForNextTransaction(); |
46 | | |
47 | | void SetAnimationGeneration(uint64_t aCount) { mAnimationGeneration = aCount; } |
48 | 0 | uint64_t GetAnimationGeneration() { return mAnimationGeneration; } |
49 | | |
50 | | // ClearAnimations clears animations on this layer. |
51 | | void ClearAnimations(); |
52 | | void ClearAnimationsForNextTransaction(); |
53 | | void SetCompositorAnimations(const CompositorAnimations& aCompositorAnimations); |
54 | | bool StartPendingAnimations(const TimeStamp& aReadyTime); |
55 | | void TransferMutatedFlagToLayer(Layer* aLayer); |
56 | | |
57 | | uint64_t GetCompositorAnimationsId() { return mCompositorAnimationsId; } |
58 | | RawServoAnimationValue* GetBaseAnimationStyle() const |
59 | | { |
60 | | return mBaseAnimationStyle; |
61 | | } |
62 | | InfallibleTArray<AnimData>& GetAnimationData() { return mAnimationData; } |
63 | | AnimationArray& GetAnimations() { return mAnimations; } |
64 | | bool ApplyPendingUpdatesForThisTransaction(); |
65 | | bool HasTransformAnimation() const; |
66 | | |
67 | | // In case of continuation, |aFrame| must be the first or the last |
68 | | // continuation frame, otherwise this function might return Nothing(). |
69 | | static Maybe<uint64_t> GetGenerationFromFrame(nsIFrame* aFrame, |
70 | | DisplayItemType aDisplayItemKey); |
71 | | |
72 | | protected: |
73 | | LayerManager* mManager; |
74 | | AnimationArray mAnimations; |
75 | | uint64_t mCompositorAnimationsId; |
76 | | nsAutoPtr<AnimationArray> mPendingAnimations; |
77 | | InfallibleTArray<AnimData> mAnimationData; |
78 | | // If this layer is used for OMTA, then this counter is used to ensure we |
79 | | // stay in sync with the animation manager |
80 | | uint64_t mAnimationGeneration; |
81 | | RefPtr<RawServoAnimationValue> mBaseAnimationStyle; |
82 | | bool mMutated; |
83 | | }; |
84 | | |
85 | | } // namespace layers |
86 | | } // namespace mozilla |
87 | | |
88 | | #endif // GFX_ANIMATIONINFO_H |