LCOV - code coverage report
Current view: top level - dom/animation - ComputedTiming.h (source / functions) Hit Total Coverage
Test: output.info Lines: 5 9 55.6 %
Date: 2017-07-14 16:53:18 Functions: 3 4 75.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.13