1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 15:44:57 +00:00

LibWeb: Make HTMLDocumentParser take an existing document

We shouldn't really be creating the document objects inside the parser,
since that makes it hard to hook up e.g JavaScript bindings early on.
This commit is contained in:
Andreas Kling 2020-12-13 16:59:22 +01:00
parent 4dbecf0b65
commit 22c582a887
4 changed files with 14 additions and 19 deletions

View file

@ -63,8 +63,7 @@ RefPtr<DOM::Document> parse_html_document(const StringView&, const URL&, const S
class HTMLDocumentParser {
public:
HTMLDocumentParser(const StringView& input, const String& encoding);
HTMLDocumentParser(const StringView& input, const String& encoding, DOM::Document& existing_document);
HTMLDocumentParser(DOM::Document&, const StringView& input, const String& encoding);
~HTMLDocumentParser();
void run(const URL&);
@ -180,7 +179,7 @@ private:
bool m_stop_parsing { false };
size_t m_script_nesting_level { 0 };
RefPtr<DOM::Document> m_document;
NonnullRefPtr<DOM::Document> m_document;
RefPtr<HTMLHeadElement> m_head_element;
RefPtr<HTMLFormElement> m_form_element;
RefPtr<DOM::Element> m_context_element;