dom/smil/nsSMILNullType.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/smil/nsSMILNullType.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,55 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "nsSMILNullType.h"
    1.10 +#include "nsSMILValue.h"
    1.11 +#include "nsDebug.h"
    1.12 +
    1.13 +nsresult
    1.14 +nsSMILNullType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const
    1.15 +{
    1.16 +  NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
    1.17 +  NS_PRECONDITION(aSrc.mType == this, "Unexpected source type");
    1.18 +  aDest.mU    = aSrc.mU;
    1.19 +  aDest.mType = Singleton();
    1.20 +  return NS_OK;
    1.21 +}
    1.22 +
    1.23 +bool
    1.24 +nsSMILNullType::IsEqual(const nsSMILValue& aLeft,
    1.25 +                        const nsSMILValue& aRight) const
    1.26 +{
    1.27 +  NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
    1.28 +  NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
    1.29 +
    1.30 +  return true;  // All null-typed values are equivalent.
    1.31 +}
    1.32 +
    1.33 +nsresult
    1.34 +nsSMILNullType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
    1.35 +                    uint32_t aCount) const
    1.36 +{
    1.37 +  NS_NOTREACHED("Adding NULL type");
    1.38 +  return NS_ERROR_FAILURE;
    1.39 +}
    1.40 +
    1.41 +nsresult
    1.42 +nsSMILNullType::ComputeDistance(const nsSMILValue& aFrom,
    1.43 +                                const nsSMILValue& aTo,
    1.44 +                                double& aDistance) const
    1.45 +{
    1.46 +  NS_NOTREACHED("Computing distance for NULL type");
    1.47 +  return NS_ERROR_FAILURE;
    1.48 +}
    1.49 +
    1.50 +nsresult
    1.51 +nsSMILNullType::Interpolate(const nsSMILValue& aStartVal,
    1.52 +                            const nsSMILValue& aEndVal,
    1.53 +                            double aUnitDistance,
    1.54 +                            nsSMILValue& aResult) const
    1.55 +{
    1.56 +  NS_NOTREACHED("Interpolating NULL type");
    1.57 +  return NS_ERROR_FAILURE;
    1.58 +}

mercurial