dymokomi/luce-browser-engine
Source of release 0.6.1
0.6.1 / src / web / html / parser / html_parser_6.lucb
#==============================================================================================
#
# html_parser_6 - HTML::HTMLParser: the "in body" insertion mode, part 2
#
# DESCRIPTION:
# Port of LibWeb/HTML/Parser/HTMLParser.cpp (lines 2611-3282): the rest of handle_in_body,
# from the block end tags to "any other end tag". C++'s two labels inside the function are
# functions here: `AnyOtherEndTag` (reached by `goto` from "sarcasm", from the adoption
# agency algorithm's outcome, and by falling into the last entry) is
# html_parser_handle_in_body_any_other_end_tag, and `BRStartTag` (reached from a "br" end
# tag) is html_parser_handle_in_body_br_start_tag.
#
#==============================================================================================
## handle_in_body continued (HTMLParser.cpp:2611-3282): the entries after the "button" start tag.
func html_parser_handle_in_body_continued(this: HtmlParser*, token: html_syntax.HtmlToken*):
# -> An end tag whose tag name is one of: "address", "article", "aside", "blockquote", "button", "center",
# "details", "dialog", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header", "hgroup",
# "listing", "main", "menu", "nav", "ol", "pre", "search", "section", "select", "summary", "ul"
if html_syntax.html_token_is_end_tag(token) and html_parser_tag_name_is_one_of(token, [html_tag_names_address, html_tag_names_article, html_tag_names_aside, html_tag_names_blockquote, html_tag_names_button, html_tag_names_center, html_tag_names_details, html_tag_names_dialog, html_tag_names_dir, html_tag_names_div, html_tag_names_dl, html_tag_names_fieldset, html_tag_names_figcaption, html_tag_names_figure, html_tag_names_footer, html_tag_names_header, html_tag_names_hgroup, html_tag_names_listing, html_tag_names_main, html_tag_names_menu, html_tag_names_nav, html_tag_names_ol, html_tag_names_pre, html_tag_names_search, html_tag_names_section, html_tag_names_select, html_tag_names_summary, html_tag_names_ul]):
# If the stack of open elements does not have an element in scope that is an HTML element with the same tag name as that of the token, then this is a parse error; ignore the token.
if not html_stack_of_open_elements_has_in_scope_fly_string(&this.m_stack_of_open_elements, html_syntax.html_token_tag_name(token)):
html_log_parse_error()
return
# Otherwise, run these steps:
# 1. Generate implied end tags.
html_parser_generate_implied_end_tags(this)
# 2. If the current node is not an HTML element with the same tag name as that of the token, then this is a parse error.
if not html_parser_local_name_is(html_parser_current_element(this), html_syntax.html_token_tag_name(token)):
html_log_parse_error()
# 3. Pop elements from the stack of open elements until an HTML element with the same tag name as the token has been popped from the stack.
html_stack_of_open_elements_pop_until_an_element_with_tag_name_has_been_popped(&this.m_stack_of_open_elements, html_syntax.html_token_tag_name(token))
return
# -> An end tag whose tag name is "form"
if html_syntax.html_token_is_end_tag(token) and html_parser_tag_name_is(token, html_tag_names_form):
# If there is no template element on the stack of open elements, then run these substeps:
if not html_stack_of_open_elements_contains_template_element(&this.m_stack_of_open_elements):
# 1. Let node be the element that the form element pointer is set to, or null if it is not set to an element.
let node = this.m_form_element
# 2. Set the form element pointer to null.
this.m_form_element = none
# 3. If node is null or if the stack of open elements does not have node in scope, then this is a parse error; return and ignore the token.
if node == none or not html_stack_of_open_elements_has_in_scope_dom_element(&this.m_stack_of_open_elements, (node else trap("checked")).dom_element()):
html_log_parse_error()
return
let node_element = (node else trap("checked")).dom_element()
# 4. Generate implied end tags.
html_parser_generate_implied_end_tags(this)
# 5. If the current node is not node, then this is a parse error.
if html_parser_current_node(this) != node_element:
html_log_parse_error()
# 6. Remove node from the stack of open elements.
html_parser_remove_first_element(&this.m_stack_of_open_elements.m_elements, node_element)
# If there is a template element on the stack of open elements, then run these substeps instead:
else:
# 1. If the stack of open elements does not have a form element in scope, then this is a parse error; return and ignore the token.
if not html_stack_of_open_elements_has_in_scope_fly_string(&this.m_stack_of_open_elements, html_tag_names_form):
html_log_parse_error()
return
# 2. Generate implied end tags.
html_parser_generate_implied_end_tags(this)
# 3. If the current node is not a form element, then this is a parse error.
if not html_parser_local_name_is(html_parser_current_element(this), html_tag_names_form):
html_log_parse_error()
# 4. Pop elements from the stack of open elements until a form element has been popped from the stack.
html_stack_of_open_elements_pop_until_an_element_with_tag_name_has_been_popped(&this.m_stack_of_open_elements, html_tag_names_form)
return
# -> An end tag whose tag name is "p"
if html_syntax.html_token_is_end_tag(token) and html_parser_tag_name_is(token, html_tag_names_p):
# If the stack of open elements does not have a p element in button scope, then this is a parse error; insert an HTML element for a "p" start tag token with no attributes.
if not html_stack_of_open_elements_has_in_button_scope(&this.m_stack_of_open_elements, html_tag_names_p):
html_log_parse_error()
_ = html_parser_insert_html_element_for_tag_name(this, html_tag_names_p)
# Close a p element.
html_parser_close_a_p_element(this)
return
# -> An end tag whose tag name is "li"
if html_syntax.html_token_is_end_tag(token) and html_parser_tag_name_is(token, html_tag_names_li):
# If the stack of open elements does not have an li element in list item scope, then this is a parse error; ignore the token.
if not html_stack_of_open_elements_has_in_list_item_scope(&this.m_stack_of_open_elements, html_tag_names_li):
html_log_parse_error()
return
# Otherwise, run these steps:
# 1. Generate implied end tags, except for li elements.
html_parser_generate_implied_end_tags(this, html_tag_names_li)
# 2. If the current node is not an li element, then this is a parse error.
if not html_parser_local_name_is(html_parser_current_element(this), html_tag_names_li):
html_log_parse_error()
if html_parser_debug:
let local_name = dom_element_local_name(html_parser_current_element(this))
ak.dbgln(f"Expected <li> current node, but had <{(str)ak.fly_string_bytes(&local_name)}>")
# 3. Pop elements from the stack of open elements until an li element has been popped from the stack.
html_stack_of_open_elements_pop_until_an_element_with_tag_name_has_been_popped(&this.m_stack_of_open_elements, html_tag_names_li)
return
# -> An end tag whose tag name is one of: "dd", "dt"
if html_syntax.html_token_is_end_tag(token) and html_parser_tag_name_is_one_of(token, [html_tag_names_dd, html_tag_names_dt]):
# If the stack of open elements does not have an element in scope that is an HTML element with the same tag name as that of the token, then this is a parse error; ignore the token.
if not html_stack_of_open_elements_has_in_scope_fly_string(&this.m_stack_of_open_elements, html_syntax.html_token_tag_name(token)):
html_log_parse_error()
return
# Otherwise, run these steps:
# 1. Generate implied end tags, except for HTML elements with the same tag name as the token.
html_parser_generate_implied_end_tags(this, html_syntax.html_token_tag_name(token))
# 2. If the current node is not an HTML element with the same tag name as that of the token, then this is a parse error.
if not html_parser_local_name_is(html_parser_current_element(this), html_syntax.html_token_tag_name(token)):
html_log_parse_error()
# 3. Pop elements from the stack of open elements until an HTML element with the same tag name as the token has been popped from the stack.
html_stack_of_open_elements_pop_until_an_element_with_tag_name_has_been_popped(&this.m_stack_of_open_elements, html_syntax.html_token_tag_name(token))
return
# -> An end tag whose tag name is one of: "h1", "h2", "h3", "h4", "h5", "h6"
if html_syntax.html_token_is_end_tag(token) and html_parser_tag_name_is_one_of(token, [html_tag_names_h1, html_tag_names_h2, html_tag_names_h3, html_tag_names_h4, html_tag_names_h5, html_tag_names_h6]):
# If the stack of open elements does not have an element in scope that is an HTML element and whose tag name is one of "h1", "h2", "h3", "h4", "h5", or "h6", then this is a parse error; ignore the token.
let stack = &this.m_stack_of_open_elements
if not html_stack_of_open_elements_has_in_scope_fly_string(stack, html_tag_names_h1) and not html_stack_of_open_elements_has_in_scope_fly_string(stack, html_tag_names_h2) and not html_stack_of_open_elements_has_in_scope_fly_string(stack, html_tag_names_h3) and not html_stack_of_open_elements_has_in_scope_fly_string(stack, html_tag_names_h4) and not html_stack_of_open_elements_has_in_scope_fly_string(stack, html_tag_names_h5) and not html_stack_of_open_elements_has_in_scope_fly_string(stack, html_tag_names_h6):
html_log_parse_error()
return
# Otherwise, run these steps:
# 1. Generate implied end tags.
html_parser_generate_implied_end_tags(this)
# 2. If the current node is not an HTML element with the same tag name as that of the token, then this is a parse error.
if not html_parser_local_name_is(html_parser_current_element(this), html_syntax.html_token_tag_name(token)):
html_log_parse_error()
# 3. Pop elements from the stack of open elements until an HTML element whose tag name is one of "h1", "h2", "h3", "h4", "h5", or "h6" has been popped from the stack.
while true:
let popped_element = html_stack_of_open_elements_pop(stack)
if html_parser_local_name_is_one_of(popped_element, [html_tag_names_h1, html_tag_names_h2, html_tag_names_h3, html_tag_names_h4, html_tag_names_h5, html_tag_names_h6]):
break
return
# -> An end tag whose tag name is "sarcasm"
if html_syntax.html_token_is_end_tag(token) and html_parser_tag_name_is_one_of(token, [ak.fly_string_from_str("sarcasm")]):
# Take a deep breath, then act as described in the "any other end tag" entry below.
html_parser_handle_in_body_any_other_end_tag(this, token)
return
# -> A start tag whose tag name is "a"
if html_syntax.html_token_is_start_tag(token) and html_parser_tag_name_is(token, html_tag_names_a):
# If the list of active formatting elements contains an a element between the end of the list and the last marker on the list (or the start of the list if there
# is no marker on the list), then this is a parse error; run the adoption agency algorithm for the token, then remove that element from the list of active formatting
# elements and the stack of open elements if the adoption agency algorithm didn't already remove it (it might not have if the element is not in table scope).
if let element = html_list_of_active_formatting_elements_last_element_with_tag_name_before_marker(&this.m_list_of_active_formatting_elements, html_tag_names_a):
html_log_parse_error()
if html_parser_run_the_adoption_agency_algorithm(this, token) == HtmlParserAdoptionAgencyAlgorithmOutcome.run_any_other_end_tag_steps:
html_parser_handle_in_body_any_other_end_tag(this, token)
return
html_list_of_active_formatting_elements_remove(&this.m_list_of_active_formatting_elements, element)
html_parser_remove_first_element(&this.m_stack_of_open_elements.m_elements, element)
# Reconstruct the active formatting elements, if any.
html_parser_reconstruct_the_active_formatting_elements(this)
# Insert an HTML element for the token. Push onto the list of active formatting elements that element.
let new_element = html_parser_insert_html_element(this, token)
html_list_of_active_formatting_elements_add(&this.m_list_of_active_formatting_elements, new_element, token)
return
# -> A start tag whose tag name is one of: "b", "big", "code", "em", "font", "i", "s", "small", "strike", "strong", "tt", "u"
if html_syntax.html_token_is_start_tag(token) and html_parser_tag_name_is_one_of(token, [html_tag_names_b, html_tag_names_big, html_tag_names_code, html_tag_names_em, html_tag_names_font, html_tag_names_i, html_tag_names_s, html_tag_names_small, html_tag_names_strike, html_tag_names_strong, html_tag_names_tt, html_tag_names_u]):
# Reconstruct the active formatting elements, if any.
html_parser_reconstruct_the_active_formatting_elements(this)
# Insert an HTML element for the token. Push onto the list of active formatting elements that element.
let element = html_parser_insert_html_element(this, token)
html_list_of_active_formatting_elements_add(&this.m_list_of_active_formatting_elements, element, token)
return
# -> A start tag whose tag name is "nobr"
if html_syntax.html_token_is_start_tag(token) and html_parser_tag_name_is(token, html_tag_names_nobr):
# Reconstruct the active formatting elements, if any.
html_parser_reconstruct_the_active_formatting_elements(this)
# If the stack of open elements has a nobr element in scope, then this is a parse error; run the adoption agency algorithm for the token, then once again reconstruct the active formatting elements, if any.
if html_stack_of_open_elements_has_in_scope_fly_string(&this.m_stack_of_open_elements, html_tag_names_nobr):
html_log_parse_error()
_ = html_parser_run_the_adoption_agency_algorithm(this, token)
html_parser_reconstruct_the_active_formatting_elements(this)
# Insert an HTML element for the token. Push onto the list of active formatting elements that element.
let element = html_parser_insert_html_element(this, token)
html_list_of_active_formatting_elements_add(&this.m_list_of_active_formatting_elements, element, token)
return
# -> An end tag whose tag name is one of: "a", "b", "big", "code", "em", "font", "i", "nobr", "s", "small", "strike", "strong", "tt", "u"
if html_syntax.html_token_is_end_tag(token) and html_parser_tag_name_is_one_of(token, [html_tag_names_a, html_tag_names_b, html_tag_names_big, html_tag_names_code, html_tag_names_em, html_tag_names_font, html_tag_names_i, html_tag_names_nobr, html_tag_names_s, html_tag_names_small, html_tag_names_strike, html_tag_names_strong, html_tag_names_tt, html_tag_names_u]):
# Run the adoption agency algorithm for the token.
if html_parser_run_the_adoption_agency_algorithm(this, token) == HtmlParserAdoptionAgencyAlgorithmOutcome.run_any_other_end_tag_steps:
html_parser_handle_in_body_any_other_end_tag(this, token)
return
# -> A start tag whose tag name is one of: "applet", "marquee", "object"
if html_syntax.html_token_is_start_tag(token) and html_parser_tag_name_is_one_of(token, [html_tag_names_applet, html_tag_names_marquee, html_tag_names_object]):
# Reconstruct the active formatting elements, if any.
html_parser_reconstruct_the_active_formatting_elements(this)
# Insert an HTML element for the token.
_ = html_parser_insert_html_element(this, token)
# Insert a marker at the end of the list of active formatting elements.
html_list_of_active_formatting_elements_add_marker(&this.m_list_of_active_formatting_elements)
# Set the frameset-ok flag to "not ok".
this.m_frameset_ok = false
return
# -> An end tag token whose tag name is one of: "applet", "marquee", "object"
if html_syntax.html_token_is_end_tag(token) and html_parser_tag_name_is_one_of(token, [html_tag_names_applet, html_tag_names_marquee, html_tag_names_object]):
# If the stack of open elements does not have an element in scope that is an HTML element with the same tag name as that of the token, then this is a parse error; ignore the token.
if not html_stack_of_open_elements_has_in_scope_fly_string(&this.m_stack_of_open_elements, html_syntax.html_token_tag_name(token)):
html_log_parse_error()
return
# Otherwise, run these steps:
# 1. Generate implied end tags.
html_parser_generate_implied_end_tags(this)
# 2. If the current node is not an HTML element with the same tag name as that of the token, then this is a parse error.
if not html_parser_local_name_is(html_parser_current_element(this), html_syntax.html_token_tag_name(token)):
html_log_parse_error()
# 3. Pop elements from the stack of open elements until an HTML element with the same tag name as the token has been popped from the stack.
html_stack_of_open_elements_pop_until_an_element_with_tag_name_has_been_popped(&this.m_stack_of_open_elements, html_syntax.html_token_tag_name(token))
# 4. Clear the list of active formatting elements up to the last marker.
html_list_of_active_formatting_elements_clear_up_to_the_last_marker(&this.m_list_of_active_formatting_elements)
return
# -> A start tag whose tag name is "table"
if html_syntax.html_token_is_start_tag(token) and html_parser_tag_name_is(token, html_tag_names_table):
# If the Document is not set to quirks mode, and the stack of open elements has a p element in button scope, then close a p element.
if not dom_document_in_quirks_mode(html_parser_document(this)):
if html_stack_of_open_elements_has_in_button_scope(&this.m_stack_of_open_elements, html_tag_names_p):
html_parser_close_a_p_element(this)
# Insert an HTML element for the token.
_ = html_parser_insert_html_element(this, token)
# Set the frameset-ok flag to "not ok".
this.m_frameset_ok = false
# Switch the insertion mode to "in table".`
this.m_insertion_mode = HtmlParserInsertionMode.in_table
return
# -> An end tag whose tag name is "br"
if html_syntax.html_token_is_end_tag(token) and html_parser_tag_name_is(token, html_tag_names_br):
# Parse error. Drop the attributes from the token, and act as described in the next entry; i.e. act as if this was a "br" start tag token with no attributes, rather than the end tag token that it actually is.
html_log_parse_error()
html_syntax.html_token_drop_attributes(token)
html_parser_handle_in_body_br_start_tag(this, token)
return
# -> A start tag whose tag name is one of: "area", "br", "embed", "img", "keygen", "wbr"
if html_syntax.html_token_is_start_tag(token) and html_parser_tag_name_is_one_of(token, [html_tag_names_area, html_tag_names_br, html_tag_names_embed, html_tag_names_img, html_tag_names_keygen, html_tag_names_wbr]):
html_parser_handle_in_body_br_start_tag(this, token)
return
# -> A start tag whose tag name is "input"
if html_syntax.html_token_is_start_tag(token) and html_parser_tag_name_is(token, html_tag_names_input):
# If the parser was created as part of the HTML fragment parsing algorithm (fragment case) and the context
# element passed to that algorithm is a select element:
if this.m_parsing_fragment and html_parser_local_name_is(this.m_context_element else trap("VERIFY: context element"), html_tag_names_select):
# 1. Parse error.
# 2. Ignore the token.
html_log_parse_error()
# 3. Return.
return
# If the stack of open elements has a select element in scope:
if html_stack_of_open_elements_has_in_scope_fly_string(&this.m_stack_of_open_elements, html_tag_names_select):
# 1. Parse error.
html_log_parse_error()
# 2. Pop elements from the stack of open elements until a select element has been popped from the stack.
html_stack_of_open_elements_pop_until_an_element_with_tag_name_has_been_popped(&this.m_stack_of_open_elements, html_tag_names_select)
# Reconstruct the active formatting elements, if any.
html_parser_reconstruct_the_active_formatting_elements(this)
# Insert an HTML element for the token. Immediately pop the current node off the stack of open elements.
_ = html_parser_insert_html_element(this, token)
_ = html_stack_of_open_elements_pop(&this.m_stack_of_open_elements)
# Acknowledge the token's self-closing flag, if it is set.
html_syntax.html_token_acknowledge_self_closing_flag_if_set(token)
# If the token does not have an attribute with the name "type", or if it does, but that attribute's value is not an ASCII case-insensitive match for the string "hidden", then: set the frameset-ok flag to "not ok".
let type_attribute = html_syntax.html_token_attribute(token, html_attribute_names_type)
if not html_parser_optional_string_equals_ignoring_ascii_case(type_attribute, "hidden"):
this.m_frameset_ok = false
return
# -> A start tag whose tag name is one of: "param", "source", "track"
if html_syntax.html_token_is_start_tag(token) and html_parser_tag_name_is_one_of(token, [html_tag_names_param, html_tag_names_source, html_tag_names_track]):
# Insert an HTML element for the token. Immediately pop the current node off the stack of open elements.
_ = html_parser_insert_html_element(this, token)
_ = html_stack_of_open_elements_pop(&this.m_stack_of_open_elements)
# Acknowledge the token's self-closing flag, if it is set.
html_syntax.html_token_acknowledge_self_closing_flag_if_set(token)
return
# -> A start tag whose tag name is "hr"
if html_syntax.html_token_is_start_tag(token) and html_parser_tag_name_is(token, html_tag_names_hr):
# If the stack of open elements has a p element in button scope, then close a p element.
if html_stack_of_open_elements_has_in_button_scope(&this.m_stack_of_open_elements, html_tag_names_p):
html_parser_close_a_p_element(this)
# If the stack of open elements has a select element in scope:
if html_stack_of_open_elements_has_in_scope_fly_string(&this.m_stack_of_open_elements, html_tag_names_select):
# 1. Generate implied end tags.
html_parser_generate_implied_end_tags(this)
# 2. If the stack of open elements has an option element in scope or has an optgroup element in scope, then
# this is a parse error.
if html_stack_of_open_elements_has_in_scope_fly_string(&this.m_stack_of_open_elements, html_tag_names_option) or html_stack_of_open_elements_has_in_scope_fly_string(&this.m_stack_of_open_elements, html_tag_names_optgroup):
html_log_parse_error()
# Insert an HTML element for the token. Immediately pop the current node off the stack of open elements.
_ = html_parser_insert_html_element(this, token)
_ = html_stack_of_open_elements_pop(&this.m_stack_of_open_elements)
# Acknowledge the token's self-closing flag, if it is set.
html_syntax.html_token_acknowledge_self_closing_flag_if_set(token)
# Set the frameset-ok flag to "not ok".
this.m_frameset_ok = false
return
# -> A start tag whose tag name is "image"
if html_syntax.html_token_is_start_tag(token) and html_parser_tag_name_is(token, html_tag_names_image):
# Parse error. Change the token's tag name to HTML::TagNames::img and reprocess it. (Don't ask.)
html_log_parse_error()
html_syntax.html_token_set_tag_name(token, ak.fly_string_from_str("img"))
html_parser_process_using_the_rules_for(this, this.m_insertion_mode, token)
return
# -> A start tag whose tag name is "textarea"
if html_syntax.html_token_is_start_tag(token) and html_parser_tag_name_is(token, html_tag_names_textarea):
# 1. Insert an HTML element for the token.
_ = html_parser_insert_html_element(this, token)
# 2. If the next token is a U+000A LINE FEED (LF) character token,
# then ignore that token and move on to the next one.
# (Newlines at the start of textarea elements are ignored as an authoring convenience.)
this.m_next_line_feed_can_be_ignored = true
# 3. Switch the tokenizer to the RCDATA state.
html_syntax.html_tokenizer_switch_to_html_parser(&this.m_tokenizer, html_syntax.HtmlTokenizerState.rcdata)
# 4. Set the original insertion mode to the current insertion mode.
this.m_original_insertion_mode = this.m_insertion_mode
# 5. Set the frameset-ok flag to "not ok".
this.m_frameset_ok = false
# 6. Switch the insertion mode to "text".
this.m_insertion_mode = HtmlParserInsertionMode.text
return
# -> A start tag whose tag name is "xmp"
if html_syntax.html_token_is_start_tag(token) and html_parser_tag_name_is(token, html_tag_names_xmp):
# If the stack of open elements has a p element in button scope, then close a p element.
if html_stack_of_open_elements_has_in_button_scope(&this.m_stack_of_open_elements, html_tag_names_p):
html_parser_close_a_p_element(this)
# Reconstruct the active formatting elements, if any.
html_parser_reconstruct_the_active_formatting_elements(this)
# Set the frameset-ok flag to "not ok".
this.m_frameset_ok = false
# Follow the generic raw text element parsing algorithm.
html_parser_parse_generic_raw_text_element(this, token)
return
# -> A start tag whose tag name is "iframe"
if html_syntax.html_token_is_start_tag(token) and html_parser_tag_name_is(token, html_tag_names_iframe):
# Set the frameset-ok flag to "not ok".
this.m_frameset_ok = false
# Follow the generic raw text element parsing algorithm.
html_parser_parse_generic_raw_text_element(this, token)
return
# -> A start tag whose tag name is "noembed"
# -> A start tag whose tag name is "noscript", if scripting mode is not Disabled
if html_syntax.html_token_is_start_tag(token) and (html_parser_tag_name_is(token, html_tag_names_noembed) or (html_parser_tag_name_is(token, html_tag_names_noscript) and this.m_scripting_mode != HtmlParserScriptingMode.disabled)):
# Follow the generic raw text element parsing algorithm.
html_parser_parse_generic_raw_text_element(this, token)
return
html_parser_handle_in_body_continued_2(this, token)
## `type_attribute.has_value() && type_attribute->equals_ignoring_ascii_case(text)`.
func html_parser_optional_string_equals_ignoring_ascii_case(value: ak.String?, text: str) -> bool:
let string = value else return false
return ak.string_equals_ignoring_ascii_case_string_view(&string, ak.sv(text))
## handle_in_body's `BRStartTag:` label: the "area", "br", "embed", "img", "keygen", "wbr" start
## tag entry (HTMLParser.cpp:2911-2924).
func html_parser_handle_in_body_br_start_tag(this: HtmlParser*, token: html_syntax.HtmlToken*):
# Reconstruct the active formatting elements, if any.
html_parser_reconstruct_the_active_formatting_elements(this)
# Insert an HTML element for the token. Immediately pop the current node off the stack of open elements.
_ = html_parser_insert_html_element(this, token)
_ = html_stack_of_open_elements_pop(&this.m_stack_of_open_elements)
# Acknowledge the token's self-closing flag, if it is set.
html_syntax.html_token_acknowledge_self_closing_flag_if_set(token)
# Set the frameset-ok flag to "not ok".
this.m_frameset_ok = false