Bug 1750871 - run mochitest-remote on fission everywhere. r=releng-reviewers,aki
[gecko.git] / dom / base / DocumentType.h
blob08ab6673d0b71ec97c141ca58bb4df9f6444f4b4
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 /*
8 * Implementation of DOM Core's DocumentType node.
9 */
11 #ifndef DocumentType_h
12 #define DocumentType_h
14 #include "mozilla/Attributes.h"
15 #include "mozilla/dom/CharacterData.h"
16 #include "nsCOMPtr.h"
17 #include "nsIContent.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 DocumentType final : public CharacterData {
29 public:
30 DocumentType(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
31 const nsAString& aPublicId, const nsAString& aSystemId,
32 const nsAString& aInternalSubset);
34 // nsISupports
35 NS_INLINE_DECL_REFCOUNTING_INHERITED(DocumentType, CharacterData)
37 // nsINode
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;
51 // WebIDL API
52 void GetName(nsAString& aName) const;
53 void GetPublicId(nsAString& aPublicId) const;
54 void GetSystemId(nsAString& aSystemId) const;
55 void GetInternalSubset(nsAString& aInternalSubset) const;
57 protected:
58 virtual ~DocumentType();
60 virtual JSObject* WrapNode(JSContext* cx,
61 JS::Handle<JSObject*> aGivenProto) override;
63 nsString mPublicId;
64 nsString mSystemId;
65 nsString mInternalSubset;
68 } // namespace dom
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