Bug 1890793: Assert CallArgs::newTarget is not gray. r=spidermonkey-reviewers,sfink...
[gecko.git] / dom / serializers / nsIContentSerializer.h
blob18e9e5b4cd76b70d0a637ad8a24699c682c6e281
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef nsIContentSerializer_h
8 #define nsIContentSerializer_h
10 #include "nsISupports.h"
11 #include "nsStringFwd.h"
13 class nsIContent;
15 namespace mozilla {
16 class Encoding;
17 namespace dom {
18 class Comment;
19 class Document;
20 class DocumentType;
21 class Element;
22 class ProcessingInstruction;
23 } // namespace dom
24 } // namespace mozilla
26 #define NS_ICONTENTSERIALIZER_IID \
27 { \
28 0xb1ee32f2, 0xb8c4, 0x49b9, { \
29 0x93, 0xdf, 0xb6, 0xfa, 0xb5, 0xd5, 0x46, 0x88 \
30 } \
33 class nsIContentSerializer : public nsISupports {
34 public:
35 NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONTENTSERIALIZER_IID)
37 /**
38 * @param aOutput The `Append*` methods will append to this string. The
39 * reference to it will be dropped with `Finish`.
41 NS_IMETHOD Init(uint32_t flags, uint32_t aWrapColumn,
42 const mozilla::Encoding* aEncoding, bool aIsCopying,
43 bool aIsWholeDocument, bool* aNeedsPerformatScanning,
44 nsAString& aOutput) = 0;
46 NS_IMETHOD AppendText(nsIContent* aText, int32_t aStartOffset,
47 int32_t aEndOffset) = 0;
49 NS_IMETHOD AppendCDATASection(nsIContent* aCDATASection, int32_t aStartOffset,
50 int32_t aEndOffset) = 0;
52 NS_IMETHOD AppendProcessingInstruction(
53 mozilla::dom::ProcessingInstruction* aPI, int32_t aStartOffset,
54 int32_t aEndOffset) = 0;
56 NS_IMETHOD AppendComment(mozilla::dom::Comment* aComment,
57 int32_t aStartOffset, int32_t aEndOffset) = 0;
59 NS_IMETHOD AppendDoctype(mozilla::dom::DocumentType* aDoctype) = 0;
61 NS_IMETHOD AppendElementStart(mozilla::dom::Element* aElement,
62 mozilla::dom::Element* aOriginalElement) = 0;
64 NS_IMETHOD AppendElementEnd(mozilla::dom::Element* aElement,
65 mozilla::dom::Element* aOriginalElement) = 0;
67 NS_IMETHOD FlushAndFinish() = 0;
69 /**
70 * Drops the reference to the output buffer.
72 NS_IMETHOD Finish() = 0;
74 NS_IMETHOD GetOutputLength(uint32_t& aLength) const = 0;
76 /**
77 * Append any items in the beginning of the document that won't be
78 * serialized by other methods. XML declaration is the most likely
79 * thing this method can produce.
81 NS_IMETHOD AppendDocumentStart(mozilla::dom::Document* aDocument) = 0;
83 // If Init() sets *aNeedsPerformatScanning to true, then these methods are
84 // called when elements are started and ended, before AppendElementStart
85 // and AppendElementEnd, respectively. They are supposed to be used to
86 // allow the implementer to keep track of whether the element is
87 // preformatted.
88 NS_IMETHOD ScanElementForPreformat(mozilla::dom::Element* aElement) = 0;
89 NS_IMETHOD ForgetElementForPreformat(mozilla::dom::Element* aElement) = 0;
92 NS_DEFINE_STATIC_IID_ACCESSOR(nsIContentSerializer, NS_ICONTENTSERIALIZER_IID)
94 #define NS_CONTENTSERIALIZER_CONTRACTID_PREFIX \
95 "@mozilla.org/layout/contentserializer;1?mimetype="
97 #endif /* nsIContentSerializer_h */