SVGAnimatedRect.h (1470B)
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_SVGANIMATEDRECT_H_ 8 #define DOM_SVG_SVGANIMATEDRECT_H_ 9 10 #include "mozilla/dom/SVGElement.h" 11 #include "nsCycleCollectionParticipant.h" 12 #include "nsWrapperCache.h" 13 14 namespace mozilla { 15 16 class SVGAnimatedViewBox; 17 18 namespace dom { 19 20 class SVGRect; 21 22 // Despite the name of this class appearing to be generic, 23 // SVGAnimatedRect is only used for viewBox attributes. 24 25 class SVGAnimatedRect final : public nsWrapperCache { 26 public: 27 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(SVGAnimatedRect) 28 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(SVGAnimatedRect) 29 30 SVGAnimatedRect(SVGAnimatedViewBox* aVal, SVGElement* aSVGElement); 31 32 SVGElement* GetParentObject() const { return mSVGElement; } 33 34 JSObject* WrapObject(JSContext* aCx, 35 JS::Handle<JSObject*> aGivenProto) override; 36 37 already_AddRefed<SVGRect> GetBaseVal(); 38 39 already_AddRefed<SVGRect> GetAnimVal(); 40 41 private: 42 virtual ~SVGAnimatedRect(); 43 44 SVGAnimatedViewBox* mVal; // kept alive because it belongs to content 45 RefPtr<SVGElement> mSVGElement; 46 }; 47 48 } // namespace dom 49 } // namespace mozilla 50 51 #endif // DOM_SVG_SVGANIMATEDRECT_H_