bugs 151002, 212892, CDATA should be eTEXT, add nsIContent::ePROCESSING_INSTRUCTION and nsITextContent::AppendTextTo for XSLT perf

This commit is contained in:
axel%pike.org 2003-08-01 11:44:17 +00:00
Родитель 84bdb34c82
Коммит d21a2d98d9
8 изменённых файлов: 59 добавлений и 3 удалений

Просмотреть файл

@ -464,7 +464,9 @@ public:
/** form controls */
eHTML_FORM_CONTROL = 0x00000008,
/** XUL elements */
eXUL = 0x00000010
eXUL = 0x00000010,
/** xml processing instructions */
ePROCESSING_INSTRUCTION = 0x00000020
};
/**

Просмотреть файл

@ -102,6 +102,11 @@ public:
* method allows you to specify whether to copy the text as well.
*/
NS_IMETHOD CloneContent(PRBool aCloneText, nsITextContent** aClone) = 0;
/**
* Append the text content to aResult.
*/
NS_IMETHOD AppendTextTo(nsAString& aResult) = 0;
};
//----------------------------------------------------------------------

Просмотреть файл

@ -1349,6 +1349,21 @@ nsGenericDOMDataNode::CloneContent(PRBool aCloneText, nsITextContent** aClone)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsGenericDOMDataNode::AppendTextTo(nsAString& aResult)
{
if (mText.Is2b()) {
aResult.Append(mText.Get2b(), mText.GetLength());
} else {
// XXX we would like to have a AppendASCIItoUCS2 here
aResult.Append(NS_ConvertASCIItoUCS2(mText.Get1b(),
mText.GetLength()).get(),
mText.GetLength());
}
return NS_OK;
}
void
nsGenericDOMDataNode::LookupListenerManager(nsIEventListenerManager **aListenerManager) const
{

Просмотреть файл

@ -241,6 +241,7 @@ public:
NS_IMETHOD SetText(const char* aBuffer, PRInt32 aLength, PRBool aNotify);
NS_IMETHOD IsOnlyWhitespace(PRBool* aResult);
NS_IMETHOD CloneContent(PRBool aCloneText, nsITextContent** aClone);
NS_IMETHOD AppendTextTo(nsAString& aResult);
//----------------------------------------

Просмотреть файл

@ -211,7 +211,8 @@ public:
PRInt32 aLength,
PRBool aNotify);
NS_IMETHOD IsOnlyWhitespace(PRBool* aResult);
NS_IMETHOD CloneContent(PRBool aCloneText, nsITextContent** aClone);
NS_IMETHOD CloneContent(PRBool aCloneText, nsITextContent** aClone);
NS_IMETHOD AppendTextTo(nsAString& aResult);
//----------------------------------------
@ -439,7 +440,8 @@ nsAttributeContent::CopyText(nsAString& aResult)
aResult.Assign(mText.Get2b(), mText.GetLength());
}
else {
aResult.Assign(NS_ConvertASCIItoUCS2(mText.Get1b(), mText.GetLength()).get(), mText.GetLength());
const char *data = mText.Get1b();
CopyASCIItoUCS2(Substring(data, data + mText.GetLength()), aResult);
}
return NS_OK;
}
@ -555,3 +557,20 @@ nsAttributeContent::CloneContent(PRBool aCloneText, nsITextContent** aReturn)
it->mText = mText;
return result;
}
NS_IMETHODIMP
nsAttributeContent::AppendTextTo(nsAString& aResult)
{
ValidateTextFragment();
if (mText.Is2b()) {
aResult.Append(mText.Get2b(), mText.GetLength());
}
else {
// XXX we would like to have a AppendASCIItoUCS2 here
aResult.Append(NS_ConvertASCIItoUCS2(mText.Get1b(),
mText.GetLength()).get(),
mText.GetLength());
}
return NS_OK;
}

Просмотреть файл

@ -67,6 +67,7 @@ public:
// nsIContent
NS_IMETHOD GetTag(nsIAtom** aResult) const;
NS_IMETHOD_(PRBool) IsContentOfType(PRUint32 aFlags);
#ifdef DEBUG
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
NS_IMETHOD DumpContent(FILE* out, PRInt32 aIndent,PRBool aDumpAll) const;
@ -120,6 +121,12 @@ nsXMLCDATASection::GetTag(nsIAtom** aResult) const
return NS_OK;
}
NS_IMETHODIMP_(PRBool)
nsXMLCDATASection::IsContentOfType(PRUint32 aFlags)
{
return !(aFlags & ~eTEXT);
}
NS_IMETHODIMP
nsXMLCDATASection::GetNodeName(nsAString& aNodeName)
{

Просмотреть файл

@ -120,6 +120,12 @@ nsXMLProcessingInstruction::GetTag(nsIAtom** aResult) const
return NS_OK;
}
NS_IMETHODIMP_(PRBool)
nsXMLProcessingInstruction::IsContentOfType(PRUint32 aFlags)
{
return !(aFlags & ~ePROCESSING_INSTRUCTION);
}
NS_IMETHODIMP
nsXMLProcessingInstruction::GetNodeName(nsAString& aNodeName)
{

Просмотреть файл

@ -65,6 +65,7 @@ public:
// nsIContent
NS_IMETHOD GetTag(nsIAtom** aResult) const;
NS_IMETHOD_(PRBool) IsContentOfType(PRUint32 aFlags);
#ifdef DEBUG
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;