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_SVGTextPathElement_h
8 #define mozilla_dom_SVGTextPathElement_h
10 #include "SVGAnimatedEnumeration.h"
11 #include "SVGAnimatedLength.h"
12 #include "SVGAnimatedPathSegList.h"
13 #include "SVGAnimatedString.h"
14 #include "mozilla/dom/SVGTextContentElement.h"
19 nsresult
NS_NewSVGTextPathElement(
20 nsIContent
** aResult
, already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
);
25 // textPath side types
26 static const uint16_t TEXTPATH_SIDETYPE_LEFT
= 1;
27 static const uint16_t TEXTPATH_SIDETYPE_RIGHT
= 2;
29 typedef SVGTextContentElement SVGTextPathElementBase
;
31 class SVGTextPathElement final
: public SVGTextPathElementBase
{
32 friend class ::SVGTextFrame
;
35 friend nsresult(::NS_NewSVGTextPathElement(
37 already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
));
38 explicit SVGTextPathElement(
39 already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
);
40 virtual JSObject
* WrapNode(JSContext
* cx
,
41 JS::Handle
<JSObject
*> aGivenProto
) override
;
44 // nsIContent interface
45 NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom
* aAttribute
) const override
;
47 virtual nsresult
Clone(dom::NodeInfo
*, nsINode
** aResult
) const override
;
49 SVGAnimatedPathSegList
* GetAnimPathSegList() override
{ return &mPath
; }
51 nsStaticAtom
* GetPathDataAttrName() const override
{ return nsGkAtoms::path
; }
54 already_AddRefed
<DOMSVGAnimatedLength
> StartOffset();
55 already_AddRefed
<DOMSVGAnimatedEnumeration
> Method();
56 already_AddRefed
<DOMSVGAnimatedEnumeration
> Spacing();
57 already_AddRefed
<DOMSVGAnimatedEnumeration
> Side();
58 already_AddRefed
<DOMSVGAnimatedString
> Href();
60 void HrefAsString(nsAString
& aHref
);
63 virtual LengthAttributesInfo
GetLengthInfo() override
;
64 virtual EnumAttributesInfo
GetEnumInfo() override
;
65 virtual StringAttributesInfo
GetStringInfo() override
;
67 enum { /* TEXTLENGTH, */ STARTOFFSET
= 1 };
68 SVGAnimatedLength mLengthAttributes
[2];
69 virtual SVGAnimatedLength
* LengthAttributes() override
{
70 return mLengthAttributes
;
72 static LengthInfo sLengthInfo
[2];
74 enum { /* LENGTHADJUST, */ METHOD
= 1, SPACING
, SIDE
};
75 SVGAnimatedEnumeration mEnumAttributes
[4];
76 virtual SVGAnimatedEnumeration
* EnumAttributes() override
{
77 return mEnumAttributes
;
79 static SVGEnumMapping sMethodMap
[];
80 static SVGEnumMapping sSpacingMap
[];
81 static SVGEnumMapping sSideMap
[];
82 static EnumInfo sEnumInfo
[4];
84 enum { HREF
, XLINK_HREF
};
85 SVGAnimatedString mStringAttributes
[2];
86 static StringInfo sStringInfo
[2];
88 SVGAnimatedPathSegList mPath
;
92 } // namespace mozilla
94 #endif // mozilla_dom_SVGTextPathElement_h