author André Bargull <>
Fri, 17 Aug 2018 14:30:37 -0700
changeset 432230 fd8d17192696250a5396894301478f36c6c75be7
parent 417276 a31c1b8a41f81fb564bd86e1c22617595d61a42d
child 448947 6f3709b3878117466168c40affa7bca0b60cf75b
permissions -rw-r--r--
Bug 1346211 - Part 7: Clobber after modifying ICU data file. r=clobber

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at */

#include "SMILBoolType.h"
#include "nsSMILValue.h"
#include "nsDebug.h"
#include <math.h>

namespace mozilla {

SMILBoolType::Init(nsSMILValue& aValue) const
  MOZ_ASSERT(aValue.IsNull(), "Unexpected value type");
  aValue.mU.mBool = false;
  aValue.mType = this;

SMILBoolType::Destroy(nsSMILValue& aValue) const
  MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value");
  aValue.mU.mBool = false;
  aValue.mType = nsSMILNullType::Singleton();

SMILBoolType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const
  MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
  MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value");
  aDest.mU.mBool = aSrc.mU.mBool;
  return NS_OK;

SMILBoolType::IsEqual(const nsSMILValue& aLeft,
                      const nsSMILValue& aRight) const
  MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
  MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");

  return aLeft.mU.mBool == aRight.mU.mBool;

SMILBoolType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
                  uint32_t aCount) const
  MOZ_ASSERT(aValueToAdd.mType == aDest.mType, "Trying to add invalid types");
  MOZ_ASSERT(aValueToAdd.mType == this, "Unexpected source type");
  return NS_ERROR_FAILURE; // bool values can't be added to each other

SMILBoolType::ComputeDistance(const nsSMILValue& aFrom,
                              const nsSMILValue& aTo,
                              double& aDistance) const
  MOZ_ASSERT(aFrom.mType == aTo.mType, "Trying to compare different types");
  MOZ_ASSERT(aFrom.mType == this, "Unexpected source type");
  return NS_ERROR_FAILURE; // there is no concept of distance between bool values

SMILBoolType::Interpolate(const nsSMILValue& aStartVal,
                          const nsSMILValue& aEndVal,
                          double aUnitDistance,
                          nsSMILValue& aResult) const
  MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
             "Trying to interpolate different types");
  MOZ_ASSERT(aStartVal.mType == this,
      "Unexpected types for interpolation");
  MOZ_ASSERT(aResult.mType   == this, "Unexpected result type");
  return NS_ERROR_FAILURE; // bool values do not interpolate

} // namespace mozilla