Line data Source code
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_SVGTextPathElement_h
8 : #define mozilla_dom_SVGTextPathElement_h
9 :
10 : #include "nsSVGEnum.h"
11 : #include "nsSVGLength2.h"
12 : #include "nsSVGString.h"
13 : #include "mozilla/dom/SVGTextContentElement.h"
14 :
15 : class nsIAtom;
16 : class nsIContent;
17 :
18 : nsresult NS_NewSVGTextPathElement(nsIContent **aResult,
19 : already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
20 :
21 : namespace mozilla {
22 : namespace dom {
23 :
24 : // textPath Method Types
25 : static const unsigned short TEXTPATH_METHODTYPE_UNKNOWN = 0;
26 : static const unsigned short TEXTPATH_METHODTYPE_ALIGN = 1;
27 : static const unsigned short TEXTPATH_METHODTYPE_STRETCH = 2;
28 : // textPath Spacing Types
29 : static const unsigned short TEXTPATH_SPACINGTYPE_UNKNOWN = 0;
30 : static const unsigned short TEXTPATH_SPACINGTYPE_AUTO = 1;
31 : static const unsigned short TEXTPATH_SPACINGTYPE_EXACT = 2;
32 :
33 : typedef SVGTextContentElement SVGTextPathElementBase;
34 :
35 0 : class SVGTextPathElement final : public SVGTextPathElementBase
36 : {
37 : friend class ::SVGTextFrame;
38 :
39 : protected:
40 : friend nsresult (::NS_NewSVGTextPathElement(nsIContent **aResult,
41 : already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
42 : explicit SVGTextPathElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
43 : virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
44 :
45 : public:
46 : // nsIContent interface
47 : NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
48 :
49 : virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
50 : bool aPreallocateChildren) const override;
51 :
52 : // WebIDL
53 : already_AddRefed<SVGAnimatedLength> StartOffset();
54 : already_AddRefed<SVGAnimatedEnumeration> Method();
55 : already_AddRefed<SVGAnimatedEnumeration> Spacing();
56 : already_AddRefed<SVGAnimatedString> Href();
57 :
58 : protected:
59 :
60 : virtual LengthAttributesInfo GetLengthInfo() override;
61 : virtual EnumAttributesInfo GetEnumInfo() override;
62 : virtual StringAttributesInfo GetStringInfo() override;
63 :
64 : enum { /* TEXTLENGTH, */ STARTOFFSET = 1 };
65 : nsSVGLength2 mLengthAttributes[2];
66 0 : virtual nsSVGLength2* LengthAttributes() override
67 0 : { return mLengthAttributes; }
68 : static LengthInfo sLengthInfo[2];
69 :
70 : enum { /* LENGTHADJUST, */ METHOD = 1, SPACING };
71 : nsSVGEnum mEnumAttributes[3];
72 0 : virtual nsSVGEnum* EnumAttributes() override
73 0 : { return mEnumAttributes; }
74 : static nsSVGEnumMapping sMethodMap[];
75 : static nsSVGEnumMapping sSpacingMap[];
76 : static EnumInfo sEnumInfo[3];
77 :
78 : enum { HREF, XLINK_HREF };
79 : nsSVGString mStringAttributes[2];
80 : static StringInfo sStringInfo[2];
81 : };
82 :
83 : } // namespace dom
84 : } // namespace mozilla
85 :
86 : #endif // mozilla_dom_SVGTextPathElement_h
|