parser/html/nsHtml5StringParser.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/parser/html/nsHtml5StringParser.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,87 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#ifndef nsHtml5StringParser_h
     1.9 +#define nsHtml5StringParser_h
    1.10 +
    1.11 +#include "nsHtml5AtomTable.h"
    1.12 +#include "nsParserBase.h"
    1.13 +
    1.14 +class nsHtml5OplessBuilder;
    1.15 +class nsHtml5TreeBuilder;
    1.16 +class nsHtml5Tokenizer;
    1.17 +class nsIContent;
    1.18 +class nsIDocument;
    1.19 +
    1.20 +class nsHtml5StringParser : public nsParserBase
    1.21 +{
    1.22 +  public:
    1.23 +
    1.24 +    NS_DECL_ISUPPORTS
    1.25 +
    1.26 +    /**
    1.27 +     * Constructor for use ONLY by nsContentUtils. Others, please call the
    1.28 +     * nsContentUtils statics that wrap this.
    1.29 +     */
    1.30 +    nsHtml5StringParser();
    1.31 +    virtual ~nsHtml5StringParser();
    1.32 +
    1.33 +    /**
    1.34 +     * Invoke the fragment parsing algorithm (innerHTML).
    1.35 +     * DO NOT CALL from outside nsContentUtils.cpp.
    1.36 +     *
    1.37 +     * @param aSourceBuffer the string being set as innerHTML
    1.38 +     * @param aTargetNode the target container
    1.39 +     * @param aContextLocalName local name of context node
    1.40 +     * @param aContextNamespace namespace of context node
    1.41 +     * @param aQuirks true to make <table> not close <p>
    1.42 +     * @param aPreventScriptExecution true to prevent scripts from executing;
    1.43 +     * don't set to false when parsing into a target node that has been bound
    1.44 +     * to tree.
    1.45 +     */
    1.46 +    nsresult ParseFragment(const nsAString& aSourceBuffer,
    1.47 +                           nsIContent* aTargetNode,
    1.48 +                           nsIAtom* aContextLocalName,
    1.49 +                           int32_t aContextNamespace,
    1.50 +                           bool aQuirks,
    1.51 +                           bool aPreventScriptExecution);
    1.52 +
    1.53 +    /**
    1.54 +     * Parse an entire HTML document from a source string.
    1.55 +     * DO NOT CALL from outside nsContentUtils.cpp.
    1.56 +     *
    1.57 +     */
    1.58 +    nsresult ParseDocument(const nsAString& aSourceBuffer,
    1.59 +                           nsIDocument* aTargetDoc,
    1.60 +                           bool aScriptingEnabledForNoscriptParsing);
    1.61 +
    1.62 +  private:
    1.63 +
    1.64 +    nsresult Tokenize(const nsAString& aSourceBuffer,
    1.65 +                      nsIDocument* aDocument,
    1.66 +                      bool aScriptingEnabledForNoscriptParsing);
    1.67 +
    1.68 +    /**
    1.69 +     * The tree operation executor
    1.70 +     */
    1.71 +    nsRefPtr<nsHtml5OplessBuilder>      mBuilder;
    1.72 +
    1.73 +    /**
    1.74 +     * The HTML5 tree builder
    1.75 +     */
    1.76 +    const nsAutoPtr<nsHtml5TreeBuilder> mTreeBuilder;
    1.77 +
    1.78 +    /**
    1.79 +     * The HTML5 tokenizer
    1.80 +     */
    1.81 +    const nsAutoPtr<nsHtml5Tokenizer>   mTokenizer;
    1.82 +
    1.83 +    /**
    1.84 +     * The scoped atom table
    1.85 +     */
    1.86 +    nsHtml5AtomTable                    mAtomTable;
    1.87 +
    1.88 +};
    1.89 +
    1.90 +#endif // nsHtml5StringParser_h

mercurial