content/base/src/nsTextNode.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 nsTextNode_h
     7 #define nsTextNode_h
     9 /*
    10  * Implementation of DOM Core's nsIDOMText node.
    11  */
    13 #include "mozilla/Attributes.h"
    14 #include "mozilla/dom/Text.h"
    15 #include "nsIDOMText.h"
    16 #include "nsDebug.h"
    18 class nsNodeInfoManager;
    20 /**
    21  * Class used to implement DOM text nodes
    22  */
    23 class nsTextNode : public mozilla::dom::Text,
    24                    public nsIDOMText
    25 {
    26 private:
    27   void Init()
    28   {
    29     NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::TEXT_NODE,
    30                       "Bad NodeType in aNodeInfo");
    31   }
    33 public:
    34   nsTextNode(already_AddRefed<nsINodeInfo>& aNodeInfo)
    35     : mozilla::dom::Text(aNodeInfo)
    36   {
    37     Init();
    38   }
    40   nsTextNode(nsNodeInfoManager* aNodeInfoManager)
    41     : mozilla::dom::Text(aNodeInfoManager->GetTextNodeInfo())
    42   {
    43     Init();
    44   }
    46   virtual ~nsTextNode();
    48   // nsISupports
    49   NS_DECL_ISUPPORTS_INHERITED
    51   // nsIDOMNode
    52   NS_FORWARD_NSIDOMNODE_TO_NSINODE
    54   // nsIDOMCharacterData
    55   NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::)
    56   using nsGenericDOMDataNode::SetData; // Prevent hiding overloaded virtual function.
    58   // nsIDOMText
    59   NS_FORWARD_NSIDOMTEXT(nsGenericDOMDataNode::)
    61   // nsINode
    62   virtual bool IsNodeOfType(uint32_t aFlags) const;
    64   virtual nsGenericDOMDataNode* CloneDataNode(nsINodeInfo *aNodeInfo,
    65                                               bool aCloneText) const MOZ_OVERRIDE;
    67   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
    68                               nsIContent* aBindingParent,
    69                               bool aCompileEventHandlers) MOZ_OVERRIDE;
    70   virtual void UnbindFromTree(bool aDeep = true,
    71                               bool aNullParent = true) MOZ_OVERRIDE;
    73   nsresult AppendTextForNormalize(const char16_t* aBuffer, uint32_t aLength,
    74                                   bool aNotify, nsIContent* aNextSibling);
    76   virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
    78 #ifdef DEBUG
    79   virtual void List(FILE* out, int32_t aIndent) const MOZ_OVERRIDE;
    80   virtual void DumpContent(FILE* out, int32_t aIndent, bool aDumpAll) const MOZ_OVERRIDE;
    81 #endif
    83 protected:
    84   virtual JSObject* WrapNode(JSContext *aCx) MOZ_OVERRIDE;
    85 };
    87 #endif // nsTextNode_h

mercurial