/work/obj-fuzz/dist/include/mozilla/dom/HTMLEmbedElement.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_HTMLEmbedElement_h |
8 | | #define mozilla_dom_HTMLEmbedElement_h |
9 | | |
10 | | #include "mozilla/Attributes.h" |
11 | | #include "nsGenericHTMLElement.h" |
12 | | #include "nsObjectLoadingContent.h" |
13 | | #include "nsGkAtoms.h" |
14 | | #include "nsError.h" |
15 | | |
16 | | namespace mozilla { |
17 | | namespace dom { |
18 | | |
19 | | class HTMLEmbedElement final : public nsGenericHTMLElement |
20 | | , public nsObjectLoadingContent |
21 | | { |
22 | | public: |
23 | | explicit HTMLEmbedElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, |
24 | | mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER); |
25 | | |
26 | | // nsISupports |
27 | | NS_DECL_ISUPPORTS_INHERITED |
28 | | NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLEmbedElement, embed) |
29 | | virtual int32_t TabIndexDefault() override; |
30 | | |
31 | | #ifdef XP_MACOSX |
32 | | // EventTarget |
33 | | NS_IMETHOD PostHandleEvent(EventChainPostVisitor& aVisitor) override; |
34 | | #endif |
35 | | |
36 | | // EventTarget |
37 | | virtual void AsyncEventRunning(AsyncEventDispatcher* aEvent) override; |
38 | | |
39 | | virtual nsresult BindToTree(nsIDocument *aDocument, nsIContent *aParent, |
40 | | nsIContent *aBindingParent) override; |
41 | | virtual void UnbindFromTree(bool aDeep = true, |
42 | | bool aNullParent = true) override; |
43 | | |
44 | | virtual bool IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, int32_t *aTabIndex) override; |
45 | | virtual IMEState GetDesiredIMEState() override; |
46 | | |
47 | | virtual bool ParseAttribute(int32_t aNamespaceID, |
48 | | nsAtom *aAttribute, |
49 | | const nsAString &aValue, |
50 | | nsIPrincipal* aMaybeScriptedPrincipal, |
51 | | nsAttrValue &aResult) override; |
52 | | virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override; |
53 | | NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom *aAttribute) const override; |
54 | | virtual EventStates IntrinsicState() const override; |
55 | | virtual void DestroyContent() override; |
56 | | |
57 | | // nsObjectLoadingContent |
58 | | virtual uint32_t GetCapabilities() const override; |
59 | | |
60 | | virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override; |
61 | | |
62 | | nsresult CopyInnerTo(HTMLEmbedElement* aDest); |
63 | | |
64 | 0 | void StartObjectLoad() { StartObjectLoad(true, false); } |
65 | | |
66 | | NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(HTMLEmbedElement, |
67 | | nsGenericHTMLElement) |
68 | | |
69 | | // WebIDL <embed> api |
70 | | void GetAlign(DOMString& aValue) |
71 | 0 | { |
72 | 0 | GetHTMLAttr(nsGkAtoms::align, aValue); |
73 | 0 | } |
74 | | void SetAlign(const nsAString& aValue, ErrorResult& aRv) |
75 | 0 | { |
76 | 0 | SetHTMLAttr(nsGkAtoms::align, aValue, aRv); |
77 | 0 | } |
78 | | void GetHeight(DOMString& aValue) |
79 | 0 | { |
80 | 0 | GetHTMLAttr(nsGkAtoms::height, aValue); |
81 | 0 | } |
82 | | void SetHeight(const nsAString& aValue, ErrorResult& aRv) |
83 | 0 | { |
84 | 0 | SetHTMLAttr(nsGkAtoms::height, aValue, aRv); |
85 | 0 | } |
86 | | void GetName(DOMString& aValue) |
87 | 0 | { |
88 | 0 | GetHTMLAttr(nsGkAtoms::name, aValue); |
89 | 0 | } |
90 | | void SetName(const nsAString& aValue, ErrorResult& aRv) |
91 | 0 | { |
92 | 0 | SetHTMLAttr(nsGkAtoms::name, aValue, aRv); |
93 | 0 | } |
94 | | void GetWidth(DOMString& aValue) |
95 | 0 | { |
96 | 0 | GetHTMLAttr(nsGkAtoms::width, aValue); |
97 | 0 | } |
98 | | void SetWidth(const nsAString& aValue, ErrorResult& aRv) |
99 | 0 | { |
100 | 0 | SetHTMLAttr(nsGkAtoms::width, aValue, aRv); |
101 | 0 | } |
102 | | // WebIDL <embed> api |
103 | | void GetSrc(DOMString& aValue) |
104 | 0 | { |
105 | 0 | GetURIAttr(nsGkAtoms::src, nullptr, aValue); |
106 | 0 | } |
107 | | void SetSrc(const nsAString& aValue, ErrorResult& aRv) |
108 | 0 | { |
109 | 0 | SetHTMLAttr(nsGkAtoms::src, aValue, aRv); |
110 | 0 | } |
111 | | void GetType(DOMString& aValue) |
112 | 0 | { |
113 | 0 | GetHTMLAttr(nsGkAtoms::type, aValue); |
114 | 0 | } |
115 | | void SetType(const nsAString& aValue, ErrorResult& aRv) |
116 | 0 | { |
117 | 0 | SetHTMLAttr(nsGkAtoms::type, aValue, aRv); |
118 | 0 | } |
119 | | nsIDocument* |
120 | | GetSVGDocument(nsIPrincipal& aSubjectPrincipal) |
121 | 0 | { |
122 | 0 | return GetContentDocument(aSubjectPrincipal); |
123 | 0 | } |
124 | | |
125 | | /** |
126 | | * Calls LoadObject with the correct arguments to start the plugin load. |
127 | | */ |
128 | | void StartObjectLoad(bool aNotify, bool aForceLoad); |
129 | | |
130 | | NS_FORWARD_NSIFRAMELOADEROWNER(nsObjectLoadingContent::) |
131 | | |
132 | | protected: |
133 | | // Override for nsImageLoadingContent. |
134 | 0 | nsIContent* AsContent() override { return this; } |
135 | | |
136 | | virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsAtom* aName, |
137 | | const nsAttrValue* aValue, |
138 | | const nsAttrValue* aOldValue, |
139 | | nsIPrincipal* aSubjectPrincipal, |
140 | | bool aNotify) override; |
141 | | virtual nsresult OnAttrSetButNotChanged(int32_t aNamespaceID, nsAtom* aName, |
142 | | const nsAttrValueOrString& aValue, |
143 | | bool aNotify) override; |
144 | | |
145 | | private: |
146 | | ~HTMLEmbedElement(); |
147 | | |
148 | | nsContentPolicyType GetContentPolicyType() const override; |
149 | | |
150 | | virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override; |
151 | | |
152 | | static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes, |
153 | | MappedDeclarations&); |
154 | | |
155 | | /** |
156 | | * This function is called by AfterSetAttr and OnAttrSetButNotChanged. |
157 | | * It will not be called if the value is being unset. |
158 | | * |
159 | | * @param aNamespaceID the namespace of the attr being set |
160 | | * @param aName the localname of the attribute being set |
161 | | * @param aNotify Whether we plan to notify document observers. |
162 | | */ |
163 | | nsresult AfterMaybeChangeAttr(int32_t aNamespaceID, nsAtom* aName, |
164 | | bool aNotify); |
165 | | }; |
166 | | |
167 | | } // namespace dom |
168 | | } // namespace mozilla |
169 | | |
170 | | #endif // mozilla_dom_HTMLEmbedElement_h |