SMILNullType.cpp (1964B)
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 "SMILNullType.h" 8 9 #include "mozilla/SMILValue.h" 10 #include "nsDebug.h" 11 12 namespace mozilla { 13 14 /*static*/ 15 SMILNullType* SMILNullType::Singleton() { 16 static SMILNullType sSingleton; 17 return &sSingleton; 18 } 19 20 nsresult SMILNullType::Assign(SMILValue& aDest, const SMILValue& aSrc) const { 21 MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types"); 22 MOZ_ASSERT(aSrc.mType == this, "Unexpected source type"); 23 aDest.mU = aSrc.mU; 24 aDest.mType = Singleton(); 25 return NS_OK; 26 } 27 28 bool SMILNullType::IsEqual(const SMILValue& aLeft, 29 const SMILValue& aRight) const { 30 MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types"); 31 MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value"); 32 33 return true; // All null-typed values are equivalent. 34 } 35 36 nsresult SMILNullType::Add(SMILValue& aDest, const SMILValue& aValueToAdd, 37 uint32_t aCount) const { 38 MOZ_ASSERT_UNREACHABLE("Adding NULL type"); 39 return NS_ERROR_FAILURE; 40 } 41 42 nsresult SMILNullType::ComputeDistance(const SMILValue& aFrom, 43 const SMILValue& aTo, 44 double& aDistance) const { 45 MOZ_ASSERT_UNREACHABLE("Computing distance for NULL type"); 46 return NS_ERROR_FAILURE; 47 } 48 49 nsresult SMILNullType::Interpolate(const SMILValue& aStartVal, 50 const SMILValue& aEndVal, 51 double aUnitDistance, 52 SMILValue& aResult) const { 53 MOZ_ASSERT_UNREACHABLE("Interpolating NULL type"); 54 return NS_ERROR_FAILURE; 55 } 56 57 } // namespace mozilla