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 mozilla_dom_HTMLMetaElement_h
8 #define mozilla_dom_HTMLMetaElement_h
10 #include "mozilla/Attributes.h"
11 #include "nsGenericHTMLElement.h"
13 namespace mozilla::dom
{
15 class HTMLMetaElement final
: public nsGenericHTMLElement
{
17 explicit HTMLMetaElement(
18 already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
);
21 NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLMetaElement
, nsGenericHTMLElement
)
23 nsresult
BindToTree(BindContext
&, nsINode
& aParent
) override
;
24 void UnbindFromTree(UnbindContext
&) override
;
26 void AfterSetAttr(int32_t aNameSpaceID
, nsAtom
* aName
,
27 const nsAttrValue
* aValue
, const nsAttrValue
* aOldValue
,
28 nsIPrincipal
* aSubjectPrincipal
, bool aNotify
) override
;
30 void CreateAndDispatchEvent(Document
&, const nsAString
& aEventName
);
32 virtual nsresult
Clone(dom::NodeInfo
*, nsINode
** aResult
) const override
;
34 void GetName(nsAString
& aValue
) { GetHTMLAttr(nsGkAtoms::name
, aValue
); }
35 void SetName(const nsAString
& aName
, ErrorResult
& aRv
) {
36 SetHTMLAttr(nsGkAtoms::name
, aName
, aRv
);
38 void GetHttpEquiv(nsAString
& aValue
) {
39 GetHTMLAttr(nsGkAtoms::httpEquiv
, aValue
);
41 void SetHttpEquiv(const nsAString
& aHttpEquiv
, ErrorResult
& aRv
) {
42 SetHTMLAttr(nsGkAtoms::httpEquiv
, aHttpEquiv
, aRv
);
44 void GetContent(nsAString
& aValue
) {
45 GetHTMLAttr(nsGkAtoms::content
, aValue
);
47 void SetContent(const nsAString
& aContent
, ErrorResult
& aRv
) {
48 SetHTMLAttr(nsGkAtoms::content
, aContent
, aRv
);
50 void GetScheme(nsAString
& aValue
) { GetHTMLAttr(nsGkAtoms::scheme
, aValue
); }
51 void SetScheme(const nsAString
& aScheme
, ErrorResult
& aRv
) {
52 SetHTMLAttr(nsGkAtoms::scheme
, aScheme
, aRv
);
54 void GetMedia(nsAString
& aValue
) { GetHTMLAttr(nsGkAtoms::media
, aValue
); }
55 void SetMedia(const nsAString
& aMedia
, ErrorResult
& aRv
) {
56 SetHTMLAttr(nsGkAtoms::media
, aMedia
, aRv
);
59 JSObject
* WrapNode(JSContext
*, JS::Handle
<JSObject
*> aGivenProto
) override
;
62 virtual ~HTMLMetaElement();
65 enum class ChangeKind
: uint8_t { TreeChange
, NameChange
, ContentChange
};
66 void MetaRemoved(Document
& aDoc
, const nsAttrValue
& aName
,
67 ChangeKind aChangeKind
);
68 void MetaAddedOrChanged(Document
& aDoc
, const nsAttrValue
& aName
,
69 ChangeKind aChangeKind
);
72 } // namespace mozilla::dom
74 #endif // mozilla_dom_HTMLMetaElement_h