Move CreateCDATASection, CreateProcessingInstruction, and CreateEntityReference

up to nsDocument so they're available in XHTML documents.  Bug 69840, r+sr=jst


git-svn-id: svn://10.0.0.236/trunk@153443 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bzbarsky%mit.edu
2004-03-02 22:39:46 +00:00
parent 67ff3ea238
commit ee0a2e7a8a
4 changed files with 52 additions and 69 deletions

View File

@@ -60,8 +60,6 @@
#include "nsIDOMText.h"
#include "nsIBaseWindow.h"
#include "nsIDOMWindow.h"
#include "nsIDOMCDATASection.h"
#include "nsIDOMProcessingInstruction.h"
#include "nsIDOMDocumentType.h"
#include "nsINameSpaceManager.h"
#include "nsICSSLoader.h"
@@ -747,61 +745,8 @@ nsXMLDocument::InternalGetNumberOfStyleSheets() const
return count;
}
// nsIDOMDocument interface
NS_IMETHODIMP
nsXMLDocument::CreateCDATASection(const nsAString& aData,
nsIDOMCDATASection** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nsnull;
// nsIDOMNode interface
nsReadingIterator<PRUnichar> begin;
nsReadingIterator<PRUnichar> end;
aData.BeginReading(begin);
aData.EndReading(end);
if (FindInReadable(NS_LITERAL_STRING("]]>"),begin,end))
return NS_ERROR_DOM_INVALID_CHARACTER_ERR;
nsCOMPtr<nsIContent> content;
nsresult rv = NS_NewXMLCDATASection(getter_AddRefs(content));
if (NS_SUCCEEDED(rv)) {
rv = CallQueryInterface(content, aReturn);
(*aReturn)->AppendData(aData);
}
return rv;
}
NS_IMETHODIMP
nsXMLDocument::CreateEntityReference(const nsAString& aName,
nsIDOMEntityReference** aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nsnull;
return NS_OK;
}
NS_IMETHODIMP
nsXMLDocument::CreateProcessingInstruction(const nsAString& aTarget,
const nsAString& aData,
nsIDOMProcessingInstruction** aReturn)
{
*aReturn = nsnull;
nsresult rv = nsContentUtils::CheckQName(aTarget, PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIContent> content;
rv = NS_NewXMLProcessingInstruction(getter_AddRefs(content), aTarget, aData);
if (NS_FAILED(rv)) {
return rv;
}
return CallQueryInterface(content, aReturn);
}
NS_IMETHODIMP
nsXMLDocument::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
{
@@ -908,6 +853,8 @@ MatchElementId(nsIContent *aContent, const nsACString& aUTF8Id, const nsAString&
return result;
}
// nsIDOMDocument interface
NS_IMETHODIMP
nsXMLDocument::GetElementById(const nsAString& aElementId,
nsIDOMElement** aReturn)

View File

@@ -82,13 +82,6 @@ public:
NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn);
// nsIDOMDocument interface
NS_IMETHOD CreateCDATASection(const nsAString& aData,
nsIDOMCDATASection** aReturn);
NS_IMETHOD CreateEntityReference(const nsAString& aName,
nsIDOMEntityReference** aReturn);
NS_IMETHOD CreateProcessingInstruction(const nsAString& aTarget,
const nsAString& aData,
nsIDOMProcessingInstruction** aReturn);
NS_IMETHOD GetElementById(const nsAString& aElementId,
nsIDOMElement** aReturn);