michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsHtml5StringParser_h michael@0: #define nsHtml5StringParser_h michael@0: michael@0: #include "nsHtml5AtomTable.h" michael@0: #include "nsParserBase.h" michael@0: michael@0: class nsHtml5OplessBuilder; michael@0: class nsHtml5TreeBuilder; michael@0: class nsHtml5Tokenizer; michael@0: class nsIContent; michael@0: class nsIDocument; michael@0: michael@0: class nsHtml5StringParser : public nsParserBase michael@0: { michael@0: public: michael@0: michael@0: NS_DECL_ISUPPORTS michael@0: michael@0: /** michael@0: * Constructor for use ONLY by nsContentUtils. Others, please call the michael@0: * nsContentUtils statics that wrap this. michael@0: */ michael@0: nsHtml5StringParser(); michael@0: virtual ~nsHtml5StringParser(); michael@0: michael@0: /** michael@0: * Invoke the fragment parsing algorithm (innerHTML). michael@0: * DO NOT CALL from outside nsContentUtils.cpp. michael@0: * michael@0: * @param aSourceBuffer the string being set as innerHTML michael@0: * @param aTargetNode the target container michael@0: * @param aContextLocalName local name of context node michael@0: * @param aContextNamespace namespace of context node michael@0: * @param aQuirks true to make not close

michael@0: * @param aPreventScriptExecution true to prevent scripts from executing; michael@0: * don't set to false when parsing into a target node that has been bound michael@0: * to tree. michael@0: */ michael@0: nsresult ParseFragment(const nsAString& aSourceBuffer, michael@0: nsIContent* aTargetNode, michael@0: nsIAtom* aContextLocalName, michael@0: int32_t aContextNamespace, michael@0: bool aQuirks, michael@0: bool aPreventScriptExecution); michael@0: michael@0: /** michael@0: * Parse an entire HTML document from a source string. michael@0: * DO NOT CALL from outside nsContentUtils.cpp. michael@0: * michael@0: */ michael@0: nsresult ParseDocument(const nsAString& aSourceBuffer, michael@0: nsIDocument* aTargetDoc, michael@0: bool aScriptingEnabledForNoscriptParsing); michael@0: michael@0: private: michael@0: michael@0: nsresult Tokenize(const nsAString& aSourceBuffer, michael@0: nsIDocument* aDocument, michael@0: bool aScriptingEnabledForNoscriptParsing); michael@0: michael@0: /** michael@0: * The tree operation executor michael@0: */ michael@0: nsRefPtr mBuilder; michael@0: michael@0: /** michael@0: * The HTML5 tree builder michael@0: */ michael@0: const nsAutoPtr mTreeBuilder; michael@0: michael@0: /** michael@0: * The HTML5 tokenizer michael@0: */ michael@0: const nsAutoPtr mTokenizer; michael@0: michael@0: /** michael@0: * The scoped atom table michael@0: */ michael@0: nsHtml5AtomTable mAtomTable; michael@0: michael@0: }; michael@0: michael@0: #endif // nsHtml5StringParser_h