mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 03:55:24 +00:00
LibWeb: Parse "li" start tags in the "in body" insertion mode
This commit is contained in:
parent
643464c455
commit
30d64fccde
Notes:
sideshowbarker
2024-07-19 05:58:00 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/30d64fccdee
1 changed files with 112 additions and 3 deletions
|
@ -44,8 +44,8 @@
|
|||
ASSERT_NOT_REACHED(); \
|
||||
} while (0)
|
||||
|
||||
#define PARSE_ERROR() \
|
||||
do { \
|
||||
#define PARSE_ERROR() \
|
||||
do { \
|
||||
dbg() << "Parse error! " << __PRETTY_FUNCTION__ << " @ " << __LINE__; \
|
||||
} while (0)
|
||||
|
||||
|
@ -642,6 +642,93 @@ void HTMLDocumentParser::run_the_adoption_agency_algorithm(HTMLToken& token)
|
|||
TODO();
|
||||
}
|
||||
|
||||
static bool is_special_tag(const FlyString& tag_name)
|
||||
{
|
||||
return tag_name.is_one_of(
|
||||
"address",
|
||||
"applet",
|
||||
"area",
|
||||
"article",
|
||||
"aside",
|
||||
"base",
|
||||
"basefont",
|
||||
"bgsound",
|
||||
"blockquote",
|
||||
"body",
|
||||
"br",
|
||||
"button",
|
||||
"caption",
|
||||
"center",
|
||||
"col",
|
||||
"colgroup",
|
||||
"dd",
|
||||
"details",
|
||||
"dir",
|
||||
"div",
|
||||
"dl",
|
||||
"dt",
|
||||
"embed",
|
||||
"fieldset",
|
||||
"figcaption",
|
||||
"figure",
|
||||
"footer",
|
||||
"form",
|
||||
"frame",
|
||||
"frameset",
|
||||
"h1",
|
||||
"h2",
|
||||
"h3",
|
||||
"h4",
|
||||
"h5",
|
||||
"h6",
|
||||
"head",
|
||||
"header",
|
||||
"hgroup",
|
||||
"hr",
|
||||
"html",
|
||||
"iframe",
|
||||
"img",
|
||||
"input",
|
||||
"keygen",
|
||||
"li",
|
||||
"link",
|
||||
"listing",
|
||||
"main",
|
||||
"marquee",
|
||||
"menu",
|
||||
"meta",
|
||||
"nav",
|
||||
"noembed",
|
||||
"noframes",
|
||||
"noscript",
|
||||
"object",
|
||||
"ol",
|
||||
"p",
|
||||
"param",
|
||||
"plaintext",
|
||||
"pre",
|
||||
"script",
|
||||
"section",
|
||||
"select",
|
||||
"source",
|
||||
"style",
|
||||
"summary",
|
||||
"table",
|
||||
"tbody",
|
||||
"td",
|
||||
"template",
|
||||
"textarea",
|
||||
"tfoot",
|
||||
"th",
|
||||
"thead",
|
||||
"title",
|
||||
"tr",
|
||||
"track",
|
||||
"ul",
|
||||
"wbr",
|
||||
"xmp");
|
||||
}
|
||||
|
||||
void HTMLDocumentParser::handle_in_body(HTMLToken& token)
|
||||
{
|
||||
if (token.is_character()) {
|
||||
|
@ -742,7 +829,29 @@ void HTMLDocumentParser::handle_in_body(HTMLToken& token)
|
|||
}
|
||||
|
||||
if (token.is_start_tag() && token.tag_name() == "li") {
|
||||
TODO();
|
||||
m_frameset_ok = false;
|
||||
|
||||
for (ssize_t i = m_stack_of_open_elements.elements().size() - 1; i >= 0; --i) {
|
||||
RefPtr<Element> node = m_stack_of_open_elements.elements()[i];
|
||||
|
||||
if (node->tag_name() == "li") {
|
||||
generate_implied_end_tags("li");
|
||||
if (current_node().tag_name() != "li") {
|
||||
PARSE_ERROR();
|
||||
}
|
||||
m_stack_of_open_elements.pop_until_an_element_with_tag_name_has_been_popped("li");
|
||||
break;
|
||||
}
|
||||
|
||||
if (is_special_tag(node->tag_name()) && !node->tag_name().is_one_of("address", "div", "p"))
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_stack_of_open_elements.has_in_button_scope("p"))
|
||||
close_a_p_element();
|
||||
|
||||
insert_html_element(token);
|
||||
return;
|
||||
}
|
||||
|
||||
if (token.is_start_tag() && token.tag_name().is_one_of("dd", "dt")) {
|
||||
|
|
Loading…
Add table
Reference in a new issue