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

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

mercurial