michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_dom_Comment_h michael@0: #define mozilla_dom_Comment_h michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "nsIDOMComment.h" michael@0: #include "nsGenericDOMDataNode.h" michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: michael@0: class Comment MOZ_FINAL : public nsGenericDOMDataNode, michael@0: public nsIDOMComment michael@0: { michael@0: private: michael@0: void Init() michael@0: { michael@0: NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::COMMENT_NODE, michael@0: "Bad NodeType in aNodeInfo"); michael@0: } michael@0: michael@0: public: michael@0: Comment(already_AddRefed&& aNodeInfo) michael@0: : nsGenericDOMDataNode(aNodeInfo) michael@0: { michael@0: Init(); michael@0: } michael@0: michael@0: Comment(nsNodeInfoManager* aNodeInfoManager) michael@0: : nsGenericDOMDataNode(aNodeInfoManager->GetCommentNodeInfo()) michael@0: { michael@0: Init(); michael@0: } michael@0: michael@0: virtual ~Comment(); michael@0: michael@0: // nsISupports michael@0: NS_DECL_ISUPPORTS_INHERITED michael@0: michael@0: // nsIDOMNode michael@0: NS_FORWARD_NSIDOMNODE_TO_NSINODE michael@0: michael@0: // nsIDOMCharacterData michael@0: NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::) michael@0: using nsGenericDOMDataNode::SetData; // Prevent hiding overloaded virtual function. michael@0: michael@0: // nsIDOMComment michael@0: // Empty interface michael@0: michael@0: // nsINode michael@0: virtual bool IsNodeOfType(uint32_t aFlags) const; michael@0: michael@0: virtual nsGenericDOMDataNode* CloneDataNode(nsINodeInfo *aNodeInfo, michael@0: bool aCloneText) const MOZ_OVERRIDE; michael@0: michael@0: virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } michael@0: #ifdef DEBUG michael@0: virtual void List(FILE* out, int32_t aIndent) const MOZ_OVERRIDE; michael@0: virtual void DumpContent(FILE* out = stdout, int32_t aIndent = 0, michael@0: bool aDumpAll = true) const MOZ_OVERRIDE michael@0: { michael@0: return; michael@0: } michael@0: #endif michael@0: michael@0: static already_AddRefed michael@0: Constructor(const GlobalObject& aGlobal, const nsAString& aData, michael@0: ErrorResult& aRv); michael@0: michael@0: protected: michael@0: virtual JSObject* WrapNode(JSContext *aCx) MOZ_OVERRIDE; michael@0: }; michael@0: michael@0: } // namespace dom michael@0: } // namespace mozilla michael@0: michael@0: #endif // mozilla_dom_Comment_h