tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsIFragmentContentSink.h (2710B)


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