Bug 1635304 [wpt PR 23392] - Remove erroneous named properties object test, a=testonly
[gecko.git] / dom / svg / SVGMarkerElement.h
blobbe46758580bdd8d250b689aaf1bd6c0239c4aeed
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_SVGMarkerElement_h
8 #define mozilla_dom_SVGMarkerElement_h
10 #include "DOMSVGAnimatedAngle.h"
11 #include "DOMSVGAnimatedEnumeration.h"
12 #include "SVGAnimatedEnumeration.h"
13 #include "SVGAnimatedLength.h"
14 #include "SVGAnimatedOrient.h"
15 #include "SVGAnimatedPreserveAspectRatio.h"
16 #include "SVGAnimatedViewBox.h"
17 #include "mozilla/Attributes.h"
18 #include "mozilla/dom/SVGElement.h"
19 #include "mozilla/dom/SVGMarkerElementBinding.h"
20 #include "mozilla/UniquePtr.h"
22 class nsSVGMarkerFrame;
24 nsresult NS_NewSVGMarkerElement(
25 nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
27 namespace mozilla {
29 struct SVGMark;
31 namespace dom {
33 // Non-Exposed Marker Orientation Types
34 static const uint16_t SVG_MARKER_ORIENT_AUTO_START_REVERSE = 3;
36 typedef SVGElement SVGMarkerElementBase;
38 class SVGMarkerElement : public SVGMarkerElementBase {
39 friend class ::nsSVGMarkerFrame;
41 protected:
42 friend nsresult(::NS_NewSVGMarkerElement(
43 nsIContent** aResult,
44 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
45 explicit SVGMarkerElement(
46 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
47 virtual JSObject* WrapNode(JSContext* cx,
48 JS::Handle<JSObject*> aGivenProto) override;
50 public:
51 // nsIContent interface
52 NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* name) const override;
54 // nsSVGSVGElement methods:
55 virtual bool HasValidDimensions() const override;
57 // public helpers
58 gfx::Matrix GetMarkerTransform(float aStrokeWidth, const SVGMark& aMark);
59 SVGViewBox GetViewBox();
60 gfx::Matrix GetViewBoxTransform();
62 virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
64 // WebIDL
65 already_AddRefed<SVGAnimatedRect> ViewBox();
66 already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio();
67 already_AddRefed<DOMSVGAnimatedLength> RefX();
68 already_AddRefed<DOMSVGAnimatedLength> RefY();
69 already_AddRefed<DOMSVGAnimatedEnumeration> MarkerUnits();
70 already_AddRefed<DOMSVGAnimatedLength> MarkerWidth();
71 already_AddRefed<DOMSVGAnimatedLength> MarkerHeight();
72 already_AddRefed<DOMSVGAnimatedEnumeration> OrientType();
73 already_AddRefed<DOMSVGAnimatedAngle> OrientAngle();
74 void SetOrientToAuto();
75 void SetOrientToAngle(DOMSVGAngle& angle, ErrorResult& rv);
77 protected:
78 void SetParentCoordCtxProvider(SVGViewportElement* aContext);
80 virtual LengthAttributesInfo GetLengthInfo() override;
81 virtual EnumAttributesInfo GetEnumInfo() override;
82 virtual SVGAnimatedOrient* GetAnimatedOrient() override;
83 virtual SVGAnimatedPreserveAspectRatio* GetAnimatedPreserveAspectRatio()
84 override;
85 virtual SVGAnimatedViewBox* GetAnimatedViewBox() override;
87 enum { REFX, REFY, MARKERWIDTH, MARKERHEIGHT };
88 SVGAnimatedLength mLengthAttributes[4];
89 static LengthInfo sLengthInfo[4];
91 enum { MARKERUNITS };
92 SVGAnimatedEnumeration mEnumAttributes[1];
93 static SVGEnumMapping sUnitsMap[];
94 static EnumInfo sEnumInfo[1];
96 SVGAnimatedOrient mOrient;
97 SVGAnimatedViewBox mViewBox;
98 SVGAnimatedPreserveAspectRatio mPreserveAspectRatio;
100 SVGViewportElement* mCoordCtx;
101 UniquePtr<gfx::Matrix> mViewBoxToViewportTransform;
104 } // namespace dom
105 } // namespace mozilla
107 #endif // mozilla_dom_SVGMarkerElement_h