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/. */
8 * Implementation of DOM Core's DocumentType node.
11 #ifndef DocumentType_h
12 #define DocumentType_h
14 #include "mozilla/Attributes.h"
15 #include "mozilla/dom/CharacterData.h"
17 #include "nsIContent.h"
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 DocumentType final
: public CharacterData
{
30 DocumentType(already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
,
31 const nsAString
& aPublicId
, const nsAString
& aSystemId
,
32 const nsAString
& aInternalSubset
);
35 NS_INLINE_DECL_REFCOUNTING_INHERITED(DocumentType
, CharacterData
)
38 virtual bool IsNodeOfType(uint32_t aFlags
) const override
;
39 virtual void GetNodeValueInternal(nsAString
& aNodeValue
) override
{
40 SetDOMStringToNull(aNodeValue
);
42 virtual void SetNodeValueInternal(const nsAString
& aNodeValue
,
43 mozilla::ErrorResult
& aError
) override
{}
45 // nsIContent overrides
46 virtual const nsTextFragment
* GetText() override
;
48 virtual already_AddRefed
<CharacterData
> CloneDataNode(
49 mozilla::dom::NodeInfo
* aNodeInfo
, bool aCloneText
) const override
;
52 void GetName(nsAString
& aName
) const;
53 void GetPublicId(nsAString
& aPublicId
) const;
54 void GetSystemId(nsAString
& aSystemId
) const;
55 void GetInternalSubset(nsAString
& aInternalSubset
) const;
58 virtual ~DocumentType();
60 virtual JSObject
* WrapNode(JSContext
* cx
,
61 JS::Handle
<JSObject
*> aGivenProto
) override
;
65 nsString mInternalSubset
;
69 } // namespace mozilla
71 already_AddRefed
<mozilla::dom::DocumentType
> NS_NewDOMDocumentType(
72 nsNodeInfoManager
* aNodeInfoManager
, nsAtom
* aName
,
73 const nsAString
& aPublicId
, const nsAString
& aSystemId
,
74 const nsAString
& aInternalSubset
);
76 #endif // DocumentType_h