diff --git a/content/base/public/nsIContentSerializer.h b/content/base/public/nsIContentSerializer.h index e01a1d9e3ed..b3a78d1ea38 100644 --- a/content/base/public/nsIContentSerializer.h +++ b/content/base/public/nsIContentSerializer.h @@ -35,8 +35,8 @@ * * ***** END LICENSE BLOCK ***** */ -#ifndef _nsIContentSerializer_h__ -#define _nsIContentSerializer_h__ +#ifndef nsIContentSerializer_h +#define nsIContentSerializer_h #include "nsISupports.h" @@ -44,7 +44,11 @@ class nsIContent; class nsIDocument; class nsAString; -/* starting interface: nsIContentSerializer */ +namespace mozilla { +namespace dom { +class Element; +} // namespace dom +} // namespace mozilla #define NS_ICONTENTSERIALIZER_IID \ { 0xb1ee32f2, 0xb8c4, 0x49b9, \ @@ -77,11 +81,11 @@ class nsIContentSerializer : public nsISupports { NS_IMETHOD AppendDoctype(nsIContent *aDoctype, nsAString& aStr) = 0; - NS_IMETHOD AppendElementStart(nsIContent *aElement, - nsIContent *aOriginalElement, + NS_IMETHOD AppendElementStart(mozilla::dom::Element* aElement, + mozilla::dom::Element* aOriginalElement, nsAString& aStr) = 0; - NS_IMETHOD AppendElementEnd(nsIContent *aElement, + NS_IMETHOD AppendElementEnd(mozilla::dom::Element* aElement, nsAString& aStr) = 0; NS_IMETHOD Flush(nsAString& aStr) = 0; @@ -100,4 +104,4 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIContentSerializer, NS_ICONTENTSERIALIZER_IID) #define NS_CONTENTSERIALIZER_CONTRACTID_PREFIX \ "@mozilla.org/layout/contentserializer;1?mimetype=" -#endif /* __gen_nsIContentSerializer_h__ */ +#endif /* nsIContentSerializer_h */ diff --git a/content/base/src/mozSanitizingSerializer.cpp b/content/base/src/mozSanitizingSerializer.cpp index 3f10d55dd95..b97621a89f2 100644 --- a/content/base/src/mozSanitizingSerializer.cpp +++ b/content/base/src/mozSanitizingSerializer.cpp @@ -63,8 +63,9 @@ #include "nsIURI.h" #include "nsNetUtil.h" #include "nsEscape.h" +#include "mozilla/dom/Element.h" -//#define DEBUG_BenB +using namespace mozilla::dom; static inline PRUnichar* escape(const nsString& source) { @@ -241,8 +242,8 @@ mozSanitizingHTMLSerializer::AppendText(nsIContent* aText, } NS_IMETHODIMP -mozSanitizingHTMLSerializer::AppendElementStart(nsIContent *aElement, - nsIContent *aOriginalElement, +mozSanitizingHTMLSerializer::AppendElementStart(Element* aElement, + Element* aOriginalElement, nsAString& aStr) { NS_ENSURE_ARG(aElement); @@ -270,7 +271,7 @@ mozSanitizingHTMLSerializer::AppendElementStart(nsIContent *aElement, } NS_IMETHODIMP -mozSanitizingHTMLSerializer::AppendElementEnd(nsIContent *aElement, +mozSanitizingHTMLSerializer::AppendElementEnd(Element* aElement, nsAString& aStr) { NS_ENSURE_ARG(aElement); diff --git a/content/base/src/mozSanitizingSerializer.h b/content/base/src/mozSanitizingSerializer.h index 9fd78a2b339..00feae04a31 100644 --- a/content/base/src/mozSanitizingSerializer.h +++ b/content/base/src/mozSanitizingSerializer.h @@ -89,10 +89,11 @@ public: { return NS_OK; } NS_IMETHOD AppendDoctype(nsIContent *aDoctype, nsAString& aStr) { return NS_OK; } - NS_IMETHOD AppendElementStart(nsIContent *aElement, - nsIContent *aOriginalElement, - nsAString& aStr); - NS_IMETHOD AppendElementEnd(nsIContent *aElement, nsAString& aStr); + NS_IMETHOD AppendElementStart(mozilla::dom::Element* aElement, + mozilla::dom::Element* aOriginalElement, + nsAString& aStr); + NS_IMETHOD AppendElementEnd(mozilla::dom::Element* aElement, + nsAString& aStr); NS_IMETHOD Flush(nsAString& aStr); NS_IMETHOD AppendDocumentStart(nsIDocument *aDocument, @@ -150,7 +151,7 @@ protected: PRUint32 mSkipLevel; nsHashtable mAllowedTags; - nsCOMPtr mContent; + nsRefPtr mContent; nsAString* mOutputString; nsIParserNode* mParserNode; nsCOMPtr mParserService; diff --git a/content/base/src/nsDocumentEncoder.cpp b/content/base/src/nsDocumentEncoder.cpp index 0a7b7eed498..f76846a4260 100644 --- a/content/base/src/nsDocumentEncoder.cpp +++ b/content/base/src/nsDocumentEncoder.cpp @@ -422,7 +422,7 @@ nsDocumentEncoder::SerializeNodeEnd(nsINode* aNode, return NS_OK; if (aNode->IsElement()) { - mSerializer->AppendElementEnd(static_cast(aNode), aStr); + mSerializer->AppendElementEnd(aNode->AsElement(), aStr); } return NS_OK; } diff --git a/content/base/src/nsHTMLContentSerializer.cpp b/content/base/src/nsHTMLContentSerializer.cpp index 550ddb9e31c..352fb0ce4a5 100644 --- a/content/base/src/nsHTMLContentSerializer.cpp +++ b/content/base/src/nsHTMLContentSerializer.cpp @@ -72,6 +72,9 @@ #include "nsIEditorDocShell.h" #include "nsIEditor.h" #include "nsIHTMLEditor.h" +#include "mozilla/dom/Element.h" + +using namespace mozilla::dom; static const PRInt32 kLongLineLen = 128; @@ -228,8 +231,8 @@ nsHTMLContentSerializer::SerializeHTMLAttributes(nsIContent* aContent, } NS_IMETHODIMP -nsHTMLContentSerializer::AppendElementStart(nsIContent *aElement, - nsIContent *aOriginalElement, +nsHTMLContentSerializer::AppendElementStart(Element* aElement, + Element* aOriginalElement, nsAString& aStr) { NS_ENSURE_ARG(aElement); @@ -342,7 +345,7 @@ nsHTMLContentSerializer::AppendElementStart(nsIContent *aElement, } NS_IMETHODIMP -nsHTMLContentSerializer::AppendElementEnd(nsIContent *aElement, +nsHTMLContentSerializer::AppendElementEnd(Element* aElement, nsAString& aStr) { NS_ENSURE_ARG(aElement); diff --git a/content/base/src/nsHTMLContentSerializer.h b/content/base/src/nsHTMLContentSerializer.h index 43e4a7eae9a..acd4792a120 100644 --- a/content/base/src/nsHTMLContentSerializer.h +++ b/content/base/src/nsHTMLContentSerializer.h @@ -57,11 +57,11 @@ class nsHTMLContentSerializer : public nsXHTMLContentSerializer { nsHTMLContentSerializer(); virtual ~nsHTMLContentSerializer(); - NS_IMETHOD AppendElementStart(nsIContent *aElement, - nsIContent *aOriginalElement, + NS_IMETHOD AppendElementStart(mozilla::dom::Element* aElement, + mozilla::dom::Element* aOriginalElement, nsAString& aStr); - - NS_IMETHOD AppendElementEnd(nsIContent *aElement, + + NS_IMETHOD AppendElementEnd(mozilla::dom::Element* aElement, nsAString& aStr); NS_IMETHOD AppendDocumentStart(nsIDocument *aDocument, diff --git a/content/base/src/nsPlainTextSerializer.cpp b/content/base/src/nsPlainTextSerializer.cpp index 6d815778055..6914b94efb3 100644 --- a/content/base/src/nsPlainTextSerializer.cpp +++ b/content/base/src/nsPlainTextSerializer.cpp @@ -57,6 +57,9 @@ #include "nsUnicharUtils.h" #include "nsCRT.h" #include "nsIParserService.h" +#include "mozilla/dom/Element.h" + +using namespace mozilla::dom; #define PREF_STRUCTS "converter.html2txt.structs" #define PREF_HEADER_STRATEGY "converter.html2txt.header_strategy" @@ -381,8 +384,8 @@ nsPlainTextSerializer::AppendCDATASection(nsIContent* aCDATASection, } NS_IMETHODIMP -nsPlainTextSerializer::AppendElementStart(nsIContent *aElement, - nsIContent *aOriginalElement, +nsPlainTextSerializer::AppendElementStart(Element* aElement, + Element* aOriginalElement, nsAString& aStr) { NS_ENSURE_ARG(aElement); @@ -414,7 +417,7 @@ nsPlainTextSerializer::AppendElementStart(nsIContent *aElement, } NS_IMETHODIMP -nsPlainTextSerializer::AppendElementEnd(nsIContent *aElement, +nsPlainTextSerializer::AppendElementEnd(Element* aElement, nsAString& aStr) { NS_ENSURE_ARG(aElement); diff --git a/content/base/src/nsPlainTextSerializer.h b/content/base/src/nsPlainTextSerializer.h index 457a1c8a4f7..919bb5152a9 100644 --- a/content/base/src/nsPlainTextSerializer.h +++ b/content/base/src/nsPlainTextSerializer.h @@ -56,6 +56,12 @@ #include "nsIDocumentEncoder.h" #include "nsTArray.h" +namespace mozilla { +namespace dom { +class Element; +} // namespace dom +} // namespace mozilla + class nsPlainTextSerializer : public nsIContentSerializer, public nsIHTMLContentSink, public nsIHTMLToTextSink @@ -84,10 +90,10 @@ public: PRInt32 aEndOffset, nsAString& aStr) { return NS_OK; } NS_IMETHOD AppendDoctype(nsIContent *aDoctype, nsAString& aStr) { return NS_OK; } - NS_IMETHOD AppendElementStart(nsIContent *aElement, - nsIContent *aOriginalElement, + NS_IMETHOD AppendElementStart(mozilla::dom::Element* aElement, + mozilla::dom::Element* aOriginalElement, nsAString& aStr); - NS_IMETHOD AppendElementEnd(nsIContent *aElement, + NS_IMETHOD AppendElementEnd(mozilla::dom::Element* aElement, nsAString& aStr); NS_IMETHOD Flush(nsAString& aStr); @@ -235,7 +241,7 @@ protected: section. mHeaderCounter[1] for

