/src/mozilla-central/dom/svg/SVGAnimatedBoolean.h
Line | Count | Source (jump to first uncovered line) |
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 mozilla_dom_SVGAnimatedBoolean_h |
8 | | #define mozilla_dom_SVGAnimatedBoolean_h |
9 | | |
10 | | #include "nsWrapperCache.h" |
11 | | #include "nsSVGElement.h" |
12 | | #include "mozilla/Attributes.h" |
13 | | #include "nsSVGBoolean.h" |
14 | | |
15 | | namespace mozilla { |
16 | | namespace dom { |
17 | | |
18 | | class SVGAnimatedBoolean final : public nsWrapperCache |
19 | | { |
20 | | NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(SVGAnimatedBoolean) |
21 | | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(SVGAnimatedBoolean) |
22 | | |
23 | | SVGAnimatedBoolean(nsSVGBoolean* aVal, nsSVGElement *aSVGElement) |
24 | | : mVal(aVal), mSVGElement(aSVGElement) |
25 | 0 | { |
26 | 0 | } |
27 | | |
28 | | // WebIDL |
29 | | nsSVGElement* GetParentObject() const { return mSVGElement; } |
30 | | virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; |
31 | | bool BaseVal() const { return mVal->GetBaseValue(); } |
32 | | void SetBaseVal(bool aValue) { mVal->SetBaseValue(aValue, mSVGElement); } |
33 | | bool AnimVal() const { mSVGElement->FlushAnimations(); return mVal->GetAnimValue(); } |
34 | | |
35 | | protected: |
36 | | ~SVGAnimatedBoolean(); |
37 | | |
38 | | nsSVGBoolean* mVal; // kept alive because it belongs to content |
39 | | RefPtr<nsSVGElement> mSVGElement; |
40 | | }; |
41 | | |
42 | | } //namespace dom |
43 | | } //namespace mozilla |
44 | | |
45 | | #endif // mozilla_dom_SVGAnimatedBoolean_h |