Bug 1728955: part 3) Add logging to `nsBaseClipboard`. r=masayuki
[gecko.git] / parser / html / nsHtml5StringParser.h
blob098a913748a1baa2e0eee997c4861a9e997163c9
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 "mozilla/UniquePtr.h"
9 #include "nsHtml5AtomTable.h"
10 #include "nsParserBase.h"
12 class nsHtml5OplessBuilder;
13 class nsHtml5TreeBuilder;
14 class nsHtml5Tokenizer;
15 class nsIContent;
16 namespace mozilla {
17 namespace dom {
18 class Document;
20 } // namespace mozilla
22 class nsHtml5StringParser : public nsParserBase {
23 public:
24 NS_DECL_ISUPPORTS
26 /**
27 * Constructor for use ONLY by nsContentUtils. Others, please call the
28 * nsContentUtils statics that wrap this.
30 nsHtml5StringParser();
32 /**
33 * Invoke the fragment parsing algorithm (innerHTML).
34 * DO NOT CALL from outside nsContentUtils.cpp.
36 * @param aSourceBuffer the string being set as innerHTML
37 * @param aTargetNode the target container
38 * @param aContextLocalName local name of context node
39 * @param aContextNamespace namespace of context node
40 * @param aQuirks true to make <table> not close <p>
41 * @param aPreventScriptExecution true to prevent scripts from executing;
42 * don't set to false when parsing into a target node that has been bound
43 * to tree.
45 nsresult ParseFragment(const nsAString& aSourceBuffer,
46 nsIContent* aTargetNode, nsAtom* aContextLocalName,
47 int32_t aContextNamespace, bool aQuirks,
48 bool aPreventScriptExecution);
50 /**
51 * Parse an entire HTML document from a source string.
52 * DO NOT CALL from outside nsContentUtils.cpp.
55 nsresult ParseDocument(const nsAString& aSourceBuffer,
56 mozilla::dom::Document* aTargetDoc,
57 bool aScriptingEnabledForNoscriptParsing);
59 private:
60 virtual ~nsHtml5StringParser();
62 nsresult Tokenize(const nsAString& aSourceBuffer,
63 mozilla::dom::Document* aDocument,
64 bool aScriptingEnabledForNoscriptParsing);
66 /**
67 * The tree operation executor
69 RefPtr<nsHtml5OplessBuilder> mBuilder;
71 /**
72 * The HTML5 tree builder
74 const mozilla::UniquePtr<nsHtml5TreeBuilder> mTreeBuilder;
76 /**
77 * The HTML5 tokenizer
79 const mozilla::UniquePtr<nsHtml5Tokenizer> mTokenizer;
81 /**
82 * The scoped atom table
84 nsHtml5AtomTable mAtomTable;
87 #endif // nsHtml5StringParser_h