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_CDATASection_h
8 : #define mozilla_dom_CDATASection_h
9 :
10 : #include "mozilla/Attributes.h"
11 : #include "nsIDOMCDATASection.h"
12 : #include "mozilla/dom/Text.h"
13 :
14 : namespace mozilla {
15 : namespace dom {
16 :
17 : class CDATASection final : public Text,
18 : public nsIDOMCDATASection
19 : {
20 : private:
21 0 : void Init()
22 : {
23 0 : MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::CDATA_SECTION_NODE,
24 : "Bad NodeType in aNodeInfo");
25 0 : }
26 :
27 : virtual ~CDATASection();
28 :
29 : public:
30 0 : explicit CDATASection(already_AddRefed<mozilla::dom::NodeInfo> aNodeInfo)
31 0 : : Text(aNodeInfo)
32 : {
33 0 : Init();
34 0 : }
35 :
36 0 : explicit CDATASection(nsNodeInfoManager* aNodeInfoManager)
37 0 : : Text(aNodeInfoManager->GetNodeInfo(nsGkAtoms::cdataTagName,
38 : nullptr, kNameSpaceID_None,
39 0 : nsIDOMNode::CDATA_SECTION_NODE))
40 : {
41 0 : Init();
42 0 : }
43 :
44 : // nsISupports
45 : NS_DECL_ISUPPORTS_INHERITED
46 :
47 : // nsIDOMNode
48 0 : NS_FORWARD_NSIDOMNODE_TO_NSINODE
49 :
50 : // nsIDOMCharacterData
51 0 : NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::)
52 : using nsGenericDOMDataNode::SetData; // Prevent hiding overloaded virtual function.
53 :
54 : // nsIDOMText
55 0 : NS_FORWARD_NSIDOMTEXT(nsGenericDOMDataNode::)
56 :
57 : // nsIDOMCDATASection
58 : // Empty interface
59 :
60 : // nsINode
61 : virtual bool IsNodeOfType(uint32_t aFlags) const override;
62 :
63 : virtual nsGenericDOMDataNode* CloneDataNode(mozilla::dom::NodeInfo *aNodeInfo,
64 : bool aCloneText) const override;
65 :
66 0 : virtual nsIDOMNode* AsDOMNode() override { return this; }
67 : #ifdef DEBUG
68 : virtual void List(FILE* out, int32_t aIndent) const override;
69 : virtual void DumpContent(FILE* out, int32_t aIndent,bool aDumpAll) const override;
70 : #endif
71 :
72 : protected:
73 : virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
74 : };
75 :
76 : } // namespace dom
77 : } // namespace mozilla
78 :
79 : #endif // mozilla_dom_CDATASection_h
|