diff --git a/content/base/src/nsDocumentEncoder.cpp b/content/base/src/nsDocumentEncoder.cpp index 78a7e840431..ead60b54f56 100644 --- a/content/base/src/nsDocumentEncoder.cpp +++ b/content/base/src/nsDocumentEncoder.cpp @@ -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; } diff --git a/content/base/src/nsPlainTextSerializer.cpp b/content/base/src/nsPlainTextSerializer.cpp index 909ac206564..8dd7215093b 100644 --- a/content/base/src/nsPlainTextSerializer.cpp +++ b/content/base/src/nsPlainTextSerializer.cpp @@ -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) diff --git a/content/base/src/nsPlainTextSerializer.h b/content/base/src/nsPlainTextSerializer.h index 9d4a6627ddb..37b676ac131 100644 --- a/content/base/src/nsPlainTextSerializer.h +++ b/content/base/src/nsPlainTextSerializer.h @@ -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,