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.

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

mercurial