/work/obj-fuzz/dist/include/mozilla/dom/HTMLBodyElement.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 | | #ifndef HTMLBodyElement_h___ |
7 | | #define HTMLBodyElement_h___ |
8 | | |
9 | | #include "mozilla/Attributes.h" |
10 | | #include "nsGenericHTMLElement.h" |
11 | | |
12 | | namespace mozilla { |
13 | | |
14 | | class TextEditor; |
15 | | |
16 | | namespace dom { |
17 | | |
18 | | class OnBeforeUnloadEventHandlerNonNull; |
19 | | |
20 | | class HTMLBodyElement final : public nsGenericHTMLElement |
21 | | { |
22 | | public: |
23 | | using Element::GetText; |
24 | | |
25 | | explicit HTMLBodyElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) |
26 | | : nsGenericHTMLElement(std::move(aNodeInfo)) |
27 | 0 | { |
28 | 0 | } |
29 | | |
30 | | // nsISupports |
31 | | NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLBodyElement, nsGenericHTMLElement) |
32 | | |
33 | | NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLBodyElement, body); |
34 | | |
35 | | // Event listener stuff; we need to declare only the ones we need to |
36 | | // forward to window that don't come from nsIDOMHTMLBodyElement. |
37 | | #define EVENT(name_, id_, type_, struct_) /* nothing; handled by the shim */ |
38 | | #define WINDOW_EVENT_HELPER(name_, type_) \ |
39 | | type_* GetOn##name_(); \ |
40 | | void SetOn##name_(type_* handler); |
41 | | #define WINDOW_EVENT(name_, id_, type_, struct_) \ |
42 | | WINDOW_EVENT_HELPER(name_, EventHandlerNonNull) |
43 | | #define BEFOREUNLOAD_EVENT(name_, id_, type_, struct_) \ |
44 | | WINDOW_EVENT_HELPER(name_, OnBeforeUnloadEventHandlerNonNull) |
45 | | #include "mozilla/EventNameList.h" // IWYU pragma: keep |
46 | | #undef BEFOREUNLOAD_EVENT |
47 | | #undef WINDOW_EVENT |
48 | | #undef WINDOW_EVENT_HELPER |
49 | | #undef EVENT |
50 | | |
51 | | void GetText(nsAString& aText) |
52 | 0 | { |
53 | 0 | GetHTMLAttr(nsGkAtoms::text, aText); |
54 | 0 | } |
55 | | void SetText(const nsAString& aText) |
56 | 0 | { |
57 | 0 | SetHTMLAttr(nsGkAtoms::text, aText); |
58 | 0 | } |
59 | | void SetText(const nsAString& aText, ErrorResult& aError) |
60 | 0 | { |
61 | 0 | SetHTMLAttr(nsGkAtoms::text, aText, aError); |
62 | 0 | } |
63 | | void GetLink(nsAString& aLink) |
64 | 0 | { |
65 | 0 | GetHTMLAttr(nsGkAtoms::link, aLink); |
66 | 0 | } |
67 | | void SetLink(const nsAString& aLink) |
68 | 0 | { |
69 | 0 | SetHTMLAttr(nsGkAtoms::link, aLink); |
70 | 0 | } |
71 | | void SetLink(const nsAString& aLink, ErrorResult& aError) |
72 | 0 | { |
73 | 0 | SetHTMLAttr(nsGkAtoms::link, aLink, aError); |
74 | 0 | } |
75 | | void GetVLink(nsAString& aVLink) |
76 | 0 | { |
77 | 0 | GetHTMLAttr(nsGkAtoms::vlink, aVLink); |
78 | 0 | } |
79 | | void SetVLink(const nsAString& aVLink) |
80 | 0 | { |
81 | 0 | SetHTMLAttr(nsGkAtoms::vlink, aVLink); |
82 | 0 | } |
83 | | void SetVLink(const nsAString& aVLink, ErrorResult& aError) |
84 | 0 | { |
85 | 0 | SetHTMLAttr(nsGkAtoms::vlink, aVLink, aError); |
86 | 0 | } |
87 | | void GetALink(nsAString& aALink) |
88 | 0 | { |
89 | 0 | GetHTMLAttr(nsGkAtoms::alink, aALink); |
90 | 0 | } |
91 | | void SetALink(const nsAString& aALink) |
92 | 0 | { |
93 | 0 | SetHTMLAttr(nsGkAtoms::alink, aALink); |
94 | 0 | } |
95 | | void SetALink(const nsAString& aALink, ErrorResult& aError) |
96 | 0 | { |
97 | 0 | SetHTMLAttr(nsGkAtoms::alink, aALink, aError); |
98 | 0 | } |
99 | | void GetBgColor(nsAString& aBgColor) |
100 | 0 | { |
101 | 0 | GetHTMLAttr(nsGkAtoms::bgcolor, aBgColor); |
102 | 0 | } |
103 | | void SetBgColor(const nsAString& aBgColor) |
104 | 0 | { |
105 | 0 | SetHTMLAttr(nsGkAtoms::bgcolor, aBgColor); |
106 | 0 | } |
107 | | void SetBgColor(const nsAString& aBgColor, ErrorResult& aError) |
108 | 0 | { |
109 | 0 | SetHTMLAttr(nsGkAtoms::bgcolor, aBgColor, aError); |
110 | 0 | } |
111 | | void GetBackground(DOMString& aBackground) |
112 | 0 | { |
113 | 0 | GetHTMLAttr(nsGkAtoms::background, aBackground); |
114 | 0 | } |
115 | | void GetBackground(nsAString& aBackground) |
116 | 0 | { |
117 | 0 | GetHTMLAttr(nsGkAtoms::background, aBackground); |
118 | 0 | } |
119 | | void SetBackground(const nsAString& aBackground, ErrorResult& aError) |
120 | 0 | { |
121 | 0 | SetHTMLAttr(nsGkAtoms::background, aBackground, aError); |
122 | 0 | } |
123 | | |
124 | | virtual bool ParseAttribute(int32_t aNamespaceID, |
125 | | nsAtom* aAttribute, |
126 | | const nsAString& aValue, |
127 | | nsIPrincipal* aMaybeScriptedPrincipal, |
128 | | nsAttrValue& aResult) override; |
129 | | virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override; |
130 | | NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override; |
131 | | virtual already_AddRefed<TextEditor> GetAssociatedEditor() override; |
132 | | virtual nsresult Clone(dom::NodeInfo*, nsINode **aResult) const override; |
133 | | |
134 | | virtual bool IsEventAttributeNameInternal(nsAtom* aName) override; |
135 | | |
136 | | |
137 | | virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent, |
138 | | nsIContent* aBindingParent) override; |
139 | | /** |
140 | | * Called when an attribute has just been changed |
141 | | */ |
142 | | virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName, |
143 | | const nsAttrValue* aValue, |
144 | | const nsAttrValue* aOldValue, |
145 | | nsIPrincipal* aSubjectPrincipal, |
146 | | bool aNotify) override; |
147 | | |
148 | | protected: |
149 | | virtual ~HTMLBodyElement(); |
150 | | |
151 | | virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override; |
152 | | |
153 | | private: |
154 | | static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes, |
155 | | MappedDeclarations&); |
156 | | }; |
157 | | |
158 | | } // namespace dom |
159 | | } // namespace mozilla |
160 | | |
161 | | #endif /* HTMLBodyElement_h___ */ |