parser/htmlparser/public/nsIFragmentContentSink.h

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:80646091348a
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 nsIFragmentContentSink_h___
6 #define nsIFragmentContentSink_h___
7
8 #include "nsISupports.h"
9
10 class nsIDOMDocumentFragment;
11 class nsIDocument;
12
13 #define NS_I_FRAGMENT_CONTENT_SINK_IID \
14 { 0x1a8ce30b, 0x63fc, 0x441a, \
15 { 0xa3, 0xaa, 0xf7, 0x16, 0xc0, 0xfe, 0x96, 0x69 } }
16
17 /**
18 * The fragment sink allows a client to parse a fragment of sink, possibly
19 * surrounded in context. Also see nsIParser::ParseFragment().
20 * Note: once you've parsed a fragment, the fragment sink must be re-set on
21 * the parser in order to parse another fragment.
22 */
23 class nsIFragmentContentSink : public nsISupports {
24 public:
25 NS_DECLARE_STATIC_IID_ACCESSOR(NS_I_FRAGMENT_CONTENT_SINK_IID)
26 /**
27 * This method is used to obtain the fragment created by
28 * a fragment content sink and to release resources held by the parser.
29 *
30 * The sink drops its reference to the fragment.
31 */
32 NS_IMETHOD FinishFragmentParsing(nsIDOMDocumentFragment** aFragment) = 0;
33
34 /**
35 * This method is used to set the target document for this fragment
36 * sink. This document's nodeinfo manager will be used to create
37 * the content objects. This MUST be called before the sink is used.
38 *
39 * @param aDocument the document the new nodes will belong to
40 * (should not be null)
41 */
42 NS_IMETHOD SetTargetDocument(nsIDocument* aDocument) = 0;
43
44 /**
45 * This method is used to indicate to the sink that we're done building
46 * the context and should start paying attention to the incoming content
47 */
48 NS_IMETHOD WillBuildContent() = 0;
49
50 /**
51 * This method is used to indicate to the sink that we're done building
52 * The real content. This is useful if you want to parse additional context
53 * (such as an end context).
54 */
55 NS_IMETHOD DidBuildContent() = 0;
56
57 /**
58 * This method is a total hack to help with parsing fragments. It is called to
59 * tell the fragment sink that a container from the context will be delivered
60 * after the call to WillBuildContent(). This is only relevent for HTML
61 * fragments that use nsHTMLTokenizer/CNavDTD.
62 */
63 NS_IMETHOD IgnoreFirstContainer() = 0;
64
65 /**
66 * Sets whether scripts elements are marked as unexecutable.
67 */
68 NS_IMETHOD SetPreventScriptExecution(bool aPreventScriptExecution) = 0;
69 };
70
71 NS_DEFINE_STATIC_IID_ACCESSOR(nsIFragmentContentSink,
72 NS_I_FRAGMENT_CONTENT_SINK_IID)
73
74 nsresult
75 NS_NewXMLFragmentContentSink(nsIFragmentContentSink** aInstancePtrResult);
76
77 #endif

mercurial