1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/base/src/Comment.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,81 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef mozilla_dom_Comment_h 1.10 +#define mozilla_dom_Comment_h 1.11 + 1.12 +#include "mozilla/Attributes.h" 1.13 +#include "nsIDOMComment.h" 1.14 +#include "nsGenericDOMDataNode.h" 1.15 + 1.16 +namespace mozilla { 1.17 +namespace dom { 1.18 + 1.19 +class Comment MOZ_FINAL : public nsGenericDOMDataNode, 1.20 + public nsIDOMComment 1.21 +{ 1.22 +private: 1.23 + void Init() 1.24 + { 1.25 + NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::COMMENT_NODE, 1.26 + "Bad NodeType in aNodeInfo"); 1.27 + } 1.28 + 1.29 +public: 1.30 + Comment(already_AddRefed<nsINodeInfo>&& aNodeInfo) 1.31 + : nsGenericDOMDataNode(aNodeInfo) 1.32 + { 1.33 + Init(); 1.34 + } 1.35 + 1.36 + Comment(nsNodeInfoManager* aNodeInfoManager) 1.37 + : nsGenericDOMDataNode(aNodeInfoManager->GetCommentNodeInfo()) 1.38 + { 1.39 + Init(); 1.40 + } 1.41 + 1.42 + virtual ~Comment(); 1.43 + 1.44 + // nsISupports 1.45 + NS_DECL_ISUPPORTS_INHERITED 1.46 + 1.47 + // nsIDOMNode 1.48 + NS_FORWARD_NSIDOMNODE_TO_NSINODE 1.49 + 1.50 + // nsIDOMCharacterData 1.51 + NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::) 1.52 + using nsGenericDOMDataNode::SetData; // Prevent hiding overloaded virtual function. 1.53 + 1.54 + // nsIDOMComment 1.55 + // Empty interface 1.56 + 1.57 + // nsINode 1.58 + virtual bool IsNodeOfType(uint32_t aFlags) const; 1.59 + 1.60 + virtual nsGenericDOMDataNode* CloneDataNode(nsINodeInfo *aNodeInfo, 1.61 + bool aCloneText) const MOZ_OVERRIDE; 1.62 + 1.63 + virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } 1.64 +#ifdef DEBUG 1.65 + virtual void List(FILE* out, int32_t aIndent) const MOZ_OVERRIDE; 1.66 + virtual void DumpContent(FILE* out = stdout, int32_t aIndent = 0, 1.67 + bool aDumpAll = true) const MOZ_OVERRIDE 1.68 + { 1.69 + return; 1.70 + } 1.71 +#endif 1.72 + 1.73 + static already_AddRefed<Comment> 1.74 + Constructor(const GlobalObject& aGlobal, const nsAString& aData, 1.75 + ErrorResult& aRv); 1.76 + 1.77 +protected: 1.78 + virtual JSObject* WrapNode(JSContext *aCx) MOZ_OVERRIDE; 1.79 +}; 1.80 + 1.81 +} // namespace dom 1.82 +} // namespace mozilla 1.83 + 1.84 +#endif // mozilla_dom_Comment_h