mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 10:37:17 +02: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:
Notes:
sideshowbarker
2024-07-19 00:53:37 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/22c582a887c
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user