2001-09-26 04:40:45 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1998-07-16 02:30:39 +04:00
|
|
|
#ifndef nsIContentSink_h___
|
|
|
|
#define nsIContentSink_h___
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* MODULE NOTES:
|
|
|
|
* @update gess 4/1/98
|
|
|
|
*
|
1998-07-23 12:21:02 +04:00
|
|
|
* This pure virtual interface is used as the "glue" that connects the parsing
|
|
|
|
* process to the content model construction process.
|
|
|
|
*
|
|
|
|
* The icontentsink interface is a very lightweight wrapper that represents the
|
|
|
|
* content-sink model building process. There is another one that you may care
|
|
|
|
* about more, which is the IHTMLContentSink interface. (See that file for details).
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
|
|
|
#include "nsISupports.h"
|
2013-09-23 21:25:00 +04:00
|
|
|
#include "nsString.h"
|
2017-01-05 09:54:02 +03:00
|
|
|
#include "mozilla/FlushType.h"
|
2017-06-18 14:37:50 +03:00
|
|
|
#include "mozilla/NotNull.h"
|
2009-06-24 01:22:16 +04:00
|
|
|
#include "nsIDTD.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2012-01-20 15:16:27 +04:00
|
|
|
class nsParserBase;
|
2017-06-18 14:37:50 +03:00
|
|
|
namespace mozilla {
|
|
|
|
class Encoding;
|
|
|
|
}
|
1998-12-11 20:02:37 +03:00
|
|
|
|
1998-07-16 02:30:39 +04:00
|
|
|
#define NS_ICONTENT_SINK_IID \
|
2012-01-20 15:16:27 +04:00
|
|
|
{ 0xcf9a7cbb, 0xfcbc, 0x4e13, \
|
|
|
|
{ 0x8e, 0xf5, 0x18, 0xef, 0x2d, 0x3d, 0x58, 0x29 } }
|
2005-08-25 00:56:58 +04:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
class nsIContentSink : public nsISupports {
|
2017-06-18 14:37:50 +03:00
|
|
|
protected:
|
|
|
|
using Encoding = mozilla::Encoding;
|
|
|
|
template <typename T> using NotNull = mozilla::NotNull<T>;
|
1998-07-16 02:30:39 +04:00
|
|
|
public:
|
1999-09-11 03:19:15 +04:00
|
|
|
|
2005-11-11 17:36:26 +03:00
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONTENT_SINK_IID)
|
1999-09-11 03:19:15 +04:00
|
|
|
|
2007-01-31 00:21:06 +03:00
|
|
|
/**
|
2008-10-31 00:31:00 +03:00
|
|
|
* This method is called by the parser when it is entered from
|
|
|
|
* the event loop. The content sink wants to know how long the
|
|
|
|
* parser has been active since we last processed events on the
|
|
|
|
* main event loop and this call calibrates that measurement.
|
2007-01-31 00:21:06 +03:00
|
|
|
*/
|
2008-10-31 00:31:00 +03:00
|
|
|
NS_IMETHOD WillParse(void)=0;
|
2007-01-31 00:21:06 +03:00
|
|
|
|
1998-07-16 02:30:39 +04:00
|
|
|
/**
|
|
|
|
* This method gets called when the parser begins the process
|
|
|
|
* of building the content model via the content sink.
|
|
|
|
*
|
2009-06-24 01:22:16 +04:00
|
|
|
* Default implementation provided since the sink should have the option of
|
|
|
|
* doing nothing in response to this call.
|
|
|
|
*
|
1998-07-16 02:30:39 +04:00
|
|
|
* @update 5/7/98 gess
|
2008-10-31 00:31:00 +03:00
|
|
|
*/
|
2009-06-24 01:22:16 +04:00
|
|
|
NS_IMETHOD WillBuildModel(nsDTDMode aDTDMode) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
1998-05-08 01:11:07 +04:00
|
|
|
|
1998-07-16 02:30:39 +04:00
|
|
|
/**
|
|
|
|
* This method gets called when the parser concludes the process
|
|
|
|
* of building the content model via the content sink.
|
|
|
|
*
|
2009-06-24 01:22:16 +04:00
|
|
|
* Default implementation provided since the sink should have the option of
|
|
|
|
* doing nothing in response to this call.
|
|
|
|
*
|
1998-07-16 02:30:39 +04:00
|
|
|
* @update 5/7/98 gess
|
2008-10-31 00:31:00 +03:00
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHOD DidBuildModel(bool aTerminated) {
|
2009-06-24 01:22:16 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
1998-05-08 01:11:07 +04:00
|
|
|
|
1998-07-16 02:30:39 +04:00
|
|
|
/**
|
|
|
|
* This method gets called when the parser gets i/o blocked,
|
|
|
|
* and wants to notify the sink that it may be a while before
|
|
|
|
* more data is available.
|
|
|
|
*
|
|
|
|
* @update 5/7/98 gess
|
2008-10-31 00:31:00 +03:00
|
|
|
*/
|
1998-07-16 02:30:39 +04:00
|
|
|
NS_IMETHOD WillInterrupt(void)=0;
|
1998-05-08 01:11:07 +04:00
|
|
|
|
|
|
|
/**
|
1998-07-16 02:30:39 +04:00
|
|
|
* This method gets called when the parser i/o gets unblocked,
|
|
|
|
* and we're about to start dumping content again to the sink.
|
|
|
|
*
|
|
|
|
* @update 5/7/98 gess
|
2008-10-31 00:31:00 +03:00
|
|
|
*/
|
1998-07-16 02:30:39 +04:00
|
|
|
NS_IMETHOD WillResume(void)=0;
|
1998-05-08 01:11:07 +04:00
|
|
|
|
1998-12-11 20:02:37 +03:00
|
|
|
/**
|
|
|
|
* This method gets called by the parser so that the content
|
|
|
|
* sink can retain a reference to the parser. The expectation
|
|
|
|
* is that the content sink will drop the reference when it
|
|
|
|
* gets the DidBuildModel notification i.e. when parsing is done.
|
|
|
|
*/
|
2012-01-20 15:16:27 +04:00
|
|
|
NS_IMETHOD SetParser(nsParserBase* aParser)=0;
|
1998-12-11 20:02:37 +03:00
|
|
|
|
2000-01-24 09:43:15 +03:00
|
|
|
/**
|
2004-05-28 02:08:42 +04:00
|
|
|
* Flush content so that the content model is in sync with the state
|
|
|
|
* of the sink.
|
|
|
|
*
|
2005-08-25 00:56:58 +04:00
|
|
|
* @param aType the type of flush to perform
|
2000-01-24 09:43:15 +03:00
|
|
|
*/
|
2017-01-05 10:31:56 +03:00
|
|
|
virtual void FlushPendingNotifications(mozilla::FlushType aType)=0;
|
2001-06-30 02:56:58 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the document character set. This should be passed on to the
|
|
|
|
* document itself.
|
|
|
|
*/
|
2017-06-18 14:37:50 +03:00
|
|
|
virtual void SetDocumentCharset(NotNull<const Encoding*> aEncoding) = 0;
|
2004-11-02 22:52:32 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the target object (often a document object) into which
|
|
|
|
* the content built by this content sink is being added, if any
|
|
|
|
* (IOW, may return null).
|
|
|
|
*/
|
|
|
|
virtual nsISupports *GetTarget()=0;
|
2009-04-16 02:34:50 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if there's currently script executing that we need to hold
|
|
|
|
* parsing for.
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool IsScriptExecuting()
|
2009-04-16 02:34:50 +04:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2009-04-16 02:34:50 +04:00
|
|
|
}
|
|
|
|
|
2012-01-20 15:16:27 +04:00
|
|
|
/**
|
|
|
|
* Posts a runnable that continues parsing.
|
|
|
|
*/
|
2012-07-15 18:06:09 +04:00
|
|
|
virtual void ContinueInterruptedParsingAsync() {}
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
2005-11-11 17:36:26 +03:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsIContentSink, NS_ICONTENT_SINK_IID)
|
|
|
|
|
1998-07-16 02:30:39 +04:00
|
|
|
#endif /* nsIContentSink_h___ */
|