LibWeb: Store a SpeculativeHTMLParser on the HTML Parser

The parser was previously added, but unused. Actually attaching one to
the HTML Parser will let us test the limits of Swift interop.
This commit is contained in:
Andrew Kaster 2025-04-04 09:20:27 -06:00 committed by Andrew Kaster
parent 3c45d155a6
commit 8cfac6ed71
Notes: github-actions[bot] 2025-04-16 15:03:28 +00:00
3 changed files with 39 additions and 4 deletions

View file

@ -14,6 +14,14 @@
#include <LibWeb/HTML/Parser/StackOfOpenElements.h>
#include <LibWeb/MimeSniff/MimeType.h>
#ifdef LIBWEB_USE_SWIFT
# include <LibGC/ForeignCell.h>
namespace Web {
class SpeculativeHTMLParser;
}
#endif
namespace Web::HTML {
#define ENUMERATE_INSERTION_MODES \
@ -96,6 +104,7 @@ private:
HTMLParser(DOM::Document&);
virtual void visit_edges(Cell::Visitor&) override;
virtual void initialize(JS::Realm&) override;
char const* insertion_mode_name() const;
@ -210,6 +219,10 @@ private:
GC::Ptr<HTMLFormElement> m_form_element;
GC::Ptr<DOM::Element> m_context_element;
#ifdef LIBWEB_USE_SWIFT
GC::ForeignPtr<Web::SpeculativeHTMLParser> m_speculative_parser;
#endif
Vector<HTMLToken> m_pending_table_character_tokens;
GC::Ptr<DOM::Text> m_character_insertion_node;