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 #ifndef mozilla_dom_Comment_h
8 #define mozilla_dom_Comment_h
10 #include "mozilla/Attributes.h"
11 #include "mozilla/dom/CharacterData.h"
13 namespace mozilla::dom
{
15 class Comment final
: public CharacterData
{
18 MOZ_ASSERT(mNodeInfo
->NodeType() == COMMENT_NODE
,
19 "Bad NodeType in aNodeInfo");
25 explicit Comment(already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
)
26 : CharacterData(std::move(aNodeInfo
)) {
30 explicit Comment(nsNodeInfoManager
* aNodeInfoManager
)
31 : CharacterData(aNodeInfoManager
->GetCommentNodeInfo()) {
35 NS_IMPL_FROMNODE_HELPER(Comment
, IsComment())
38 NS_INLINE_DECL_REFCOUNTING_INHERITED(Comment
, CharacterData
)
40 virtual already_AddRefed
<CharacterData
> CloneDataNode(
41 mozilla::dom::NodeInfo
* aNodeInfo
, bool aCloneText
) const override
;
44 virtual void List(FILE* out
, int32_t aIndent
) const override
;
45 virtual void DumpContent(FILE* out
= stdout
, int32_t aIndent
= 0,
46 bool aDumpAll
= true) const override
{
51 static already_AddRefed
<Comment
> Constructor(const GlobalObject
& aGlobal
,
52 const nsAString
& aData
,
56 virtual JSObject
* WrapNode(JSContext
* aCx
,
57 JS::Handle
<JSObject
*> aGivenProto
) override
;
60 } // namespace mozilla::dom
62 #endif // mozilla_dom_Comment_h