LCOV - code coverage report
Current view: top level - dom/animation - AnimationUtils.h (source / functions) Hit Total Coverage
Test: output.info Lines: 5 10 50.0 %
Date: 2017-07-14 16:53:18 Functions: 1 2 50.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
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef mozilla_dom_AnimationUtils_h
       8             : #define mozilla_dom_AnimationUtils_h
       9             : 
      10             : #include "mozilla/TimeStamp.h"
      11             : #include "mozilla/dom/BindingDeclarations.h"
      12             : #include "mozilla/dom/Nullable.h"
      13             : #include "nsStringFwd.h"
      14             : 
      15             : class nsIContent;
      16             : class nsIDocument;
      17             : class nsIFrame;
      18             : struct JSContext;
      19             : 
      20             : namespace mozilla {
      21             : 
      22             : class ComputedTimingFunction;
      23             : class EffectSet;
      24             : 
      25             : class AnimationUtils
      26             : {
      27             : public:
      28             :   static dom::Nullable<double>
      29           4 :   TimeDurationToDouble(const dom::Nullable<TimeDuration>& aTime)
      30             :   {
      31           4 :     dom::Nullable<double> result;
      32             : 
      33           4 :     if (!aTime.IsNull()) {
      34           4 :       result.SetValue(aTime.Value().ToMilliseconds());
      35             :     }
      36             : 
      37           4 :     return result;
      38             :   }
      39             : 
      40             :   static dom::Nullable<TimeDuration>
      41           0 :   DoubleToTimeDuration(const dom::Nullable<double>& aTime)
      42             :   {
      43           0 :     dom::Nullable<TimeDuration> result;
      44             : 
      45           0 :     if (!aTime.IsNull()) {
      46           0 :       result.SetValue(TimeDuration::FromMilliseconds(aTime.Value()));
      47             :     }
      48             : 
      49           0 :     return result;
      50             :   }
      51             : 
      52             :   static void LogAsyncAnimationFailure(nsCString& aMessage,
      53             :                                        const nsIContent* aContent = nullptr);
      54             : 
      55             :   /**
      56             :    * Get the document from the JS context to use when parsing CSS properties.
      57             :    */
      58             :   static nsIDocument*
      59             :   GetCurrentRealmDocument(JSContext* aCx);
      60             : 
      61             :   /**
      62             :    * Checks if offscreen animation throttling is enabled.
      63             :    */
      64             :   static bool
      65             :   IsOffscreenThrottlingEnabled();
      66             : 
      67             :   /**
      68             :    * Returns true if the preference to enable the core Web Animations API is
      69             :    * true.
      70             :    */
      71             :   static bool IsCoreAPIEnabled();
      72             : 
      73             :   /**
      74             :    * Returns true if the preference to enable the core Web Animations API is
      75             :    * true or the caller is chrome.
      76             :    */
      77             :   static bool IsCoreAPIEnabledForCaller(dom::CallerType aCallerType);
      78             : 
      79             :   /**
      80             :    * Returns true if the given EffectSet contains a current effect that animates
      81             :    * scale. |aFrame| is used for calculation of scale values.
      82             :    */
      83             :   static bool EffectSetContainsAnimatedScale(EffectSet& aEffects,
      84             :                                              const nsIFrame* aFrame);
      85             : };
      86             : 
      87             : } // namespace mozilla
      88             : 
      89             : #endif

Generated by: LCOV version 1.13