parser/html/nsHtml5StringParser.h

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #ifndef nsHtml5StringParser_h
     6 #define nsHtml5StringParser_h
     8 #include "nsHtml5AtomTable.h"
     9 #include "nsParserBase.h"
    11 class nsHtml5OplessBuilder;
    12 class nsHtml5TreeBuilder;
    13 class nsHtml5Tokenizer;
    14 class nsIContent;
    15 class nsIDocument;
    17 class nsHtml5StringParser : public nsParserBase
    18 {
    19   public:
    21     NS_DECL_ISUPPORTS
    23     /**
    24      * Constructor for use ONLY by nsContentUtils. Others, please call the
    25      * nsContentUtils statics that wrap this.
    26      */
    27     nsHtml5StringParser();
    28     virtual ~nsHtml5StringParser();
    30     /**
    31      * Invoke the fragment parsing algorithm (innerHTML).
    32      * DO NOT CALL from outside nsContentUtils.cpp.
    33      *
    34      * @param aSourceBuffer the string being set as innerHTML
    35      * @param aTargetNode the target container
    36      * @param aContextLocalName local name of context node
    37      * @param aContextNamespace namespace of context node
    38      * @param aQuirks true to make <table> not close <p>
    39      * @param aPreventScriptExecution true to prevent scripts from executing;
    40      * don't set to false when parsing into a target node that has been bound
    41      * to tree.
    42      */
    43     nsresult ParseFragment(const nsAString& aSourceBuffer,
    44                            nsIContent* aTargetNode,
    45                            nsIAtom* aContextLocalName,
    46                            int32_t aContextNamespace,
    47                            bool aQuirks,
    48                            bool aPreventScriptExecution);
    50     /**
    51      * Parse an entire HTML document from a source string.
    52      * DO NOT CALL from outside nsContentUtils.cpp.
    53      *
    54      */
    55     nsresult ParseDocument(const nsAString& aSourceBuffer,
    56                            nsIDocument* aTargetDoc,
    57                            bool aScriptingEnabledForNoscriptParsing);
    59   private:
    61     nsresult Tokenize(const nsAString& aSourceBuffer,
    62                       nsIDocument* aDocument,
    63                       bool aScriptingEnabledForNoscriptParsing);
    65     /**
    66      * The tree operation executor
    67      */
    68     nsRefPtr<nsHtml5OplessBuilder>      mBuilder;
    70     /**
    71      * The HTML5 tree builder
    72      */
    73     const nsAutoPtr<nsHtml5TreeBuilder> mTreeBuilder;
    75     /**
    76      * The HTML5 tokenizer
    77      */
    78     const nsAutoPtr<nsHtml5Tokenizer>   mTokenizer;
    80     /**
    81      * The scoped atom table
    82      */
    83     nsHtml5AtomTable                    mAtomTable;
    85 };
    87 #endif // nsHtml5StringParser_h

mercurial