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_SVGCircleElement_h 8 #define mozilla_dom_SVGCircleElement_h 9 10 #include "nsSVGPathGeometryElement.h" 11 #include "nsSVGLength2.h" 12 13 nsresult NS_NewSVGCircleElement(nsIContent **aResult, 14 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo); 15 16 typedef nsSVGPathGeometryElement SVGCircleElementBase; 17 18 namespace mozilla { 19 namespace dom { 20 21 class SVGCircleElement final : public SVGCircleElementBase 22 { 23 protected: 24 explicit SVGCircleElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo); 25 virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override; 26 friend nsresult (::NS_NewSVGCircleElement(nsIContent **aResult, 27 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)); 28 29 public: 30 // nsSVGSVGElement methods: 31 virtual bool HasValidDimensions() const override; 32 33 // nsSVGPathGeometryElement methods: 34 virtual bool GetGeometryBounds(Rect* aBounds, const StrokeOptions& aStrokeOptions, 35 const Matrix& aToBoundsSpace, 36 const Matrix* aToNonScalingStrokeSpace = nullptr) override; 37 virtual already_AddRefed<Path> BuildPath(PathBuilder* aBuilder) override; 38 39 virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override; 40 41 // WebIDL 42 already_AddRefed<SVGAnimatedLength> Cx(); 43 already_AddRefed<SVGAnimatedLength> Cy(); 44 already_AddRefed<SVGAnimatedLength> R(); 45 46 protected: 47 48 virtual LengthAttributesInfo GetLengthInfo() override; 49 50 enum { ATTR_CX, ATTR_CY, ATTR_R }; 51 nsSVGLength2 mLengthAttributes[3]; 52 static LengthInfo sLengthInfo[3]; 53 }; 54 55 } // namespace dom 56 } // namespace mozilla 57 58 #endif // mozilla_dom_SVGCircleElement_h 59