content/base/src/nsHTMLContentSerializer.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/base/src/nsHTMLContentSerializer.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,55 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +/*
    1.10 + * nsIContentSerializer implementation that can be used with an
    1.11 + * nsIDocumentEncoder to convert an HTML (not XHTML!) DOM to an HTML
    1.12 + * string that could be parsed into more or less the original DOM.
    1.13 + */
    1.14 +
    1.15 +#ifndef nsHTMLContentSerializer_h__
    1.16 +#define nsHTMLContentSerializer_h__
    1.17 +
    1.18 +#include "mozilla/Attributes.h"
    1.19 +#include "nsXHTMLContentSerializer.h"
    1.20 +#include "nsIEntityConverter.h"
    1.21 +#include "nsString.h"
    1.22 +
    1.23 +class nsIContent;
    1.24 +class nsIAtom;
    1.25 +
    1.26 +class nsHTMLContentSerializer : public nsXHTMLContentSerializer {
    1.27 + public:
    1.28 +  nsHTMLContentSerializer();
    1.29 +  virtual ~nsHTMLContentSerializer();
    1.30 +
    1.31 +  NS_IMETHOD AppendElementStart(mozilla::dom::Element* aElement,
    1.32 +                                mozilla::dom::Element* aOriginalElement,
    1.33 +                                nsAString& aStr) MOZ_OVERRIDE;
    1.34 +
    1.35 +  NS_IMETHOD AppendElementEnd(mozilla::dom::Element* aElement,
    1.36 +                              nsAString& aStr) MOZ_OVERRIDE;
    1.37 +
    1.38 +  NS_IMETHOD AppendDocumentStart(nsIDocument *aDocument,
    1.39 +                                 nsAString& aStr) MOZ_OVERRIDE;
    1.40 + protected:
    1.41 +
    1.42 +  virtual void SerializeHTMLAttributes(nsIContent* aContent,
    1.43 +                                       nsIContent *aOriginalElement,
    1.44 +                                       nsAString& aTagPrefix,
    1.45 +                                       const nsAString& aTagNamespaceURI,
    1.46 +                                       nsIAtom* aTagName,
    1.47 +                                       int32_t aNamespace,
    1.48 +                                       nsAString& aStr);
    1.49 +
    1.50 +  virtual void AppendAndTranslateEntities(const nsAString& aStr,
    1.51 +                                          nsAString& aOutputStr) MOZ_OVERRIDE;
    1.52 +
    1.53 +};
    1.54 +
    1.55 +nsresult
    1.56 +NS_NewHTMLContentSerializer(nsIContentSerializer** aSerializer);
    1.57 +
    1.58 +#endif

mercurial