LibWeb: Call children_changed() on text nodes when flushing characters

Now that we flush characters in a single place, we can call the Text's
children_changed() from there instead of having a goofy targeted hack
for <style> elements. :^)
This commit is contained in:
Andreas Kling 2020-06-03 22:11:54 +02:00
parent 21957745f7
commit 3c2fbc825c
Notes: sideshowbarker 2024-07-19 05:51:29 +09:00

View File

@ -450,6 +450,7 @@ void HTMLDocumentParser::flush_character_insertions()
if (m_character_insertion_builder.is_empty())
return;
m_character_insertion_node->set_data(m_character_insertion_builder.to_string());
m_character_insertion_node->parent()->children_changed();
m_character_insertion_builder.clear();
}
@ -1424,13 +1425,6 @@ void HTMLDocumentParser::handle_text(HTMLToken& token)
return;
}
// FIXME: This is a bit hackish, we can simplify this once we don't need to support
// the old parser anymore, since then we don't need to maintain its children_changed() semantics.
if (token.is_end_tag() && token.tag_name() == "style") {
current_node().children_changed();
// NOTE: We don't return here, keep going.
}
if (token.is_end_tag()) {
m_stack_of_open_elements.pop();
m_insertion_mode = m_original_insertion_mode;