Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/SVGAElement.h
Line
Count
Source (jump to first uncovered line)
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_SVGAElement_h
8
#define mozilla_dom_SVGAElement_h
9
10
#include "Link.h"
11
#include "nsDOMTokenList.h"
12
#include "nsSVGString.h"
13
#include "mozilla/dom/SVGGraphicsElement.h"
14
15
nsresult NS_NewSVGAElement(nsIContent **aResult,
16
                           already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
17
18
namespace mozilla {
19
20
class EventChainPostVisitor;
21
class EventChainPreVisitor;
22
23
namespace dom {
24
25
typedef SVGGraphicsElement SVGAElementBase;
26
27
class SVGAElement final : public SVGAElementBase,
28
                          public Link
29
{
30
protected:
31
  using Element::GetText;
32
33
  explicit SVGAElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
34
  friend nsresult (::NS_NewSVGAElement(nsIContent **aResult,
35
                                       already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
36
  virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
37
38
public:
39
  NS_DECL_ISUPPORTS_INHERITED
40
41
  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SVGAElement, SVGAElementBase)
42
43
  // nsINode interface methods
44
  void GetEventTargetParent(EventChainPreVisitor& aVisitor) override;
45
  virtual nsresult PostHandleEvent(
46
                     EventChainPostVisitor& aVisitor) override;
47
  virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
48
49
  // nsIContent
50
  virtual nsresult BindToTree(nsIDocument *aDocument, nsIContent *aParent,
51
                              nsIContent *aBindingParent) override;
52
  virtual void UnbindFromTree(bool aDeep = true,
53
                              bool aNullParent = true) override;
54
  NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
55
  virtual int32_t TabIndexDefault() override;
56
  virtual bool IsSVGFocusable(bool* aIsFocusable, int32_t* aTabIndex) override;
57
  virtual bool IsLink(nsIURI** aURI) const override;
58
  virtual void GetLinkTarget(nsAString& aTarget) override;
59
  virtual already_AddRefed<nsIURI> GetHrefURI() const override;
60
  virtual EventStates IntrinsicState() const override;
61
  virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
62
                                const nsAttrValue* aValue,
63
                                const nsAttrValue* aOldValue,
64
                                nsIPrincipal* aMaybeScriptedPrincipal,
65
                                bool aNotify) override;
66
67
  // Link
68
  virtual bool ElementHasHref() const override;
69
70
  // WebIDL
71
  already_AddRefed<SVGAnimatedString> Href();
72
  already_AddRefed<SVGAnimatedString> Target();
73
  void GetDownload(nsAString& aDownload);
74
  void SetDownload(const nsAString& aDownload, ErrorResult& rv);
75
  void GetPing(nsAString& aPing);
76
  void SetPing(const nsAString& aPing, mozilla::ErrorResult& rv);
77
  void GetRel(nsAString& aRel);
78
  void SetRel(const nsAString& aRel, mozilla::ErrorResult& rv);
79
  void SetReferrerPolicy(const nsAString& aReferrerPolicy, mozilla::ErrorResult& rv);
80
  void GetReferrerPolicy(nsAString& aReferrerPolicy);
81
  nsDOMTokenList* RelList();
82
  void GetHreflang(nsAString& aHreflang);
83
  void SetHreflang(const nsAString& aHreflang, mozilla::ErrorResult& rv);
84
  void GetType(nsAString& aType);
85
  void SetType(const nsAString& aType, mozilla::ErrorResult& rv);
86
  void GetText(nsAString& aText, mozilla::ErrorResult& rv);
87
  void SetText(const nsAString& aText, mozilla::ErrorResult& rv);
88
89
  void NodeInfoChanged(nsIDocument* aOldDoc) final
90
0
  {
91
0
    ClearHasPendingLinkUpdate();
92
0
    SVGAElementBase::NodeInfoChanged(aOldDoc);
93
0
  }
94
95
protected:
96
  virtual ~SVGAElement();
97
98
  virtual StringAttributesInfo GetStringInfo() override;
99
100
  enum { HREF, XLINK_HREF, TARGET };
101
  nsSVGString mStringAttributes[3];
102
  static StringInfo sStringInfo[3];
103
104
  RefPtr<nsDOMTokenList> mRelList;
105
  static DOMTokenListSupportedToken sSupportedRelValues[];
106
};
107
108
} // namespace dom
109
} // namespace mozilla
110
111
#endif // mozilla_dom_SVGAElement_h