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_DOMSVGANIMATEDBOOLEAN_H_
8 #define DOM_SVG_DOMSVGANIMATEDBOOLEAN_H_
10 #include "SVGAnimatedBoolean.h"
11 #include "nsWrapperCache.h"
12 #include "mozilla/Attributes.h"
13 #include "mozilla/dom/SVGElement.h"
15 namespace mozilla::dom
{
17 class DOMSVGAnimatedBoolean final
: public nsWrapperCache
{
18 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMSVGAnimatedBoolean
)
19 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMSVGAnimatedBoolean
)
21 DOMSVGAnimatedBoolean(SVGAnimatedBoolean
* aVal
, SVGElement
* aSVGElement
)
22 : mVal(aVal
), mSVGElement(aSVGElement
) {}
25 SVGElement
* GetParentObject() const { return mSVGElement
; }
26 JSObject
* WrapObject(JSContext
* aCx
,
27 JS::Handle
<JSObject
*> aGivenProto
) override
;
28 bool BaseVal() const { return mVal
->GetBaseValue(); }
29 void SetBaseVal(bool aValue
) { mVal
->SetBaseValue(aValue
, mSVGElement
); }
30 bool AnimVal() const {
31 mSVGElement
->FlushAnimations();
32 return mVal
->GetAnimValue();
36 ~DOMSVGAnimatedBoolean();
38 SVGAnimatedBoolean
* mVal
; // kept alive because it belongs to content
39 RefPtr
<SVGElement
> mSVGElement
;
42 } // namespace mozilla::dom
44 #endif // DOM_SVG_DOMSVGANIMATEDBOOLEAN_H_