1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:48:10 +00:00

LibWeb: Implement more of the "after head" insertion mode

This commit is contained in:
Andreas Kling 2020-05-31 19:27:51 +02:00
parent 600fcd2d46
commit 8429551368

View file

@ -452,25 +452,24 @@ void HTMLDocumentParser::insert_character(u32 data)
void HTMLDocumentParser::handle_after_head(HTMLToken& token) void HTMLDocumentParser::handle_after_head(HTMLToken& token)
{ {
if (token.is_character()) { if (token.is_character() && token.is_parser_whitespace()) {
if (token.is_parser_whitespace()) { insert_character(token.codepoint());
insert_character(token.codepoint()); return;
return;
}
TODO();
} }
if (token.is_comment()) { if (token.is_comment()) {
TODO(); insert_comment(token);
return;
} }
if (token.is_doctype()) { if (token.is_doctype()) {
TODO(); PARSE_ERROR();
return;
} }
if (token.is_start_tag() && token.tag_name() == "html") { if (token.is_start_tag() && token.tag_name() == "html") {
TODO(); process_using_the_rules_for(InsertionMode::InBody, token);
return;
} }
if (token.is_start_tag() && token.tag_name() == "body") { if (token.is_start_tag() && token.tag_name() == "body") {
@ -481,7 +480,9 @@ void HTMLDocumentParser::handle_after_head(HTMLToken& token)
} }
if (token.is_start_tag() && token.tag_name() == "frameset") { if (token.is_start_tag() && token.tag_name() == "frameset") {
TODO(); insert_html_element(token);
m_insertion_mode = InsertionMode::InFrameset;
return;
} }
if (token.is_start_tag() && token.tag_name().is_one_of("base", "basefont", "bgsound", "link", "meta", "noframes", "script", "style", "template", "title")) { if (token.is_start_tag() && token.tag_name().is_one_of("base", "basefont", "bgsound", "link", "meta", "noframes", "script", "style", "template", "title")) {
@ -503,7 +504,8 @@ void HTMLDocumentParser::handle_after_head(HTMLToken& token)
} }
if ((token.is_start_tag() && token.tag_name() == "head") || token.is_end_tag()) { if ((token.is_start_tag() && token.tag_name() == "head") || token.is_end_tag()) {
TODO(); PARSE_ERROR();
return;
} }
AnythingElse: AnythingElse:
@ -512,7 +514,7 @@ AnythingElse:
fake_body_token.m_tag.tag_name.append("body"); fake_body_token.m_tag.tag_name.append("body");
insert_html_element(fake_body_token); insert_html_element(fake_body_token);
m_insertion_mode = InsertionMode::InBody; m_insertion_mode = InsertionMode::InBody;
// FIXME: Reprocess the current token in InBody! process_using_the_rules_for(m_insertion_mode, token);
} }
void HTMLDocumentParser::generate_implied_end_tags(const FlyString& exception) void HTMLDocumentParser::generate_implied_end_tags(const FlyString& exception)