/work/obj-fuzz/dist/include/mozilla/ComputedTiming.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 file, |
5 | | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #ifndef mozilla_ComputedTiming_h |
8 | | #define mozilla_ComputedTiming_h |
9 | | |
10 | | #include "mozilla/dom/Nullable.h" |
11 | | #include "mozilla/StickyTimeDuration.h" |
12 | | #include "mozilla/ComputedTimingFunction.h" |
13 | | |
14 | | #include "mozilla/dom/AnimationEffectBinding.h" // FillMode |
15 | | |
16 | | namespace mozilla { |
17 | | |
18 | | /** |
19 | | * Stores the results of calculating the timing properties of an animation |
20 | | * at a given sample time. |
21 | | */ |
22 | | struct ComputedTiming |
23 | | { |
24 | | // The total duration of the animation including all iterations. |
25 | | // Will equal StickyTimeDuration::Forever() if the animation repeats |
26 | | // indefinitely. |
27 | | StickyTimeDuration mActiveDuration; |
28 | | // The time within the active interval. |
29 | | StickyTimeDuration mActiveTime; |
30 | | // The effect end time in local time (i.e. an offset from the effect's |
31 | | // start time). Will equal StickyTimeDuration::Forever() if the animation |
32 | | // plays indefinitely. |
33 | | StickyTimeDuration mEndTime; |
34 | | // Progress towards the end of the current iteration. If the effect is |
35 | | // being sampled backwards, this will go from 1.0 to 0.0. |
36 | | // Will be null if the animation is neither animating nor |
37 | | // filling at the sampled time. |
38 | | dom::Nullable<double> mProgress; |
39 | | // Zero-based iteration index (meaningless if mProgress is null). |
40 | | uint64_t mCurrentIteration = 0; |
41 | | // Unlike TimingParams::mIterations, this value is |
42 | | // guaranteed to be in the range [0, Infinity]. |
43 | | double mIterations = 1.0; |
44 | | double mIterationStart = 0.0; |
45 | | StickyTimeDuration mDuration; |
46 | | |
47 | | // This is the computed fill mode so it is never auto |
48 | | dom::FillMode mFill = dom::FillMode::None; |
49 | 0 | bool FillsForwards() const { |
50 | 0 | MOZ_ASSERT(mFill != dom::FillMode::Auto, |
51 | 0 | "mFill should not be Auto in ComputedTiming."); |
52 | 0 | return mFill == dom::FillMode::Both || |
53 | 0 | mFill == dom::FillMode::Forwards; |
54 | 0 | } |
55 | 0 | bool FillsBackwards() const { |
56 | 0 | MOZ_ASSERT(mFill != dom::FillMode::Auto, |
57 | 0 | "mFill should not be Auto in ComputedTiming."); |
58 | 0 | return mFill == dom::FillMode::Both || |
59 | 0 | mFill == dom::FillMode::Backwards; |
60 | 0 | } |
61 | | |
62 | | enum class AnimationPhase { |
63 | | Idle, // Not sampled (null sample time) |
64 | | Before, // Sampled prior to the start of the active interval |
65 | | Active, // Sampled within the active interval |
66 | | After // Sampled after (or at) the end of the active interval |
67 | | }; |
68 | | AnimationPhase mPhase = AnimationPhase::Idle; |
69 | | |
70 | | ComputedTimingFunction::BeforeFlag mBeforeFlag = |
71 | | ComputedTimingFunction::BeforeFlag::Unset; |
72 | | }; |
73 | | |
74 | | } // namespace mozilla |
75 | | |
76 | | #endif // mozilla_ComputedTiming_h |