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/. */
7 #ifndef DOM_SVG_SVGORIENTSMILTYPE_H_
8 #define DOM_SVG_SVGORIENTSMILTYPE_H_
10 #include "mozilla/Attributes.h"
11 #include "mozilla/SMILType.h"
14 * This SMILType class is a special case for the 'orient' attribute on SVG's
17 * orient = "auto | auto-start-reverse | <angle>"
19 * Unusually, this attribute doesn't have just a single corresponding DOM
20 * property, but rather is split into two properties: 'orientType' (of type
21 * DOMSVGAnimatedEnumeration) and 'orientAngle' (of type DOMSVGAnimatedAngle).
22 * If 'orientType.animVal' is SVG_MARKER_ORIENT_ANGLE, then
23 * 'orientAngle.animVal' contains the angle that is being used. The lacuna
31 class SVGOrientSMILType
: public SMILType
{
33 // Singleton for SMILValue objects to hold onto.
34 static SVGOrientSMILType sSingleton
;
38 // -------------------
39 void Init(SMILValue
& aValue
) const override
;
40 void Destroy(SMILValue
&) const override
;
41 nsresult
Assign(SMILValue
& aDest
, const SMILValue
& aSrc
) const override
;
42 bool IsEqual(const SMILValue
& aLeft
, const SMILValue
& aRight
) const override
;
43 nsresult
Add(SMILValue
& aDest
, const SMILValue
& aValueToAdd
,
44 uint32_t aCount
) const override
;
45 nsresult
ComputeDistance(const SMILValue
& aFrom
, const SMILValue
& aTo
,
46 double& aDistance
) const override
;
47 nsresult
Interpolate(const SMILValue
& aStartVal
, const SMILValue
& aEndVal
,
48 double aUnitDistance
, SMILValue
& aResult
) const override
;
51 // Private constructor: prevent instances beyond my singleton.
52 constexpr SVGOrientSMILType() = default;
55 } // namespace mozilla
57 #endif // DOM_SVG_SVGORIENTSMILTYPE_H_