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 DOM_SVG_DOMSVGANIMATEDLENGTH_H_
8 #define DOM_SVG_DOMSVGANIMATEDLENGTH_H_
9 
10 #include "mozilla/Attributes.h"
11 #include "SVGElement.h"
12 
13 namespace mozilla {
14 
15 class SVGAnimatedLength;
16 
17 namespace dom {
18 
19 class DOMSVGLength;
20 
21 class DOMSVGAnimatedLength final : public nsWrapperCache {
22  public:
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMSVGAnimatedLength)23   NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMSVGAnimatedLength)
24   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMSVGAnimatedLength)
25 
26   DOMSVGAnimatedLength(SVGAnimatedLength* aVal, SVGElement* aSVGElement)
27       : mVal(aVal), mSVGElement(aSVGElement) {}
28 
29   // WebIDL
GetParentObject()30   SVGElement* GetParentObject() { return mSVGElement; }
31   virtual JSObject* WrapObject(JSContext* aCx,
32                                JS::Handle<JSObject*> aGivenProto) override;
33   already_AddRefed<DOMSVGLength> BaseVal();
34   already_AddRefed<DOMSVGLength> AnimVal();
35 
36  protected:
37   ~DOMSVGAnimatedLength();
38 
39   SVGAnimatedLength* mVal;  // kept alive because it belongs to content
40   RefPtr<SVGElement> mSVGElement;
41 };
42 
43 }  // namespace dom
44 }  // namespace mozilla
45 
46 #endif  // DOM_SVG_DOMSVGANIMATEDLENGTH_H_
47