Bug 1690340 - Part 1: Hide all the panel tools in the developer tools menu. r=jdescottes
[gecko.git] / parser / htmlparser / nsIContentSink.h
blobd03429e83d4694630554eae98c7a8ecbff71dca6
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef nsIContentSink_h___
6 #define nsIContentSink_h___
8 /**
9 * MODULE NOTES:
10 * @update gess 4/1/98
12 * This pure virtual interface is used as the "glue" that connects the parsing
13 * process to the content model construction process.
15 * The icontentsink interface is a very lightweight wrapper that represents the
16 * content-sink model building process. There is another one that you may care
17 * about more, which is the IHTMLContentSink interface. (See that file for
18 * details).
20 #include "nsISupports.h"
21 #include "nsString.h"
22 #include "mozilla/FlushType.h"
23 #include "mozilla/NotNull.h"
24 #include "nsIDTD.h"
26 class nsParserBase;
27 namespace mozilla {
28 class Encoding;
31 #define NS_ICONTENT_SINK_IID \
32 { \
33 0xcf9a7cbb, 0xfcbc, 0x4e13, { \
34 0x8e, 0xf5, 0x18, 0xef, 0x2d, 0x3d, 0x58, 0x29 \
35 } \
38 class nsIContentSink : public nsISupports {
39 protected:
40 using Encoding = mozilla::Encoding;
41 template <typename T>
42 using NotNull = mozilla::NotNull<T>;
44 public:
45 NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONTENT_SINK_IID)
47 /**
48 * This method is called by the parser when it is entered from
49 * the event loop. The content sink wants to know how long the
50 * parser has been active since we last processed events on the
51 * main event loop and this call calibrates that measurement.
53 NS_IMETHOD WillParse(void) = 0;
55 /**
56 * This method gets called when the parser begins the process
57 * of building the content model via the content sink.
59 * Default implementation provided since the sink should have the option of
60 * doing nothing in response to this call.
62 * @update 5/7/98 gess
64 NS_IMETHOD WillBuildModel(nsDTDMode aDTDMode) { return NS_OK; }
66 /**
67 * This method gets called when the parser concludes the process
68 * of building the content model via the content sink.
70 * Default implementation provided since the sink should have the option of
71 * doing nothing in response to this call.
73 * @update 5/7/98 gess
75 NS_IMETHOD DidBuildModel(bool aTerminated) { return NS_OK; }
77 /**
78 * This method gets called when the parser gets i/o blocked,
79 * and wants to notify the sink that it may be a while before
80 * more data is available.
82 * @update 5/7/98 gess
84 NS_IMETHOD WillInterrupt(void) = 0;
86 /**
87 * This method gets called when the parser i/o gets unblocked,
88 * and we're about to start dumping content again to the sink.
90 * @update 5/7/98 gess
92 NS_IMETHOD WillResume(void) = 0;
94 /**
95 * This method gets called by the parser so that the content
96 * sink can retain a reference to the parser. The expectation
97 * is that the content sink will drop the reference when it
98 * gets the DidBuildModel notification i.e. when parsing is done.
100 NS_IMETHOD SetParser(nsParserBase* aParser) = 0;
103 * Flush content so that the content model is in sync with the state
104 * of the sink.
106 * @param aType the type of flush to perform
108 virtual void FlushPendingNotifications(mozilla::FlushType aType) = 0;
111 * Set the document character set. This should be passed on to the
112 * document itself.
114 virtual void SetDocumentCharset(NotNull<const Encoding*> aEncoding) = 0;
117 * Returns the target object (often a document object) into which
118 * the content built by this content sink is being added, if any
119 * (IOW, may return null).
121 virtual nsISupports* GetTarget() = 0;
124 * Returns true if there's currently script executing that we need to hold
125 * parsing for.
127 virtual bool IsScriptExecuting() { return false; }
130 * Posts a runnable that continues parsing.
132 virtual void ContinueInterruptedParsingAsync() {}
134 virtual void InitialTranslationCompleted() {}
137 NS_DEFINE_STATIC_IID_ACCESSOR(nsIContentSink, NS_ICONTENT_SINK_IID)
139 #endif /* nsIContentSink_h___ */