Bug 1936278 - Prevent search mode chiclet from being dismissed when clicking in page...
[gecko.git] / dom / svg / SVGTextPathElement.h
blob8af7ceed2534d910202fddb36221e1c50da59869
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_SVGTEXTPATHELEMENT_H_
8 #define DOM_SVG_SVGTEXTPATHELEMENT_H_
10 #include "SVGAnimatedEnumeration.h"
11 #include "SVGAnimatedLength.h"
12 #include "SVGAnimatedPathSegList.h"
13 #include "SVGAnimatedString.h"
14 #include "mozilla/dom/SVGTextContentElement.h"
16 class nsAtom;
17 class nsIContent;
19 nsresult NS_NewSVGTextPathElement(
20 nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
22 namespace mozilla::dom {
24 // textPath side types
25 static const uint16_t TEXTPATH_SIDETYPE_LEFT = 1;
26 static const uint16_t TEXTPATH_SIDETYPE_RIGHT = 2;
28 using SVGTextPathElementBase = SVGTextContentElement;
30 class SVGTextPathElement final : public SVGTextPathElementBase {
31 friend class mozilla::SVGTextFrame;
33 protected:
34 friend nsresult(::NS_NewSVGTextPathElement(
35 nsIContent** aResult,
36 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
37 explicit SVGTextPathElement(
38 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
39 JSObject* WrapNode(JSContext* cx, JS::Handle<JSObject*> aGivenProto) override;
41 public:
42 // nsIContent interface
43 nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
45 SVGAnimatedPathSegList* GetAnimPathSegList() override { return &mPath; }
47 nsStaticAtom* GetPathDataAttrName() const override { return nsGkAtoms::path; }
49 // WebIDL
50 already_AddRefed<DOMSVGAnimatedLength> StartOffset();
51 already_AddRefed<DOMSVGAnimatedEnumeration> Method();
52 already_AddRefed<DOMSVGAnimatedEnumeration> Spacing();
53 already_AddRefed<DOMSVGAnimatedEnumeration> Side();
54 already_AddRefed<DOMSVGAnimatedString> Href();
56 void HrefAsString(nsAString& aHref);
58 protected:
59 LengthAttributesInfo GetLengthInfo() override;
60 EnumAttributesInfo GetEnumInfo() override;
61 StringAttributesInfo GetStringInfo() override;
63 enum { /* TEXTLENGTH, */ STARTOFFSET = 1 };
64 SVGAnimatedLength mLengthAttributes[2];
65 SVGAnimatedLength* LengthAttributes() override { return mLengthAttributes; }
66 static LengthInfo sLengthInfo[2];
68 enum { /* LENGTHADJUST, */ METHOD = 1, SPACING, SIDE };
69 SVGAnimatedEnumeration mEnumAttributes[4];
70 SVGAnimatedEnumeration* EnumAttributes() override { return mEnumAttributes; }
71 static SVGEnumMapping sMethodMap[];
72 static SVGEnumMapping sSpacingMap[];
73 static SVGEnumMapping sSideMap[];
74 static EnumInfo sEnumInfo[4];
76 enum { HREF, XLINK_HREF };
77 SVGAnimatedString mStringAttributes[2];
78 static StringInfo sStringInfo[2];
80 SVGAnimatedPathSegList mPath;
83 } // namespace mozilla::dom
85 #endif // DOM_SVG_SVGTEXTPATHELEMENT_H_