Преглед изворни кода

LibWeb: Split out "The end" from the HTML parsing spec to a function

Also add a spec link and some comments.
Andreas Kling пре 3 година
родитељ
комит
e452550fda

+ 13 - 2
Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp

@@ -175,11 +175,22 @@ void HTMLParser::run(const AK::URL& url)
 
     flush_character_insertions();
 
-    // "The end"
+    the_end();
+}
+
+// https://html.spec.whatwg.org/multipage/parsing.html#the-end
+void HTMLParser::the_end()
+{
+    // Once the user agent stops parsing the document, the user agent must run the following steps:
+
+    // FIXME: 1. If the active speculative HTML parser is not null, then stop the speculative HTML parser and return.
+
+    // FIXME: 2. Set the insertion point to undefined.
 
+    // 3. Update the current document readiness to "interactive".
     m_document->set_ready_state("interactive");
 
-    // 3. Pop all the nodes off the stack of open elements.
+    // 4. Pop all the nodes off the stack of open elements.
     while (!m_stack_of_open_elements.is_empty())
         m_stack_of_open_elements.pop();
 

+ 2 - 0
Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.h

@@ -94,6 +94,8 @@ 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(const FlyString& exception = {});