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 __NS_SVGCLASS_H__
8 #define __NS_SVGCLASS_H__
10 #include "nsAutoPtr.h"
11 #include "nsCycleCollectionParticipant.h"
13 #include "nsISMILAttr.h"
15 #include "mozilla/Attributes.h"
16 #include "mozilla/UniquePtr.h"
22 class SVGAnimatedString
;
24 } // namespace mozilla
34 void SetBaseValue(const nsAString
& aValue
,
35 nsSVGElement
*aSVGElement
,
37 void GetBaseValue(nsAString
& aValue
, const nsSVGElement
*aSVGElement
) const;
39 void SetAnimValue(const nsAString
& aValue
, nsSVGElement
*aSVGElement
);
40 void GetAnimValue(nsAString
& aValue
, const nsSVGElement
*aSVGElement
) const;
41 bool IsAnimated() const
42 { return !!mAnimVal
; }
44 already_AddRefed
<mozilla::dom::SVGAnimatedString
>
45 ToDOMAnimatedString(nsSVGElement
* aSVGElement
);
47 mozilla::UniquePtr
<nsISMILAttr
> ToSMILAttr(nsSVGElement
*aSVGElement
);
51 nsAutoPtr
<nsString
> mAnimVal
;
54 struct SMILString
: public nsISMILAttr
57 SMILString(nsSVGClass
*aVal
, nsSVGElement
*aSVGElement
)
58 : mVal(aVal
), mSVGElement(aSVGElement
) {}
60 // These will stay alive because a nsISMILAttr only lives as long
61 // as the Compositing step, and DOM elements don't get a chance to
64 nsSVGElement
* mSVGElement
;
66 // nsISMILAttr methods
67 virtual nsresult
ValueFromString(const nsAString
& aStr
,
68 const mozilla::dom::SVGAnimationElement
*aSrcElement
,
70 bool& aPreventCachingOfSandwich
) const override
;
71 virtual nsSMILValue
GetBaseValue() const override
;
72 virtual void ClearAnimValue() override
;
73 virtual nsresult
SetAnimValue(const nsSMILValue
& aValue
) override
;
76 #endif //__NS_SVGCLASS_H__