Bumping gaia.json for 2 gaia revision(s) a=gaia-bump
[gecko.git] / parser / html / nsHtml5StringParser.h
blob1c258be4e53e220ab5df6ef6a809b91de1491ed4
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
19 public:
21 NS_DECL_ISUPPORTS
23 /**
24 * Constructor for use ONLY by nsContentUtils. Others, please call the
25 * nsContentUtils statics that wrap this.
27 nsHtml5StringParser();
29 /**
30 * Invoke the fragment parsing algorithm (innerHTML).
31 * DO NOT CALL from outside nsContentUtils.cpp.
33 * @param aSourceBuffer the string being set as innerHTML
34 * @param aTargetNode the target container
35 * @param aContextLocalName local name of context node
36 * @param aContextNamespace namespace of context node
37 * @param aQuirks true to make <table> not close <p>
38 * @param aPreventScriptExecution true to prevent scripts from executing;
39 * don't set to false when parsing into a target node that has been bound
40 * to tree.
42 nsresult ParseFragment(const nsAString& aSourceBuffer,
43 nsIContent* aTargetNode,
44 nsIAtom* aContextLocalName,
45 int32_t aContextNamespace,
46 bool aQuirks,
47 bool aPreventScriptExecution);
49 /**
50 * Parse an entire HTML document from a source string.
51 * DO NOT CALL from outside nsContentUtils.cpp.
54 nsresult ParseDocument(const nsAString& aSourceBuffer,
55 nsIDocument* aTargetDoc,
56 bool aScriptingEnabledForNoscriptParsing);
58 private:
60 virtual ~nsHtml5StringParser();
62 nsresult Tokenize(const nsAString& aSourceBuffer,
63 nsIDocument* aDocument,
64 bool aScriptingEnabledForNoscriptParsing);
66 /**
67 * The tree operation executor
69 nsRefPtr<nsHtml5OplessBuilder> mBuilder;
71 /**
72 * The HTML5 tree builder
74 const nsAutoPtr<nsHtml5TreeBuilder> mTreeBuilder;
76 /**
77 * The HTML5 tokenizer
79 const nsAutoPtr<nsHtml5Tokenizer> mTokenizer;
81 /**
82 * The scoped atom table
84 nsHtml5AtomTable mAtomTable;
88 #endif // nsHtml5StringParser_h