1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 07:25:07 +00:00

LibWeb: Make HTMLParser::the_end() callable from outside

This is a little awkward: The spec requires when loading media documents
or ones that don't have a DOM, that we "act as if the user agent had
stopped parsing document" which means following this algorithm. Only a
few steps require an HTMLParser, but those that do, involve reaching
into its internals. The simplest solution I could think of (other than
duplicating this fairly hefty function) is making it static and taking
a Document and optional HTMLParser as parameters.
This commit is contained in:
Sam Atkins 2023-12-19 12:51:34 +00:00 committed by Andreas Kling
parent a20951fbc0
commit 6ffda5f271
2 changed files with 29 additions and 19 deletions

View file

@ -56,6 +56,8 @@ public:
void run();
void run(const AK::URL&);
static void the_end(JS::NonnullGCPtr<DOM::Document>, JS::GCPtr<HTMLParser> = nullptr);
DOM::Document& document();
static Vector<JS::Handle<DOM::Node>> parse_html_fragment(DOM::Element& context_element, StringView);
@ -115,8 +117,6 @@ private:
void handle_after_frameset(HTMLToken&);
void handle_after_after_frameset(HTMLToken&);
void the_end();
void stop_parsing() { m_stop_parsing = true; }
void generate_implied_end_tags(FlyString const& exception = {});