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/. */
10 * Implementation of DOM Core's nsIDOMText node.
13 #include "mozilla/Attributes.h"
14 #include "mozilla/dom/Text.h"
15 #include "nsIDOMText.h"
18 class nsNodeInfoManager
;
21 * Class used to implement DOM text nodes
23 class nsTextNode
: public mozilla::dom::Text
,
29 NS_ABORT_IF_FALSE(mNodeInfo
->NodeType() == nsIDOMNode::TEXT_NODE
,
30 "Bad NodeType in aNodeInfo");
34 explicit nsTextNode(already_AddRefed
<mozilla::dom::NodeInfo
>& aNodeInfo
)
35 : mozilla::dom::Text(aNodeInfo
)
40 explicit nsTextNode(nsNodeInfoManager
* aNodeInfoManager
)
41 : mozilla::dom::Text(aNodeInfoManager
->GetTextNodeInfo())
47 NS_DECL_ISUPPORTS_INHERITED
50 NS_FORWARD_NSIDOMNODE_TO_NSINODE
52 // nsIDOMCharacterData
53 NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::)
54 using nsGenericDOMDataNode::SetData
; // Prevent hiding overloaded virtual function.
57 NS_FORWARD_NSIDOMTEXT(nsGenericDOMDataNode::)
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; }
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
;
82 virtual ~nsTextNode();
84 virtual JSObject
* WrapNode(JSContext
*aCx
) MOZ_OVERRIDE
;
87 #endif // nsTextNode_h