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:
parent
67ff3ea238
commit
ee0a2e7a8a
@ -63,6 +63,8 @@
|
||||
#include "nsIDOMDocumentXBL.h"
|
||||
#include "nsGenericElement.h"
|
||||
#include "nsIDOMEventGroup.h"
|
||||
#include "nsIDOMCDATASection.h"
|
||||
#include "nsIDOMProcessingInstruction.h"
|
||||
|
||||
#include "nsRange.h"
|
||||
#include "nsIDOMText.h"
|
||||
@ -2183,8 +2185,25 @@ NS_IMETHODIMP
|
||||
nsDocument::CreateCDATASection(const nsAString& aData,
|
||||
nsIDOMCDATASection** aReturn)
|
||||
{
|
||||
// Should be implemented by subclass
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
NS_ENSURE_ARG_POINTER(aReturn);
|
||||
*aReturn = nsnull;
|
||||
|
||||
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
|
||||
@ -2192,8 +2211,18 @@ nsDocument::CreateProcessingInstruction(const nsAString& aTarget,
|
||||
const nsAString& aData,
|
||||
nsIDOMProcessingInstruction** aReturn)
|
||||
{
|
||||
// Should be implemented by subclass
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
*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
|
||||
@ -2246,8 +2275,10 @@ NS_IMETHODIMP
|
||||
nsDocument::CreateEntityReference(const nsAString& aName,
|
||||
nsIDOMEntityReference** aReturn)
|
||||
{
|
||||
// Should be implemented by subclass
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
NS_ENSURE_ARG_POINTER(aReturn);
|
||||
|
||||
*aReturn = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
||||
@ -1426,6 +1426,10 @@ nsHTMLDocument::CreateProcessingInstruction(const nsAString& aTarget,
|
||||
const nsAString& aData,
|
||||
nsIDOMProcessingInstruction** aReturn)
|
||||
{
|
||||
if (IsXHTML()) {
|
||||
return nsDocument::CreateProcessingInstruction(aTarget, aData, aReturn);
|
||||
}
|
||||
|
||||
// There are no PIs for HTML
|
||||
*aReturn = nsnull;
|
||||
|
||||
@ -1436,6 +1440,10 @@ NS_IMETHODIMP
|
||||
nsHTMLDocument::CreateCDATASection(const nsAString& aData,
|
||||
nsIDOMCDATASection** aReturn)
|
||||
{
|
||||
if (IsXHTML()) {
|
||||
return nsDocument::CreateCDATASection(aData, aReturn);
|
||||
}
|
||||
|
||||
// There are no CDATASections in HTML
|
||||
*aReturn = nsnull;
|
||||
|
||||
@ -1446,6 +1454,10 @@ NS_IMETHODIMP
|
||||
nsHTMLDocument::CreateEntityReference(const nsAString& aName,
|
||||
nsIDOMEntityReference** aReturn)
|
||||
{
|
||||
if (IsXHTML()) {
|
||||
return nsDocument::CreateEntityReference(aName, aReturn);
|
||||
}
|
||||
|
||||
// There are no EntityReferences in HTML
|
||||
*aReturn = nsnull;
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user