Bug 1444460 [wpt PR 9948] - gyroscope: Rename LocalCoordinateSystem to GyroscopeLocal...
[gecko.git] / dom / svg / SVGPathElement.h
blob029274c75d67e11e57e01274e7a04366d8fd28e6
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 mozilla_dom_SVGPathElement_h
8 #define mozilla_dom_SVGPathElement_h
10 #include "mozilla/gfx/2D.h"
11 #include "mozilla/RefPtr.h"
12 #include "SVGAnimatedPathSegList.h"
13 #include "SVGGeometryElement.h"
14 #include "DOMSVGPathSeg.h"
16 nsresult NS_NewSVGPathElement(nsIContent **aResult,
17 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
19 namespace mozilla {
21 class nsISVGPoint;
23 namespace dom {
25 typedef SVGGeometryElement SVGPathElementBase;
27 class SVGPathElement final : public SVGPathElementBase
29 typedef mozilla::gfx::Path Path;
31 protected:
32 friend nsresult (::NS_NewSVGPathElement(nsIContent **aResult,
33 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
34 virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
35 explicit SVGPathElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
37 public:
38 NS_DECL_ADDSIZEOFEXCLUDINGTHIS
40 // nsIContent interface
41 NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* name) const override;
43 // nsSVGSVGElement methods:
44 virtual bool HasValidDimensions() const override;
46 // SVGGeometryElement methods:
47 virtual bool AttributeDefinesGeometry(const nsAtom *aName) override;
48 virtual bool IsMarkable() override;
49 virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) override;
50 virtual already_AddRefed<Path> BuildPath(PathBuilder* aBuilder) override;
52 /**
53 * This returns a path without the extra little line segments that
54 * ApproximateZeroLengthSubpathSquareCaps can insert if we have square-caps.
55 * See the comment for that function for more info on that.
57 virtual already_AddRefed<Path> GetOrBuildPathForMeasuring() override;
59 // nsIContent interface
60 virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
61 bool aPreallocateChildren) const override;
63 virtual SVGAnimatedPathSegList* GetAnimPathSegList() override {
64 return &mD;
67 virtual nsAtom* GetPathDataAttrName() const override {
68 return nsGkAtoms::d;
71 // WebIDL
72 uint32_t GetPathSegAtLength(float distance);
73 already_AddRefed<DOMSVGPathSegClosePath> CreateSVGPathSegClosePath();
74 already_AddRefed<DOMSVGPathSegMovetoAbs> CreateSVGPathSegMovetoAbs(float x, float y);
75 already_AddRefed<DOMSVGPathSegMovetoRel> CreateSVGPathSegMovetoRel(float x, float y);
76 already_AddRefed<DOMSVGPathSegLinetoAbs> CreateSVGPathSegLinetoAbs(float x, float y);
77 already_AddRefed<DOMSVGPathSegLinetoRel> CreateSVGPathSegLinetoRel(float x, float y);
78 already_AddRefed<DOMSVGPathSegCurvetoCubicAbs>
79 CreateSVGPathSegCurvetoCubicAbs(float x, float y, float x1, float y1, float x2, float y2);
80 already_AddRefed<DOMSVGPathSegCurvetoCubicRel>
81 CreateSVGPathSegCurvetoCubicRel(float x, float y, float x1, float y1, float x2, float y2);
82 already_AddRefed<DOMSVGPathSegCurvetoQuadraticAbs>
83 CreateSVGPathSegCurvetoQuadraticAbs(float x, float y, float x1, float y1);
84 already_AddRefed<DOMSVGPathSegCurvetoQuadraticRel>
85 CreateSVGPathSegCurvetoQuadraticRel(float x, float y, float x1, float y1);
86 already_AddRefed<DOMSVGPathSegArcAbs>
87 CreateSVGPathSegArcAbs(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag);
88 already_AddRefed<DOMSVGPathSegArcRel>
89 CreateSVGPathSegArcRel(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag);
90 already_AddRefed<DOMSVGPathSegLinetoHorizontalAbs> CreateSVGPathSegLinetoHorizontalAbs(float x);
91 already_AddRefed<DOMSVGPathSegLinetoHorizontalRel> CreateSVGPathSegLinetoHorizontalRel(float x);
92 already_AddRefed<DOMSVGPathSegLinetoVerticalAbs> CreateSVGPathSegLinetoVerticalAbs(float y);
93 already_AddRefed<DOMSVGPathSegLinetoVerticalRel> CreateSVGPathSegLinetoVerticalRel(float y);
94 already_AddRefed<DOMSVGPathSegCurvetoCubicSmoothAbs>
95 CreateSVGPathSegCurvetoCubicSmoothAbs(float x, float y, float x2, float y2);
96 already_AddRefed<DOMSVGPathSegCurvetoCubicSmoothRel>
97 CreateSVGPathSegCurvetoCubicSmoothRel(float x, float y, float x2, float y2);
98 already_AddRefed<DOMSVGPathSegCurvetoQuadraticSmoothAbs>
99 CreateSVGPathSegCurvetoQuadraticSmoothAbs(float x, float y);
100 already_AddRefed<DOMSVGPathSegCurvetoQuadraticSmoothRel>
101 CreateSVGPathSegCurvetoQuadraticSmoothRel(float x, float y);
102 already_AddRefed<DOMSVGPathSegList> PathSegList();
103 already_AddRefed<DOMSVGPathSegList> AnimatedPathSegList();
105 protected:
107 SVGAnimatedPathSegList mD;
110 } // namespace dom
111 } // namespace mozilla
113 #endif // mozilla_dom_SVGPathElement_h