Bug 1444460 [wpt PR 9948] - gyroscope: Rename LocalCoordinateSystem to GyroscopeLocal...
[gecko.git] / dom / svg / nsSVGClass.h
blobe0506e78d030c0d9dc06074707351801edeba3b4
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"
12 #include "nsError.h"
13 #include "nsISMILAttr.h"
14 #include "nsString.h"
15 #include "mozilla/Attributes.h"
16 #include "mozilla/UniquePtr.h"
18 class nsSVGElement;
20 namespace mozilla {
21 namespace dom {
22 class SVGAnimatedString;
23 } // namespace dom
24 } // namespace mozilla
26 class nsSVGClass
29 public:
30 void Init() {
31 mAnimVal = nullptr;
34 void SetBaseValue(const nsAString& aValue,
35 nsSVGElement *aSVGElement,
36 bool aDoSetAttr);
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);
49 private:
51 nsAutoPtr<nsString> mAnimVal;
53 public:
54 struct SMILString : public nsISMILAttr
56 public:
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
62 // die during that.
63 nsSVGClass* mVal;
64 nsSVGElement* mSVGElement;
66 // nsISMILAttr methods
67 virtual nsresult ValueFromString(const nsAString& aStr,
68 const mozilla::dom::SVGAnimationElement *aSrcElement,
69 nsSMILValue& aValue,
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__