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 #ifndef DOM_SMIL_SMILFLOATTYPE_H_ 8 #define DOM_SMIL_SMILFLOATTYPE_H_ 9 10 #include "mozilla/Attributes.h" 11 #include "mozilla/SMILType.h" 12 13 namespace mozilla { 14 15 class SMILFloatType : public SMILType { 16 public: 17 // Singleton for SMILValue objects to hold onto. Singleton()18 static SMILFloatType* Singleton() { 19 static SMILFloatType sSingleton; 20 return &sSingleton; 21 } 22 23 protected: 24 // SMILType Methods 25 // ------------------- 26 virtual void Init(SMILValue& aValue) const override; 27 virtual void Destroy(SMILValue& aValue) const override; 28 virtual nsresult Assign(SMILValue& aDest, 29 const SMILValue& aSrc) const override; 30 virtual bool IsEqual(const SMILValue& aLeft, 31 const SMILValue& aRight) const override; 32 virtual nsresult Add(SMILValue& aDest, const SMILValue& aValueToAdd, 33 uint32_t aCount) const override; 34 virtual nsresult ComputeDistance(const SMILValue& aFrom, const SMILValue& aTo, 35 double& aDistance) const override; 36 virtual nsresult Interpolate(const SMILValue& aStartVal, 37 const SMILValue& aEndVal, double aUnitDistance, 38 SMILValue& aResult) const override; 39 40 private: 41 // Private constructor: prevent instances beyond my singleton. 42 constexpr SMILFloatType() = default; 43 }; 44 45 } // namespace mozilla 46 47 #endif // DOM_SMIL_SMILFLOATTYPE_H_ 48