LCOV - code coverage report
Current view: top level - dom/animation - AnimationEffectReadOnly.h (source / functions) Hit Total Coverage
Test: output.info Lines: 4 9 44.4 %
Date: 2017-07-14 16:53:18 Functions: 3 13 23.1 %
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_dom_AnimationEffectReadOnly_h
       8             : #define mozilla_dom_AnimationEffectReadOnly_h
       9             : 
      10             : #include "mozilla/ComputedTiming.h"
      11             : #include "mozilla/dom/AnimationEffectTimingReadOnly.h"
      12             : #include "mozilla/dom/BindingDeclarations.h"
      13             : #include "mozilla/dom/Nullable.h"
      14             : #include "mozilla/Maybe.h"
      15             : #include "mozilla/StickyTimeDuration.h"
      16             : #include "mozilla/TimeStamp.h"
      17             : #include "mozilla/TimingParams.h"
      18             : #include "nsCycleCollectionParticipant.h"
      19             : #include "nsWrapperCache.h"
      20             : 
      21             : namespace mozilla {
      22             : 
      23             : struct ElementPropertyTransition;
      24             : 
      25             : namespace dom {
      26             : 
      27             : class Animation;
      28             : class AnimationEffectTimingReadOnly;
      29             : class KeyframeEffectReadOnly;
      30             : struct ComputedTimingProperties;
      31             : 
      32             : class AnimationEffectReadOnly : public nsISupports,
      33             :                                 public nsWrapperCache
      34             : {
      35             : public:
      36             :   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
      37          14 :   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(AnimationEffectReadOnly)
      38             : 
      39             :   AnimationEffectReadOnly(nsIDocument* aDocument,
      40             :                           AnimationEffectTimingReadOnly* aTiming);
      41             : 
      42           0 :   virtual KeyframeEffectReadOnly* AsKeyframeEffect() { return nullptr; }
      43             : 
      44           0 :   virtual ElementPropertyTransition* AsTransition() { return nullptr; }
      45           0 :   virtual const ElementPropertyTransition* AsTransition() const
      46             :   {
      47           0 :     return nullptr;
      48             :   }
      49             : 
      50           0 :   nsISupports* GetParentObject() const { return mDocument; }
      51             : 
      52             :   bool IsCurrent() const;
      53             :   bool IsInEffect() const;
      54             :   bool IsActiveDurationZero() const
      55             :   {
      56             :     return SpecifiedTiming().ActiveDuration() == StickyTimeDuration();
      57             :   }
      58             : 
      59             :   already_AddRefed<AnimationEffectTimingReadOnly> Timing();
      60         382 :   const TimingParams& SpecifiedTiming() const
      61             :   {
      62         382 :     return mTiming->AsTimingParams();
      63             :   }
      64             :   void SetSpecifiedTiming(const TimingParams& aTiming);
      65             : 
      66             :   // This function takes as input the timing parameters of an animation and
      67             :   // returns the computed timing at the specified local time.
      68             :   //
      69             :   // The local time may be null in which case only static parameters such as the
      70             :   // active duration are calculated. All other members of the returned object
      71             :   // are given a null/initial value.
      72             :   //
      73             :   // This function returns a null mProgress member of the return value
      74             :   // if the animation should not be run
      75             :   // (because it is not currently active and is not filling at this time).
      76             :   static ComputedTiming
      77             :   GetComputedTimingAt(const Nullable<TimeDuration>& aLocalTime,
      78             :                       const TimingParams& aTiming,
      79             :                       double aPlaybackRate);
      80             :   // Shortcut that gets the computed timing using the current local time as
      81             :   // calculated from the timeline time.
      82             :   ComputedTiming GetComputedTiming(const TimingParams* aTiming = nullptr) const;
      83             :   void GetComputedTimingAsDict(ComputedTimingProperties& aRetVal) const;
      84             : 
      85             :   virtual void SetAnimation(Animation* aAnimation) = 0;
      86          26 :   Animation* GetAnimation() const { return mAnimation; };
      87             : 
      88             :   /**
      89             :    * Returns true if this effect animates one of the properties we consider
      90             :    * geometric properties, e.g. properties such as 'width' or 'margin-left'
      91             :    * that we try to synchronize with transform animations, on a valid target
      92             :    * element.
      93             :    */
      94             :   virtual bool AffectsGeometry() const = 0;
      95             : 
      96             : protected:
      97             :   virtual ~AnimationEffectReadOnly();
      98             : 
      99             :   Nullable<TimeDuration> GetLocalTime() const;
     100             : 
     101             : protected:
     102             :   RefPtr<nsIDocument> mDocument;
     103             :   RefPtr<AnimationEffectTimingReadOnly> mTiming;
     104             :   RefPtr<Animation> mAnimation;
     105             : };
     106             : 
     107             : } // namespace dom
     108             : } // namespace mozilla
     109             : 
     110             : #endif // mozilla_dom_AnimationEffectReadOnly_h

Generated by: LCOV version 1.13