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_SVGAELEMENT_H_
8 #define DOM_SVG_SVGAELEMENT_H_
11 #include "nsDOMTokenList.h"
12 #include "SVGAnimatedString.h"
13 #include "mozilla/dom/SVGGraphicsElement.h"
15 nsresult
NS_NewSVGAElement(
16 nsIContent
** aResult
, already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
);
20 class EventChainPostVisitor
;
21 class EventChainPreVisitor
;
25 using SVGAElementBase
= SVGGraphicsElement
;
27 class SVGAElement final
: public SVGAElementBase
, public Link
{
29 using Element::GetText
;
31 explicit SVGAElement(already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
);
32 friend nsresult(::NS_NewSVGAElement(
34 already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
));
35 JSObject
* WrapNode(JSContext
* cx
, JS::Handle
<JSObject
*> aGivenProto
) override
;
38 NS_DECL_ISUPPORTS_INHERITED
40 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SVGAElement
, SVGAElementBase
)
42 // nsINode interface methods
43 void GetEventTargetParent(EventChainPreVisitor
& aVisitor
) override
;
45 nsresult
PostHandleEvent(EventChainPostVisitor
& aVisitor
) override
;
46 nsresult
Clone(dom::NodeInfo
*, nsINode
** aResult
) const override
;
49 nsresult
BindToTree(BindContext
&, nsINode
& aParent
) override
;
50 void UnbindFromTree(UnbindContext
&) override
;
52 int32_t TabIndexDefault() override
;
53 Focusable
IsFocusableWithoutStyle(IsFocusableFlags
) override
;
55 void GetLinkTargetImpl(nsAString
& aTarget
) override
;
56 already_AddRefed
<nsIURI
> GetHrefURI() const override
;
59 virtual void AfterSetAttr(int32_t aNameSpaceID
, nsAtom
* aName
,
60 const nsAttrValue
* aValue
,
61 const nsAttrValue
* aOldValue
,
62 nsIPrincipal
* aMaybeScriptedPrincipal
,
63 bool aNotify
) override
;
66 already_AddRefed
<DOMSVGAnimatedString
> Href();
67 already_AddRefed
<DOMSVGAnimatedString
> Target();
68 void GetDownload(nsAString
& aDownload
);
69 void SetDownload(const nsAString
& aDownload
, ErrorResult
& rv
);
70 void GetPing(nsAString
& aPing
);
71 void SetPing(const nsAString
& aPing
, mozilla::ErrorResult
& rv
);
72 void GetRel(nsAString
& aRel
);
73 void SetRel(const nsAString
& aRel
, mozilla::ErrorResult
& rv
);
74 void SetReferrerPolicy(const nsAString
& aPolicy
, mozilla::ErrorResult
& rv
);
75 void GetReferrerPolicy(nsAString
& aPolicy
);
76 nsDOMTokenList
* RelList();
77 void GetHreflang(nsAString
& aHreflang
);
78 void SetHreflang(const nsAString
& aHreflang
, mozilla::ErrorResult
& rv
);
79 void GetType(nsAString
& aType
);
80 void SetType(const nsAString
& aType
, mozilla::ErrorResult
& rv
);
81 void GetText(nsAString
& aText
, mozilla::ErrorResult
& rv
) const;
82 void SetText(const nsAString
& aText
, mozilla::ErrorResult
& rv
);
84 void NodeInfoChanged(Document
* aOldDoc
) final
{
85 ClearHasPendingLinkUpdate();
86 SVGAElementBase::NodeInfoChanged(aOldDoc
);
89 NS_IMPL_FROMNODE_WITH_TAG(SVGAElement
, kNameSpaceID_SVG
, a
)
92 virtual ~SVGAElement() = default;
94 StringAttributesInfo
GetStringInfo() override
;
95 void DidAnimateAttribute(int32_t aNameSpaceID
, nsAtom
* aAttribute
) override
;
97 enum { HREF
, XLINK_HREF
, TARGET
};
98 SVGAnimatedString mStringAttributes
[3];
99 static StringInfo sStringInfo
[3];
101 RefPtr
<nsDOMTokenList
> mRelList
;
105 } // namespace mozilla
107 #endif // DOM_SVG_SVGAELEMENT_H_