Bumping gaia.json for 8 gaia revision(s) a=gaia-bump
[gecko.git] / dom / base / nsTextNode.h
blob0e644d271a718e284a3e9926b51f17613aadf913
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.
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
23 class nsTextNode : public mozilla::dom::Text,
24 public nsIDOMText
26 private:
27 void Init()
29 NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::TEXT_NODE,
30 "Bad NodeType in aNodeInfo");
33 public:
34 explicit nsTextNode(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
35 : mozilla::dom::Text(aNodeInfo)
37 Init();
40 explicit nsTextNode(nsNodeInfoManager* aNodeInfoManager)
41 : mozilla::dom::Text(aNodeInfoManager->GetTextNodeInfo())
43 Init();
46 // nsISupports
47 NS_DECL_ISUPPORTS_INHERITED
49 // nsIDOMNode
50 NS_FORWARD_NSIDOMNODE_TO_NSINODE
52 // nsIDOMCharacterData
53 NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::)
54 using nsGenericDOMDataNode::SetData; // Prevent hiding overloaded virtual function.
56 // nsIDOMText
57 NS_FORWARD_NSIDOMTEXT(nsGenericDOMDataNode::)
59 // nsINode
60 virtual bool IsNodeOfType(uint32_t aFlags) const MOZ_OVERRIDE;
62 virtual nsGenericDOMDataNode* CloneDataNode(mozilla::dom::NodeInfo *aNodeInfo,
63 bool aCloneText) const MOZ_OVERRIDE;
65 virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
66 nsIContent* aBindingParent,
67 bool aCompileEventHandlers) MOZ_OVERRIDE;
68 virtual void UnbindFromTree(bool aDeep = true,
69 bool aNullParent = true) MOZ_OVERRIDE;
71 nsresult AppendTextForNormalize(const char16_t* aBuffer, uint32_t aLength,
72 bool aNotify, nsIContent* aNextSibling);
74 virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
76 #ifdef DEBUG
77 virtual void List(FILE* out, int32_t aIndent) const MOZ_OVERRIDE;
78 virtual void DumpContent(FILE* out, int32_t aIndent, bool aDumpAll) const MOZ_OVERRIDE;
79 #endif
81 protected:
82 virtual ~nsTextNode();
84 virtual JSObject* WrapNode(JSContext *aCx) MOZ_OVERRIDE;
87 #endif // nsTextNode_h