mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 17:23:59 +00:00
Bug 826703 part 1. Rename nsXMLCDATASection to mozilla::dom::CDATASection. r=peterv
--HG-- rename : content/xml/content/src/nsXMLCDATASection.cpp => content/xml/content/src/CDATASection.cpp rename : content/xml/content/src/nsXMLCDATASection.cpp => content/xml/content/src/CDATASection.h
This commit is contained in:
parent
b42b809fbc
commit
679d640300
95
content/xml/content/src/CDATASection.cpp
Normal file
95
content/xml/content/src/CDATASection.cpp
Normal file
@ -0,0 +1,95 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/CDATASection.h"
|
||||
|
||||
nsresult
|
||||
NS_NewXMLCDATASection(nsIContent** aInstancePtrResult,
|
||||
nsNodeInfoManager *aNodeInfoManager)
|
||||
{
|
||||
using mozilla::dom::CDATASection;
|
||||
|
||||
NS_PRECONDITION(aNodeInfoManager, "Missing nodeinfo manager");
|
||||
|
||||
*aInstancePtrResult = nullptr;
|
||||
|
||||
nsCOMPtr<nsINodeInfo> ni;
|
||||
ni = aNodeInfoManager->GetNodeInfo(nsGkAtoms::cdataTagName,
|
||||
nullptr, kNameSpaceID_None,
|
||||
nsIDOMNode::CDATA_SECTION_NODE);
|
||||
NS_ENSURE_TRUE(ni, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
CDATASection *instance = new CDATASection(ni.forget());
|
||||
if (!instance) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_ADDREF(*aInstancePtrResult = instance);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
DOMCI_NODE_DATA(CDATASection, mozilla::dom::CDATASection)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
CDATASection::~CDATASection()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// QueryInterface implementation for CDATASection
|
||||
NS_INTERFACE_TABLE_HEAD(CDATASection)
|
||||
NS_NODE_INTERFACE_TABLE4(CDATASection, nsIDOMNode, nsIDOMCharacterData,
|
||||
nsIDOMText, nsIDOMCDATASection)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CDATASection)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsGenericDOMDataNode)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(CDATASection, nsGenericDOMDataNode)
|
||||
NS_IMPL_RELEASE_INHERITED(CDATASection, nsGenericDOMDataNode)
|
||||
|
||||
bool
|
||||
CDATASection::IsNodeOfType(uint32_t aFlags) const
|
||||
{
|
||||
return !(aFlags & ~(eCONTENT | eTEXT | eDATA_NODE));
|
||||
}
|
||||
|
||||
nsGenericDOMDataNode*
|
||||
CDATASection::CloneDataNode(nsINodeInfo *aNodeInfo, bool aCloneText) const
|
||||
{
|
||||
nsCOMPtr<nsINodeInfo> ni = aNodeInfo;
|
||||
CDATASection *it = new CDATASection(ni.forget());
|
||||
if (it && aCloneText) {
|
||||
it->mText = mText;
|
||||
}
|
||||
|
||||
return it;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
CDATASection::List(FILE* out, int32_t aIndent) const
|
||||
{
|
||||
int32_t index;
|
||||
for (index = aIndent; --index >= 0; ) fputs(" ", out);
|
||||
|
||||
fprintf(out, "CDATASection refcount=%d<", mRefCnt.get());
|
||||
|
||||
nsAutoString tmp;
|
||||
ToCString(tmp, 0, mText.GetLength());
|
||||
fputs(NS_LossyConvertUTF16toASCII(tmp).get(), out);
|
||||
|
||||
fputs(">\n", out);
|
||||
}
|
||||
|
||||
void
|
||||
CDATASection::DumpContent(FILE* out, int32_t aIndent,
|
||||
bool aDumpAll) const {
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace mozilla
|
||||
} // namespace dom
|
60
content/xml/content/src/CDATASection.h
Normal file
60
content/xml/content/src/CDATASection.h
Normal file
@ -0,0 +1,60 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_CDATASection_h
|
||||
#define mozilla_dom_CDATASection_h
|
||||
|
||||
#include "nsIDOMCDATASection.h"
|
||||
#include "nsGenericDOMDataNode.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class CDATASection : public nsGenericDOMDataNode,
|
||||
public nsIDOMCDATASection
|
||||
{
|
||||
public:
|
||||
CDATASection(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsGenericDOMDataNode(aNodeInfo)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::CDATA_SECTION_NODE,
|
||||
"Bad NodeType in aNodeInfo");
|
||||
}
|
||||
virtual ~CDATASection();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIDOMNode
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
|
||||
// nsIDOMCharacterData
|
||||
NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::)
|
||||
|
||||
// nsIDOMText
|
||||
NS_FORWARD_NSIDOMTEXT(nsGenericDOMDataNode::)
|
||||
|
||||
// nsIDOMCDATASection
|
||||
// Empty interface
|
||||
|
||||
// nsINode
|
||||
virtual bool IsNodeOfType(uint32_t aFlags) const;
|
||||
|
||||
virtual nsGenericDOMDataNode* CloneDataNode(nsINodeInfo *aNodeInfo,
|
||||
bool aCloneText) const;
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||
#ifdef DEBUG
|
||||
virtual void List(FILE* out, int32_t aIndent) const;
|
||||
virtual void DumpContent(FILE* out, int32_t aIndent,bool aDumpAll) const;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_CDATASection_h
|
@ -15,9 +15,15 @@ LIBRARY_NAME = gkconxmlcon_s
|
||||
LIBXUL_LIBRARY = 1
|
||||
FAIL_ON_WARNINGS = 1
|
||||
|
||||
EXPORTS_NAMESPACES = mozilla/dom
|
||||
|
||||
EXPORTS_mozilla/dom = \
|
||||
CDATASection.h \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
nsXMLElement.cpp \
|
||||
nsXMLCDATASection.cpp \
|
||||
CDATASection.cpp \
|
||||
nsXMLProcessingInstruction.cpp \
|
||||
nsXMLStylesheetPI.cpp \
|
||||
$(NULL)
|
||||
|
@ -1,134 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsIDOMCDATASection.h"
|
||||
#include "nsGenericDOMDataNode.h"
|
||||
#include "nsGkAtoms.h"
|
||||
|
||||
class nsXMLCDATASection : public nsGenericDOMDataNode,
|
||||
public nsIDOMCDATASection
|
||||
{
|
||||
public:
|
||||
nsXMLCDATASection(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
virtual ~nsXMLCDATASection();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIDOMNode
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
|
||||
// nsIDOMCharacterData
|
||||
NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::)
|
||||
|
||||
// nsIDOMText
|
||||
NS_FORWARD_NSIDOMTEXT(nsGenericDOMDataNode::)
|
||||
|
||||
// nsIDOMCDATASection
|
||||
// Empty interface
|
||||
|
||||
// nsINode
|
||||
virtual bool IsNodeOfType(uint32_t aFlags) const;
|
||||
|
||||
virtual nsGenericDOMDataNode* CloneDataNode(nsINodeInfo *aNodeInfo,
|
||||
bool aCloneText) const;
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||
#ifdef DEBUG
|
||||
virtual void List(FILE* out, int32_t aIndent) const;
|
||||
virtual void DumpContent(FILE* out, int32_t aIndent,bool aDumpAll) const;
|
||||
#endif
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewXMLCDATASection(nsIContent** aInstancePtrResult,
|
||||
nsNodeInfoManager *aNodeInfoManager)
|
||||
{
|
||||
NS_PRECONDITION(aNodeInfoManager, "Missing nodeinfo manager");
|
||||
|
||||
*aInstancePtrResult = nullptr;
|
||||
|
||||
nsCOMPtr<nsINodeInfo> ni;
|
||||
ni = aNodeInfoManager->GetNodeInfo(nsGkAtoms::cdataTagName,
|
||||
nullptr, kNameSpaceID_None,
|
||||
nsIDOMNode::CDATA_SECTION_NODE);
|
||||
NS_ENSURE_TRUE(ni, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsXMLCDATASection *instance = new nsXMLCDATASection(ni.forget());
|
||||
if (!instance) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_ADDREF(*aInstancePtrResult = instance);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsXMLCDATASection::nsXMLCDATASection(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsGenericDOMDataNode(aNodeInfo)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::CDATA_SECTION_NODE,
|
||||
"Bad NodeType in aNodeInfo");
|
||||
}
|
||||
|
||||
nsXMLCDATASection::~nsXMLCDATASection()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DOMCI_NODE_DATA(CDATASection, nsXMLCDATASection)
|
||||
|
||||
// QueryInterface implementation for nsXMLCDATASection
|
||||
NS_INTERFACE_TABLE_HEAD(nsXMLCDATASection)
|
||||
NS_NODE_INTERFACE_TABLE4(nsXMLCDATASection, nsIDOMNode, nsIDOMCharacterData,
|
||||
nsIDOMText, nsIDOMCDATASection)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CDATASection)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsGenericDOMDataNode)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsXMLCDATASection, nsGenericDOMDataNode)
|
||||
NS_IMPL_RELEASE_INHERITED(nsXMLCDATASection, nsGenericDOMDataNode)
|
||||
|
||||
|
||||
bool
|
||||
nsXMLCDATASection::IsNodeOfType(uint32_t aFlags) const
|
||||
{
|
||||
return !(aFlags & ~(eCONTENT | eTEXT | eDATA_NODE));
|
||||
}
|
||||
|
||||
nsGenericDOMDataNode*
|
||||
nsXMLCDATASection::CloneDataNode(nsINodeInfo *aNodeInfo, bool aCloneText) const
|
||||
{
|
||||
nsCOMPtr<nsINodeInfo> ni = aNodeInfo;
|
||||
nsXMLCDATASection *it = new nsXMLCDATASection(ni.forget());
|
||||
if (it && aCloneText) {
|
||||
it->mText = mText;
|
||||
}
|
||||
|
||||
return it;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
nsXMLCDATASection::List(FILE* out, int32_t aIndent) const
|
||||
{
|
||||
int32_t index;
|
||||
for (index = aIndent; --index >= 0; ) fputs(" ", out);
|
||||
|
||||
fprintf(out, "CDATASection refcount=%d<", mRefCnt.get());
|
||||
|
||||
nsAutoString tmp;
|
||||
ToCString(tmp, 0, mText.GetLength());
|
||||
fputs(NS_LossyConvertUTF16toASCII(tmp).get(), out);
|
||||
|
||||
fputs(">\n", out);
|
||||
}
|
||||
|
||||
void
|
||||
nsXMLCDATASection::DumpContent(FILE* out, int32_t aIndent,
|
||||
bool aDumpAll) const {
|
||||
}
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user