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 DOM_SVG_SVGMARKERELEMENT_H_
8 #define DOM_SVG_SVGMARKERELEMENT_H_
10 #include "SVGAnimatedEnumeration.h"
11 #include "SVGAnimatedLength.h"
12 #include "SVGAnimatedOrient.h"
13 #include "SVGAnimatedPreserveAspectRatio.h"
14 #include "SVGAnimatedViewBox.h"
15 #include "mozilla/Attributes.h"
16 #include "mozilla/dom/SVGElement.h"
17 #include "mozilla/dom/SVGMarkerElementBinding.h"
18 #include "mozilla/UniquePtr.h"
20 nsresult
NS_NewSVGMarkerElement(
21 nsIContent
** aResult
, already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
);
30 class DOMSVGAnimatedAngle
;
31 class DOMSVGAnimatedEnumeration
;
33 using SVGMarkerElementBase
= SVGElement
;
35 class SVGMarkerElement final
: public SVGMarkerElementBase
{
36 friend class mozilla::SVGMarkerFrame
;
39 friend nsresult(::NS_NewSVGMarkerElement(
41 already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
));
42 explicit SVGMarkerElement(
43 already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
);
44 JSObject
* WrapNode(JSContext
* cx
, JS::Handle
<JSObject
*> aGivenProto
) override
;
47 // SVGSVGElement methods:
48 bool HasValidDimensions() const override
;
51 gfx::Matrix
GetMarkerTransform(float aStrokeWidth
, const SVGMark
& aMark
);
52 SVGViewBox
GetViewBox();
53 gfx::Matrix
GetViewBoxTransform();
55 nsresult
Clone(dom::NodeInfo
*, nsINode
** aResult
) const override
;
58 already_AddRefed
<SVGAnimatedRect
> ViewBox();
59 already_AddRefed
<DOMSVGAnimatedPreserveAspectRatio
> PreserveAspectRatio();
60 already_AddRefed
<DOMSVGAnimatedLength
> RefX();
61 already_AddRefed
<DOMSVGAnimatedLength
> RefY();
62 already_AddRefed
<DOMSVGAnimatedEnumeration
> MarkerUnits();
63 already_AddRefed
<DOMSVGAnimatedLength
> MarkerWidth();
64 already_AddRefed
<DOMSVGAnimatedLength
> MarkerHeight();
65 already_AddRefed
<DOMSVGAnimatedEnumeration
> OrientType();
66 already_AddRefed
<DOMSVGAnimatedAngle
> OrientAngle();
67 void SetOrientToAuto();
68 void SetOrientToAngle(DOMSVGAngle
& aAngle
);
71 void SetParentCoordCtxProvider(SVGViewportElement
* aContext
);
73 LengthAttributesInfo
GetLengthInfo() override
;
74 EnumAttributesInfo
GetEnumInfo() override
;
75 SVGAnimatedOrient
* GetAnimatedOrient() override
;
76 SVGAnimatedPreserveAspectRatio
* GetAnimatedPreserveAspectRatio() override
;
77 SVGAnimatedViewBox
* GetAnimatedViewBox() override
;
79 enum { REFX
, REFY
, MARKERWIDTH
, MARKERHEIGHT
};
80 SVGAnimatedLength mLengthAttributes
[4];
81 static LengthInfo sLengthInfo
[4];
84 SVGAnimatedEnumeration mEnumAttributes
[1];
85 static SVGEnumMapping sUnitsMap
[];
86 static EnumInfo sEnumInfo
[1];
88 SVGAnimatedOrient mOrient
;
89 SVGAnimatedViewBox mViewBox
;
90 SVGAnimatedPreserveAspectRatio mPreserveAspectRatio
;
92 SVGViewportElement
* mCoordCtx
;
93 UniquePtr
<gfx::Matrix
> mViewBoxToViewportTransform
;
97 } // namespace mozilla
99 #endif // DOM_SVG_SVGMARKERELEMENT_H_