michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* michael@0: * nsIContentSerializer implementation that can be used with an michael@0: * nsIDocumentEncoder to convert an HTML (not XHTML!) DOM to an HTML michael@0: * string that could be parsed into more or less the original DOM. michael@0: */ michael@0: michael@0: #ifndef nsHTMLContentSerializer_h__ michael@0: #define nsHTMLContentSerializer_h__ michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "nsXHTMLContentSerializer.h" michael@0: #include "nsIEntityConverter.h" michael@0: #include "nsString.h" michael@0: michael@0: class nsIContent; michael@0: class nsIAtom; michael@0: michael@0: class nsHTMLContentSerializer : public nsXHTMLContentSerializer { michael@0: public: michael@0: nsHTMLContentSerializer(); michael@0: virtual ~nsHTMLContentSerializer(); michael@0: michael@0: NS_IMETHOD AppendElementStart(mozilla::dom::Element* aElement, michael@0: mozilla::dom::Element* aOriginalElement, michael@0: nsAString& aStr) MOZ_OVERRIDE; michael@0: michael@0: NS_IMETHOD AppendElementEnd(mozilla::dom::Element* aElement, michael@0: nsAString& aStr) MOZ_OVERRIDE; michael@0: michael@0: NS_IMETHOD AppendDocumentStart(nsIDocument *aDocument, michael@0: nsAString& aStr) MOZ_OVERRIDE; michael@0: protected: michael@0: michael@0: virtual void SerializeHTMLAttributes(nsIContent* aContent, michael@0: nsIContent *aOriginalElement, michael@0: nsAString& aTagPrefix, michael@0: const nsAString& aTagNamespaceURI, michael@0: nsIAtom* aTagName, michael@0: int32_t aNamespace, michael@0: nsAString& aStr); michael@0: michael@0: virtual void AppendAndTranslateEntities(const nsAString& aStr, michael@0: nsAString& aOutputStr) MOZ_OVERRIDE; michael@0: michael@0: }; michael@0: michael@0: nsresult michael@0: NS_NewHTMLContentSerializer(nsIContentSerializer** aSerializer); michael@0: michael@0: #endif