Line data Source code
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_HTMLMetaElement_h
8 : #define mozilla_dom_HTMLMetaElement_h
9 :
10 : #include "mozilla/Attributes.h"
11 : #include "nsGenericHTMLElement.h"
12 : #include "nsIDOMHTMLMetaElement.h"
13 :
14 : namespace mozilla {
15 : namespace dom {
16 :
17 : class HTMLMetaElement final : public nsGenericHTMLElement,
18 : public nsIDOMHTMLMetaElement
19 : {
20 : public:
21 : explicit HTMLMetaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
22 :
23 : // nsISupports
24 : NS_DECL_ISUPPORTS_INHERITED
25 :
26 : // nsIDOMHTMLMetaElement
27 : NS_DECL_NSIDOMHTMLMETAELEMENT
28 :
29 : virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
30 : nsIContent* aBindingParent,
31 : bool aCompileEventHandlers) override;
32 : virtual void UnbindFromTree(bool aDeep = true,
33 : bool aNullParent = true) override;
34 :
35 : virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
36 : const nsAttrValue* aValue,
37 : const nsAttrValue* aOldValue,
38 : bool aNotify) override;
39 :
40 : void CreateAndDispatchEvent(nsIDocument* aDoc, const nsAString& aEventName);
41 :
42 : virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
43 : bool aPreallocateChildren) const override;
44 :
45 : // XPCOM GetName is fine.
46 0 : void SetName(const nsAString& aName, ErrorResult& aRv)
47 : {
48 0 : SetHTMLAttr(nsGkAtoms::name, aName, aRv);
49 0 : }
50 : // XPCOM GetHttpEquiv is fine.
51 0 : void SetHttpEquiv(const nsAString& aHttpEquiv, ErrorResult& aRv)
52 : {
53 0 : SetHTMLAttr(nsGkAtoms::httpEquiv, aHttpEquiv, aRv);
54 0 : }
55 : // XPCOM GetContent is fine.
56 0 : void SetContent(const nsAString& aContent, ErrorResult& aRv)
57 : {
58 0 : SetHTMLAttr(nsGkAtoms::content, aContent, aRv);
59 0 : }
60 : // XPCOM GetScheme is fine.
61 0 : void SetScheme(const nsAString& aScheme, ErrorResult& aRv)
62 : {
63 0 : SetHTMLAttr(nsGkAtoms::scheme, aScheme, aRv);
64 0 : }
65 :
66 : virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
67 :
68 : protected:
69 : virtual ~HTMLMetaElement();
70 :
71 : private:
72 : nsresult SetMetaReferrer(nsIDocument* aDocument);
73 : };
74 :
75 : } // namespace dom
76 : } // namespace mozilla
77 :
78 : #endif // mozilla_dom_HTMLMetaElement_h
|