LCOV - code coverage report
Current view: top level - dom/animation - Keyframe.h (source / functions) Hit Total Coverage
Test: output.info Lines: 6 21 28.6 %
Date: 2017-07-14 16:53:18 Functions: 7 10 70.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_dom_Keyframe_h
       8             : #define mozilla_dom_Keyframe_h
       9             : 
      10             : #include "nsCSSPropertyID.h"
      11             : #include "nsCSSValue.h"
      12             : #include "nsTArray.h"
      13             : #include "mozilla/ComputedTimingFunction.h"
      14             : #include "mozilla/Maybe.h"
      15             : #include "mozilla/RefPtr.h"
      16             : 
      17             : struct RawServoDeclarationBlock;
      18             : namespace mozilla {
      19             : namespace dom {
      20             : enum class CompositeOperation : uint8_t;
      21             : }
      22             : 
      23             : /**
      24             :  * A property-value pair specified on a keyframe.
      25             :  */
      26          40 : struct PropertyValuePair
      27             : {
      28           4 :   PropertyValuePair(nsCSSPropertyID aProperty, nsCSSValue&& aValue)
      29           4 :     : mProperty(aProperty), mValue(Move(aValue)) { }
      30           0 :   PropertyValuePair(nsCSSPropertyID aProperty,
      31             :                     RefPtr<RawServoDeclarationBlock>&& aValue)
      32           0 :     : mProperty(aProperty), mServoDeclarationBlock(Move(aValue))
      33             :   {
      34           0 :     MOZ_ASSERT(mServoDeclarationBlock, "Should be valid property value");
      35           0 :   }
      36             : 
      37             :   nsCSSPropertyID mProperty;
      38             :   // The specified value for the property. For shorthand property values,
      39             :   // we store the specified property value as a token stream (string).
      40             :   // If this is uninitialized, we use the underlying value.
      41             :   nsCSSValue mValue;
      42             : 
      43             :   // The specified value when using the Servo backend.
      44             :   RefPtr<RawServoDeclarationBlock> mServoDeclarationBlock;
      45             : 
      46             : #ifdef DEBUG
      47             :   // Flag to indicate that when we call StyleAnimationValue::ComputeValues on
      48             :   // this value we should behave as if that function had failed.
      49             :   bool mSimulateComputeValuesFailure = false;
      50             : #endif
      51             : 
      52             :   bool operator==(const PropertyValuePair&) const;
      53             : };
      54             : 
      55             : /**
      56             :  * A single keyframe.
      57             :  *
      58             :  * This is the canonical form in which keyframe effects are stored and
      59             :  * corresponds closely to the type of objects returned via the getKeyframes()
      60             :  * API.
      61             :  *
      62             :  * Before computing an output animation value, however, we flatten these frames
      63             :  * down to a series of per-property value arrays where we also resolve any
      64             :  * overlapping shorthands/longhands, convert specified CSS values to computed
      65             :  * values, etc.
      66             :  *
      67             :  * When the target element or style context changes, however, we rebuild these
      68             :  * per-property arrays from the original list of keyframes objects. As a result,
      69             :  * these objects represent the master definition of the effect's values.
      70             :  */
      71          16 : struct Keyframe
      72             : {
      73           4 :   Keyframe() = default;
      74          16 :   Keyframe(const Keyframe& aOther) = default;
      75           0 :   Keyframe(Keyframe&& aOther)
      76           0 :   {
      77           0 :     *this = Move(aOther);
      78           0 :   }
      79             : 
      80             :   Keyframe& operator=(const Keyframe& aOther) = default;
      81           0 :   Keyframe& operator=(Keyframe&& aOther)
      82             :   {
      83           0 :     mOffset         = aOther.mOffset;
      84           0 :     mComputedOffset = aOther.mComputedOffset;
      85           0 :     mTimingFunction = Move(aOther.mTimingFunction);
      86           0 :     mComposite      = Move(aOther.mComposite);
      87           0 :     mPropertyValues = Move(aOther.mPropertyValues);
      88           0 :     return *this;
      89             :   }
      90             : 
      91             :   Maybe<double>                 mOffset;
      92             :   static constexpr double kComputedOffsetNotSet = -1.0;
      93             :   double                        mComputedOffset = kComputedOffsetNotSet;
      94             :   Maybe<ComputedTimingFunction> mTimingFunction; // Nothing() here means
      95             :                                                  // "linear"
      96             :   Maybe<dom::CompositeOperation> mComposite;
      97             :   nsTArray<PropertyValuePair>   mPropertyValues;
      98             : };
      99             : 
     100             : }
     101             : 
     102             : #endif // mozilla_dom_Keyframe_h

Generated by: LCOV version 1.13