dom/smil/nsSMILNullType.cpp

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:44983131ed66
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 #include "nsSMILNullType.h"
7 #include "nsSMILValue.h"
8 #include "nsDebug.h"
9
10 nsresult
11 nsSMILNullType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const
12 {
13 NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
14 NS_PRECONDITION(aSrc.mType == this, "Unexpected source type");
15 aDest.mU = aSrc.mU;
16 aDest.mType = Singleton();
17 return NS_OK;
18 }
19
20 bool
21 nsSMILNullType::IsEqual(const nsSMILValue& aLeft,
22 const nsSMILValue& aRight) const
23 {
24 NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
25 NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
26
27 return true; // All null-typed values are equivalent.
28 }
29
30 nsresult
31 nsSMILNullType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
32 uint32_t aCount) const
33 {
34 NS_NOTREACHED("Adding NULL type");
35 return NS_ERROR_FAILURE;
36 }
37
38 nsresult
39 nsSMILNullType::ComputeDistance(const nsSMILValue& aFrom,
40 const nsSMILValue& aTo,
41 double& aDistance) const
42 {
43 NS_NOTREACHED("Computing distance for NULL type");
44 return NS_ERROR_FAILURE;
45 }
46
47 nsresult
48 nsSMILNullType::Interpolate(const nsSMILValue& aStartVal,
49 const nsSMILValue& aEndVal,
50 double aUnitDistance,
51 nsSMILValue& aResult) const
52 {
53 NS_NOTREACHED("Interpolating NULL type");
54 return NS_ERROR_FAILURE;
55 }

mercurial