зеркало из https://github.com/mozilla/pjs.git
Make the plaintext serializer properly handle CDATA nodes. Bug 234427, patch
by Sebastian Redl <wasti.redl@gmx.net>, r=akkana, sr=bzbarsky
This commit is contained in:
Родитель
69833527e4
Коммит
905b64bdaa
|
@ -588,7 +588,8 @@ static PRBool IsTextNode(nsIDOMNode *aNode)
|
|||
if (!aNode) return PR_FALSE;
|
||||
PRUint16 nodeType;
|
||||
aNode->GetNodeType(&nodeType);
|
||||
if (nodeType == nsIDOMNode::TEXT_NODE)
|
||||
if (nodeType == nsIDOMNode::TEXT_NODE ||
|
||||
nodeType == nsIDOMNode::CDATA_SECTION_NODE)
|
||||
return PR_TRUE;
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "nsIServiceManager.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIDOMText.h"
|
||||
#include "nsIDOMCDATASection.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsITextContent.h"
|
||||
|
@ -363,7 +364,7 @@ nsPlainTextSerializer::AppendText(nsIDOMText* aText,
|
|||
}
|
||||
|
||||
// Consume the last bit of the string if there's any left
|
||||
if (NS_SUCCEEDED(rv) & (start < length)) {
|
||||
if (NS_SUCCEEDED(rv) && start < length) {
|
||||
if (start) {
|
||||
rv = DoAddLeaf(nsnull,
|
||||
eHTMLTag_text,
|
||||
|
@ -379,7 +380,16 @@ nsPlainTextSerializer::AppendText(nsIDOMText* aText,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsPlainTextSerializer::AppendCDATASection(nsIDOMCDATASection* aCDATASection,
|
||||
PRInt32 aStartOffset,
|
||||
PRInt32 aEndOffset,
|
||||
nsAString& aStr)
|
||||
{
|
||||
return AppendText(aCDATASection, aStartOffset, aEndOffset, aStr);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPlainTextSerializer::AppendElementStart(nsIDOMElement *aElement,
|
||||
PRBool aHasChildren,
|
||||
nsAString& aStr)
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
PRInt32 aEndOffset, nsAString& aStr);
|
||||
NS_IMETHOD AppendCDATASection(nsIDOMCDATASection* aCDATASection,
|
||||
PRInt32 aStartOffset, PRInt32 aEndOffset,
|
||||
nsAString& aStr) { return NS_OK; }
|
||||
nsAString& aStr);
|
||||
NS_IMETHOD AppendProcessingInstruction(nsIDOMProcessingInstruction* aPI,
|
||||
PRInt32 aStartOffset,
|
||||
PRInt32 aEndOffset,
|
||||
|
|
Загрузка…
Ссылка в новой задаче