Bug 1892041 - Part 1: Update test262 features. r=spidermonkey-reviewers,dminor
[gecko.git] / dom / base / Comment.h
blob5ad4d0bab8f08610165ba761403f079dac42d108
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 {
16 private:
17 void Init() {
18 MOZ_ASSERT(mNodeInfo->NodeType() == COMMENT_NODE,
19 "Bad NodeType in aNodeInfo");
22 virtual ~Comment();
24 public:
25 explicit Comment(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
26 : CharacterData(std::move(aNodeInfo)) {
27 Init();
30 explicit Comment(nsNodeInfoManager* aNodeInfoManager)
31 : CharacterData(aNodeInfoManager->GetCommentNodeInfo()) {
32 Init();
35 NS_IMPL_FROMNODE_HELPER(Comment, IsComment())
37 // nsISupports
38 NS_INLINE_DECL_REFCOUNTING_INHERITED(Comment, CharacterData)
40 virtual already_AddRefed<CharacterData> CloneDataNode(
41 mozilla::dom::NodeInfo* aNodeInfo, bool aCloneText) const override;
43 #ifdef DEBUG
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 {
47 return;
49 #endif
51 static already_AddRefed<Comment> Constructor(const GlobalObject& aGlobal,
52 const nsAString& aData,
53 ErrorResult& aRv);
55 protected:
56 virtual JSObject* WrapNode(JSContext* aCx,
57 JS::Handle<JSObject*> aGivenProto) override;
60 } // namespace mozilla::dom
62 #endif // mozilla_dom_Comment_h