1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/parser/htmlparser/public/nsIFragmentContentSink.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,77 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 +#ifndef nsIFragmentContentSink_h___ 1.9 +#define nsIFragmentContentSink_h___ 1.10 + 1.11 +#include "nsISupports.h" 1.12 + 1.13 +class nsIDOMDocumentFragment; 1.14 +class nsIDocument; 1.15 + 1.16 +#define NS_I_FRAGMENT_CONTENT_SINK_IID \ 1.17 + { 0x1a8ce30b, 0x63fc, 0x441a, \ 1.18 + { 0xa3, 0xaa, 0xf7, 0x16, 0xc0, 0xfe, 0x96, 0x69 } } 1.19 + 1.20 +/** 1.21 + * The fragment sink allows a client to parse a fragment of sink, possibly 1.22 + * surrounded in context. Also see nsIParser::ParseFragment(). 1.23 + * Note: once you've parsed a fragment, the fragment sink must be re-set on 1.24 + * the parser in order to parse another fragment. 1.25 + */ 1.26 +class nsIFragmentContentSink : public nsISupports { 1.27 +public: 1.28 + NS_DECLARE_STATIC_IID_ACCESSOR(NS_I_FRAGMENT_CONTENT_SINK_IID) 1.29 + /** 1.30 + * This method is used to obtain the fragment created by 1.31 + * a fragment content sink and to release resources held by the parser. 1.32 + * 1.33 + * The sink drops its reference to the fragment. 1.34 + */ 1.35 + NS_IMETHOD FinishFragmentParsing(nsIDOMDocumentFragment** aFragment) = 0; 1.36 + 1.37 + /** 1.38 + * This method is used to set the target document for this fragment 1.39 + * sink. This document's nodeinfo manager will be used to create 1.40 + * the content objects. This MUST be called before the sink is used. 1.41 + * 1.42 + * @param aDocument the document the new nodes will belong to 1.43 + * (should not be null) 1.44 + */ 1.45 + NS_IMETHOD SetTargetDocument(nsIDocument* aDocument) = 0; 1.46 + 1.47 + /** 1.48 + * This method is used to indicate to the sink that we're done building 1.49 + * the context and should start paying attention to the incoming content 1.50 + */ 1.51 + NS_IMETHOD WillBuildContent() = 0; 1.52 + 1.53 + /** 1.54 + * This method is used to indicate to the sink that we're done building 1.55 + * The real content. This is useful if you want to parse additional context 1.56 + * (such as an end context). 1.57 + */ 1.58 + NS_IMETHOD DidBuildContent() = 0; 1.59 + 1.60 + /** 1.61 + * This method is a total hack to help with parsing fragments. It is called to 1.62 + * tell the fragment sink that a container from the context will be delivered 1.63 + * after the call to WillBuildContent(). This is only relevent for HTML 1.64 + * fragments that use nsHTMLTokenizer/CNavDTD. 1.65 + */ 1.66 + NS_IMETHOD IgnoreFirstContainer() = 0; 1.67 + 1.68 + /** 1.69 + * Sets whether scripts elements are marked as unexecutable. 1.70 + */ 1.71 + NS_IMETHOD SetPreventScriptExecution(bool aPreventScriptExecution) = 0; 1.72 +}; 1.73 + 1.74 +NS_DEFINE_STATIC_IID_ACCESSOR(nsIFragmentContentSink, 1.75 + NS_I_FRAGMENT_CONTENT_SINK_IID) 1.76 + 1.77 +nsresult 1.78 +NS_NewXMLFragmentContentSink(nsIFragmentContentSink** aInstancePtrResult); 1.79 + 1.80 +#endif