etc. */ - nsCOMPtr mContent; + nsRefPtr mContent; // For handling table rows nsAutoTArray mHasWrittenCellsForRow; diff --git a/content/base/src/nsXMLContentSerializer.cpp b/content/base/src/nsXMLContentSerializer.cpp index f2ed0706b6e..47ce17d9a46 100644 --- a/content/base/src/nsXMLContentSerializer.cpp +++ b/content/base/src/nsXMLContentSerializer.cpp @@ -64,6 +64,9 @@ #include "nsContentUtils.h" #include "nsAttrName.h" #include "nsILineBreaker.h" +#include "mozilla/dom/Element.h" + +using namespace mozilla::dom; static const char kMozStr[] = "moz"; @@ -915,8 +918,8 @@ nsXMLContentSerializer::SerializeAttributes(nsIContent* aContent, } NS_IMETHODIMP -nsXMLContentSerializer::AppendElementStart(nsIContent *aElement, - nsIContent *aOriginalElement, +nsXMLContentSerializer::AppendElementStart(Element* aElement, + Element* aOriginalElement, nsAString& aStr) { NS_ENSURE_ARG(aElement); @@ -1016,7 +1019,7 @@ nsXMLContentSerializer::AppendEndOfElementStart(nsIContent *aOriginalElement, } NS_IMETHODIMP -nsXMLContentSerializer::AppendElementEnd(nsIContent *aElement, +nsXMLContentSerializer::AppendElementEnd(Element* aElement, nsAString& aStr) { NS_ENSURE_ARG(aElement); diff --git a/content/base/src/nsXMLContentSerializer.h b/content/base/src/nsXMLContentSerializer.h index 3e24c055411..b65ee3925a4 100644 --- a/content/base/src/nsXMLContentSerializer.h +++ b/content/base/src/nsXMLContentSerializer.h @@ -88,11 +88,11 @@ class nsXMLContentSerializer : public nsIContentSerializer { NS_IMETHOD AppendDoctype(nsIContent *aDoctype, nsAString& aStr); - NS_IMETHOD AppendElementStart(nsIContent *aElement, - nsIContent *aOriginalElement, + NS_IMETHOD AppendElementStart(mozilla::dom::Element* aElement, + mozilla::dom::Element* aOriginalElement, nsAString& aStr); - - NS_IMETHOD AppendElementEnd(nsIContent *aElement, + + NS_IMETHOD AppendElementEnd(mozilla::dom::Element* aElement, nsAString& aStr); NS_IMETHOD Flush(nsAString& aStr) { return NS_OK; }