parser/htmlparser/public/nsIFragmentContentSink.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial