parser/htmlparser/public/nsIHTMLContentSink.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.

     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 nsIHTMLContentSink_h___
     6 #define nsIHTMLContentSink_h___
     8 /**
     9  * This interface is OBSOLETE and in the process of being REMOVED.
    10  * Do NOT implement!
    11  *
    12  * This file declares the concrete HTMLContentSink class.
    13  * This class is used during the parsing process as the
    14  * primary interface between the parser and the content
    15  * model.
    16  *
    17  * After the tokenizer completes, the parser iterates over
    18  * the known token list. As the parser identifies valid 
    19  * elements, it calls the contentsink interface to notify
    20  * the content model that a new node or child node is being
    21  * created and added to the content model.
    22  *
    23  * The HTMLContentSink interface assumes 4 underlying
    24  * containers: HTML, HEAD, BODY and FRAMESET. Before 
    25  * accessing any these, the parser will call the appropriate
    26  * OpennsIHTMLContentSink method: OpenHTML,OpenHead,OpenBody,OpenFrameSet;
    27  * likewise, the ClosensIHTMLContentSink version will be called when the
    28  * parser is done with a given section.
    29  *
    30  * IMPORTANT: The parser may Open each container more than
    31  * once! This is due to the irregular nature of HTML files.
    32  * For example, it is possible to encounter plain text at
    33  * the start of an HTML document (that precedes the HTML tag).
    34  * Such text is treated as if it were part of the body.
    35  * In such cases, the parser will Open the body, pass the text-
    36  * node in and then Close the body. The body will likely be
    37  * re-Opened later when the actual <BODY> tag has been seen.
    38  *
    39  * Containers within the body are Opened and Closed
    40  * using the OpenContainer(...) and CloseContainer(...) calls.
    41  * It is assumed that the document or contentSink is 
    42  * maintaining its state to manage where new content should 
    43  * be added to the underlying document.
    44  *
    45  * NOTE: OpenHTML() and OpenBody() may get called multiple times
    46  *       in the same document. That's fine, and it doesn't mean
    47  *       that we have multiple bodies or HTML's.
    48  *
    49  * NOTE: I haven't figured out how sub-documents (non-frames)
    50  *       are going to be handled. Stay tuned.
    51  */
    52 #include "nsIContentSink.h"
    53 #include "nsHTMLTags.h"
    55 #define NS_IHTML_CONTENT_SINK_IID \
    56   {0xefc5af86, 0x5cfd, 0x4918, {0x9d, 0xd3, 0x5f, 0x7a, 0xb2, 0x88, 0xb2, 0x68}}
    58 /**
    59  * This interface is OBSOLETE and in the process of being REMOVED.
    60  * Do NOT implement!
    61  */
    62 class nsIHTMLContentSink : public nsIContentSink 
    63 {
    64 public:
    66   NS_DECLARE_STATIC_IID_ACCESSOR(NS_IHTML_CONTENT_SINK_IID)
    68   enum ElementType { eHTML, eBody };
    70     /**
    71    * This method is used to open a generic container in the sink.
    72    *
    73    * @update 4/1/98 gess
    74    */     
    75   NS_IMETHOD OpenContainer(ElementType aNodeType) = 0;
    77   /**
    78    *  This method gets called by the parser when a close
    79    *  container tag has been consumed and needs to be closed.
    80    *
    81    * @param  aTag - The tag to be closed.
    82    */     
    83   NS_IMETHOD CloseContainer(ElementType aTag) = 0;
    84 };
    86 NS_DEFINE_STATIC_IID_ACCESSOR(nsIHTMLContentSink, NS_IHTML_CONTENT_SINK_IID)
    88 #endif /* nsIHTMLContentSink_h___ */

mercurial