|
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/. */ |
|
5 |
|
6 #ifndef mozilla_dom_Comment_h |
|
7 #define mozilla_dom_Comment_h |
|
8 |
|
9 #include "mozilla/Attributes.h" |
|
10 #include "nsIDOMComment.h" |
|
11 #include "nsGenericDOMDataNode.h" |
|
12 |
|
13 namespace mozilla { |
|
14 namespace dom { |
|
15 |
|
16 class Comment MOZ_FINAL : public nsGenericDOMDataNode, |
|
17 public nsIDOMComment |
|
18 { |
|
19 private: |
|
20 void Init() |
|
21 { |
|
22 NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::COMMENT_NODE, |
|
23 "Bad NodeType in aNodeInfo"); |
|
24 } |
|
25 |
|
26 public: |
|
27 Comment(already_AddRefed<nsINodeInfo>&& aNodeInfo) |
|
28 : nsGenericDOMDataNode(aNodeInfo) |
|
29 { |
|
30 Init(); |
|
31 } |
|
32 |
|
33 Comment(nsNodeInfoManager* aNodeInfoManager) |
|
34 : nsGenericDOMDataNode(aNodeInfoManager->GetCommentNodeInfo()) |
|
35 { |
|
36 Init(); |
|
37 } |
|
38 |
|
39 virtual ~Comment(); |
|
40 |
|
41 // nsISupports |
|
42 NS_DECL_ISUPPORTS_INHERITED |
|
43 |
|
44 // nsIDOMNode |
|
45 NS_FORWARD_NSIDOMNODE_TO_NSINODE |
|
46 |
|
47 // nsIDOMCharacterData |
|
48 NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::) |
|
49 using nsGenericDOMDataNode::SetData; // Prevent hiding overloaded virtual function. |
|
50 |
|
51 // nsIDOMComment |
|
52 // Empty interface |
|
53 |
|
54 // nsINode |
|
55 virtual bool IsNodeOfType(uint32_t aFlags) const; |
|
56 |
|
57 virtual nsGenericDOMDataNode* CloneDataNode(nsINodeInfo *aNodeInfo, |
|
58 bool aCloneText) const MOZ_OVERRIDE; |
|
59 |
|
60 virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } |
|
61 #ifdef DEBUG |
|
62 virtual void List(FILE* out, int32_t aIndent) const MOZ_OVERRIDE; |
|
63 virtual void DumpContent(FILE* out = stdout, int32_t aIndent = 0, |
|
64 bool aDumpAll = true) const MOZ_OVERRIDE |
|
65 { |
|
66 return; |
|
67 } |
|
68 #endif |
|
69 |
|
70 static already_AddRefed<Comment> |
|
71 Constructor(const GlobalObject& aGlobal, const nsAString& aData, |
|
72 ErrorResult& aRv); |
|
73 |
|
74 protected: |
|
75 virtual JSObject* WrapNode(JSContext *aCx) MOZ_OVERRIDE; |
|
76 }; |
|
77 |
|
78 } // namespace dom |
|
79 } // namespace mozilla |
|
80 |
|
81 #endif // mozilla_dom_Comment_h |