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.)

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

mercurial