content/base/src/Comment.h

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef mozilla_dom_Comment_h
michael@0 7 #define mozilla_dom_Comment_h
michael@0 8
michael@0 9 #include "mozilla/Attributes.h"
michael@0 10 #include "nsIDOMComment.h"
michael@0 11 #include "nsGenericDOMDataNode.h"
michael@0 12
michael@0 13 namespace mozilla {
michael@0 14 namespace dom {
michael@0 15
michael@0 16 class Comment MOZ_FINAL : public nsGenericDOMDataNode,
michael@0 17 public nsIDOMComment
michael@0 18 {
michael@0 19 private:
michael@0 20 void Init()
michael@0 21 {
michael@0 22 NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::COMMENT_NODE,
michael@0 23 "Bad NodeType in aNodeInfo");
michael@0 24 }
michael@0 25
michael@0 26 public:
michael@0 27 Comment(already_AddRefed<nsINodeInfo>&& aNodeInfo)
michael@0 28 : nsGenericDOMDataNode(aNodeInfo)
michael@0 29 {
michael@0 30 Init();
michael@0 31 }
michael@0 32
michael@0 33 Comment(nsNodeInfoManager* aNodeInfoManager)
michael@0 34 : nsGenericDOMDataNode(aNodeInfoManager->GetCommentNodeInfo())
michael@0 35 {
michael@0 36 Init();
michael@0 37 }
michael@0 38
michael@0 39 virtual ~Comment();
michael@0 40
michael@0 41 // nsISupports
michael@0 42 NS_DECL_ISUPPORTS_INHERITED
michael@0 43
michael@0 44 // nsIDOMNode
michael@0 45 NS_FORWARD_NSIDOMNODE_TO_NSINODE
michael@0 46
michael@0 47 // nsIDOMCharacterData
michael@0 48 NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::)
michael@0 49 using nsGenericDOMDataNode::SetData; // Prevent hiding overloaded virtual function.
michael@0 50
michael@0 51 // nsIDOMComment
michael@0 52 // Empty interface
michael@0 53
michael@0 54 // nsINode
michael@0 55 virtual bool IsNodeOfType(uint32_t aFlags) const;
michael@0 56
michael@0 57 virtual nsGenericDOMDataNode* CloneDataNode(nsINodeInfo *aNodeInfo,
michael@0 58 bool aCloneText) const MOZ_OVERRIDE;
michael@0 59
michael@0 60 virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
michael@0 61 #ifdef DEBUG
michael@0 62 virtual void List(FILE* out, int32_t aIndent) const MOZ_OVERRIDE;
michael@0 63 virtual void DumpContent(FILE* out = stdout, int32_t aIndent = 0,
michael@0 64 bool aDumpAll = true) const MOZ_OVERRIDE
michael@0 65 {
michael@0 66 return;
michael@0 67 }
michael@0 68 #endif
michael@0 69
michael@0 70 static already_AddRefed<Comment>
michael@0 71 Constructor(const GlobalObject& aGlobal, const nsAString& aData,
michael@0 72 ErrorResult& aRv);
michael@0 73
michael@0 74 protected:
michael@0 75 virtual JSObject* WrapNode(JSContext *aCx) MOZ_OVERRIDE;
michael@0 76 };
michael@0 77
michael@0 78 } // namespace dom
michael@0 79 } // namespace mozilla
michael@0 80
michael@0 81 #endif // mozilla_dom_Comment_h

mercurial