Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/HTMLAreaElement.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_HTMLAreaElement_h
8
#define mozilla_dom_HTMLAreaElement_h
9
10
#include "mozilla/Attributes.h"
11
#include "mozilla/dom/Link.h"
12
#include "nsGenericHTMLElement.h"
13
#include "nsGkAtoms.h"
14
#include "nsIURL.h"
15
16
class nsIDocument;
17
18
namespace mozilla {
19
class EventChainPostVisitor;
20
class EventChainPreVisitor;
21
namespace dom {
22
23
class HTMLAreaElement final : public nsGenericHTMLElement,
24
                              public Link
25
{
26
public:
27
  explicit HTMLAreaElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
28
29
  // nsISupports
30
  NS_DECL_ISUPPORTS_INHERITED
31
32
  // CC
33
  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLAreaElement,
34
                                           nsGenericHTMLElement)
35
36
  NS_DECL_ADDSIZEOFEXCLUDINGTHIS
37
38
  NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLAreaElement, area)
39
40
  virtual int32_t TabIndexDefault() override;
41
42
  void GetEventTargetParent(EventChainPreVisitor& aVisitor) override;
43
  virtual nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) override;
44
  virtual bool IsLink(nsIURI** aURI) const override;
45
  virtual void GetLinkTarget(nsAString& aTarget) override;
46
  virtual already_AddRefed<nsIURI> GetHrefURI() const override;
47
48
  virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
49
                              nsIContent* aBindingParent) override;
50
  virtual void UnbindFromTree(bool aDeep = true,
51
                              bool aNullParent = true) override;
52
53
  virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
54
55
  virtual EventStates IntrinsicState() const override;
56
57
  // WebIDL
58
  void GetAlt(DOMString& aValue)
59
0
  {
60
0
    GetHTMLAttr(nsGkAtoms::alt, aValue);
61
0
  }
62
  void SetAlt(const nsAString& aAlt, ErrorResult& aError)
63
0
  {
64
0
    SetHTMLAttr(nsGkAtoms::alt, aAlt, aError);
65
0
  }
66
67
  void GetCoords(DOMString& aValue)
68
0
  {
69
0
    GetHTMLAttr(nsGkAtoms::coords, aValue);
70
0
  }
71
  void SetCoords(const nsAString& aCoords, ErrorResult& aError)
72
0
  {
73
0
    SetHTMLAttr(nsGkAtoms::coords, aCoords, aError);
74
0
  }
75
76
  // argument type nsAString for HTMLImageMapAccessible
77
  void GetShape(nsAString& aValue)
78
0
  {
79
0
    GetHTMLAttr(nsGkAtoms::shape, aValue);
80
0
  }
81
  void SetShape(const nsAString& aShape, ErrorResult& aError)
82
0
  {
83
0
    SetHTMLAttr(nsGkAtoms::shape, aShape, aError);
84
0
  }
85
86
  // argument type nsAString for nsContextMenuInfo
87
  void GetHref(nsAString& aValue)
88
0
  {
89
0
    GetURIAttr(nsGkAtoms::href, nullptr, aValue);
90
0
  }
91
  void SetHref(const nsAString& aHref, ErrorResult& aError)
92
0
  {
93
0
    SetHTMLAttr(nsGkAtoms::href, aHref, aError);
94
0
  }
95
96
  void GetTarget(DOMString& aValue);
97
  void SetTarget(const nsAString& aTarget, ErrorResult& aError)
98
0
  {
99
0
    SetHTMLAttr(nsGkAtoms::target, aTarget, aError);
100
0
  }
101
102
  void GetDownload(DOMString& aValue)
103
0
  {
104
0
    GetHTMLAttr(nsGkAtoms::download, aValue);
105
0
  }
106
  void SetDownload(const nsAString& aDownload, ErrorResult& aError)
107
0
  {
108
0
    SetHTMLAttr(nsGkAtoms::download, aDownload, aError);
109
0
  }
110
111
  void GetPing(DOMString& aValue)
112
0
  {
113
0
    GetHTMLAttr(nsGkAtoms::ping, aValue);
114
0
  }
115
116
  void SetPing(const nsAString& aPing, ErrorResult& aError)
117
0
  {
118
0
    SetHTMLAttr(nsGkAtoms::ping, aPing, aError);
119
0
  }
120
121
  void GetRel(DOMString& aValue)
122
0
  {
123
0
    GetHTMLAttr(nsGkAtoms::rel, aValue);
124
0
  }
125
126
  void SetRel(const nsAString& aRel, ErrorResult& aError)
127
0
  {
128
0
    SetHTMLAttr(nsGkAtoms::rel, aRel, aError);
129
0
  }
130
  nsDOMTokenList* RelList();
131
132
  void SetReferrerPolicy(const nsAString& aValue, mozilla::ErrorResult& rv)
133
0
  {
134
0
    SetHTMLAttr(nsGkAtoms::referrerpolicy, aValue, rv);
135
0
  }
136
  void GetReferrerPolicy(nsAString& aReferrer)
137
0
  {
138
0
    GetEnumAttr(nsGkAtoms::referrerpolicy, EmptyCString().get(), aReferrer);
139
0
  }
140
141
  // The Link::GetOrigin is OK for us
142
143
  // Link::Link::GetProtocol is OK for us
144
  // Link::Link::SetProtocol is OK for us
145
146
  // The Link::GetUsername is OK for us
147
  // The Link::SetUsername is OK for us
148
149
  // The Link::GetPassword is OK for us
150
  // The Link::SetPassword is OK for us
151
152
  // Link::Link::GetHost is OK for us
153
  // Link::Link::SetHost is OK for us
154
155
  // Link::Link::GetHostname is OK for us
156
  // Link::Link::SetHostname is OK for us
157
158
  // Link::Link::GetPort is OK for us
159
  // Link::Link::SetPort is OK for us
160
161
  // Link::Link::GetPathname is OK for us
162
  // Link::Link::SetPathname is OK for us
163
164
  // Link::Link::GetSearch is OK for us
165
  // Link::Link::SetSearch is OK for us
166
167
  // Link::Link::GetHash is OK for us
168
  // Link::Link::SetHash is OK for us
169
170
  // The Link::GetSearchParams is OK for us
171
172
  bool NoHref() const
173
0
  {
174
0
    return GetBoolAttr(nsGkAtoms::nohref);
175
0
  }
176
177
  void SetNoHref(bool aValue, ErrorResult& aError)
178
0
  {
179
0
    SetHTMLBoolAttr(nsGkAtoms::nohref, aValue, aError);
180
0
  }
181
182
  void ToString(nsAString& aSource);
183
  void Stringify(nsAString& aResult)
184
0
  {
185
0
    GetHref(aResult);
186
0
  }
187
188
  void NodeInfoChanged(nsIDocument* aOldDoc) final
189
0
  {
190
0
    ClearHasPendingLinkUpdate();
191
0
    nsGenericHTMLElement::NodeInfoChanged(aOldDoc);
192
0
  }
193
194
protected:
195
  virtual ~HTMLAreaElement();
196
197
  virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
198
199
  virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
200
                                const nsAttrValue* aValue,
201
                                const nsAttrValue* aOldValue,
202
                                nsIPrincipal* aSubjectPrincipal,
203
                                bool aNotify) override;
204
205
  RefPtr<nsDOMTokenList > mRelList;
206
};
207
208
} // namespace dom
209
} // namespace mozilla
210
211
#endif /* mozilla_dom_HTMLAreaElement_h */