LCOV - code coverage report
Current view: top level - dom/smil - SMILEnumType.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 32 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 7 0.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             : #include "SMILEnumType.h"
       8             : #include "nsSMILValue.h"
       9             : #include "nsDebug.h"
      10             : #include <math.h>
      11             : 
      12             : namespace mozilla {
      13             : 
      14             : void
      15           0 : SMILEnumType::Init(nsSMILValue& aValue) const
      16             : {
      17           0 :   NS_PRECONDITION(aValue.IsNull(), "Unexpected value type");
      18           0 :   aValue.mU.mUint = 0;
      19           0 :   aValue.mType = this;
      20           0 : }
      21             : 
      22             : void
      23           0 : SMILEnumType::Destroy(nsSMILValue& aValue) const
      24             : {
      25           0 :   NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value");
      26           0 :   aValue.mU.mUint = 0;
      27           0 :   aValue.mType = nsSMILNullType::Singleton();
      28           0 : }
      29             : 
      30             : nsresult
      31           0 : SMILEnumType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const
      32             : {
      33           0 :   NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
      34           0 :   NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value");
      35           0 :   aDest.mU.mUint = aSrc.mU.mUint;
      36           0 :   return NS_OK;
      37             : }
      38             : 
      39             : bool
      40           0 : SMILEnumType::IsEqual(const nsSMILValue& aLeft,
      41             :                       const nsSMILValue& aRight) const
      42             : {
      43           0 :   NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
      44           0 :   NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
      45             : 
      46           0 :   return aLeft.mU.mUint == aRight.mU.mUint;
      47             : }
      48             : 
      49             : nsresult
      50           0 : SMILEnumType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
      51             :                   uint32_t aCount) const
      52             : {
      53           0 :   NS_PRECONDITION(aValueToAdd.mType == aDest.mType,
      54             :                   "Trying to add invalid types");
      55           0 :   NS_PRECONDITION(aValueToAdd.mType == this, "Unexpected source type");
      56           0 :   return NS_ERROR_FAILURE; // enum values can't be added to each other
      57             : }
      58             : 
      59             : nsresult
      60           0 : SMILEnumType::ComputeDistance(const nsSMILValue& aFrom,
      61             :                               const nsSMILValue& aTo,
      62             :                               double& aDistance) const
      63             : {
      64           0 :   NS_PRECONDITION(aFrom.mType == aTo.mType,"Trying to compare different types");
      65           0 :   NS_PRECONDITION(aFrom.mType == this, "Unexpected source type");
      66           0 :   return NS_ERROR_FAILURE; // there is no concept of distance between enum values
      67             : }
      68             : 
      69             : nsresult
      70           0 : SMILEnumType::Interpolate(const nsSMILValue& aStartVal,
      71             :                           const nsSMILValue& aEndVal,
      72             :                           double aUnitDistance,
      73             :                           nsSMILValue& aResult) const
      74             : {
      75           0 :   NS_PRECONDITION(aStartVal.mType == aEndVal.mType,
      76             :       "Trying to interpolate different types");
      77           0 :   NS_PRECONDITION(aStartVal.mType == this,
      78             :       "Unexpected types for interpolation");
      79           0 :   NS_PRECONDITION(aResult.mType   == this, "Unexpected result type");
      80           0 :   return NS_ERROR_FAILURE; // enum values do not interpolate
      81             : }
      82             : 
      83             : } // namespace mozilla

Generated by: LCOV version 1.13