Bumping gaia.json for 8 gaia revision(s) a=gaia-bump
[gecko.git] / dom / base / DocumentType.h
blobda32636e74aae69c9423dd51e69dd0cf526ae00d
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 /*
7 * Implementation of DOM Core's nsIDOMDocumentType node.
8 */
10 #ifndef DocumentType_h
11 #define DocumentType_h
13 #include "mozilla/Attributes.h"
14 #include "nsCOMPtr.h"
15 #include "nsIDOMDocumentType.h"
16 #include "nsIContent.h"
17 #include "nsGenericDOMDataNode.h"
18 #include "nsString.h"
20 namespace mozilla {
21 namespace dom {
23 // XXX DocumentType is currently implemented by inheriting the generic
24 // CharacterData object, even though DocumentType is not character
25 // data. This is done simply for convenience and should be changed if
26 // this restricts what should be done for character data.
28 class DocumentTypeForward : public nsGenericDOMDataNode,
29 public nsIDOMDocumentType
31 public:
32 explicit DocumentTypeForward(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
33 : nsGenericDOMDataNode(aNodeInfo)
37 // nsIDOMNode
38 NS_FORWARD_NSIDOMNODE_TO_NSINODE
41 class DocumentType MOZ_FINAL : public DocumentTypeForward
43 public:
44 DocumentType(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
45 const nsAString& aPublicId,
46 const nsAString& aSystemId,
47 const nsAString& aInternalSubset);
49 // nsISupports
50 NS_DECL_ISUPPORTS_INHERITED
52 // nsIDOMNode
53 // Forwarded by base class
55 // nsIDOMDocumentType
56 NS_DECL_NSIDOMDOCUMENTTYPE
58 // nsINode
59 virtual bool IsNodeOfType(uint32_t aFlags) const MOZ_OVERRIDE;
60 virtual void GetNodeValueInternal(nsAString& aNodeValue) MOZ_OVERRIDE
62 SetDOMStringToNull(aNodeValue);
64 virtual void SetNodeValueInternal(const nsAString& aNodeValue,
65 mozilla::ErrorResult& aError) MOZ_OVERRIDE
69 // nsIContent overrides
70 virtual const nsTextFragment* GetText() MOZ_OVERRIDE;
72 virtual nsGenericDOMDataNode* CloneDataNode(mozilla::dom::NodeInfo *aNodeInfo,
73 bool aCloneText) const MOZ_OVERRIDE;
75 virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
77 protected:
78 virtual ~DocumentType();
80 virtual JSObject* WrapNode(JSContext *cx) MOZ_OVERRIDE;
82 nsString mPublicId;
83 nsString mSystemId;
84 nsString mInternalSubset;
87 } // namespace dom
88 } // namespace mozilla
90 already_AddRefed<mozilla::dom::DocumentType>
91 NS_NewDOMDocumentType(nsNodeInfoManager* aNodeInfoManager,
92 nsIAtom *aName,
93 const nsAString& aPublicId,
94 const nsAString& aSystemId,
95 const nsAString& aInternalSubset,
96 mozilla::ErrorResult& rv);
98 nsresult
99 NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType,
100 nsNodeInfoManager* aNodeInfoManager,
101 nsIAtom *aName,
102 const nsAString& aPublicId,
103 const nsAString& aSystemId,
104 const nsAString& aInternalSubset);
106 #endif // DocumentType_h