LibWeb/SVG: Process script element when its text content changes

This commit is contained in:
Tim Ledbetter 2025-02-26 12:37:38 +00:00 committed by Jelle Raaijmakers
parent db7aa68340
commit a187d5f28f
Notes: github-actions[bot] 2025-02-26 15:09:59 +00:00
6 changed files with 42 additions and 3 deletions

View file

@ -35,6 +35,24 @@ void SVGScriptElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_script);
}
void SVGScriptElement::inserted()
{
Base::inserted();
if (m_parser_inserted)
return;
process_the_script_element();
}
void SVGScriptElement::children_changed(ChildrenChangedMetadata const* metadata)
{
Base::children_changed(metadata);
if (m_parser_inserted)
return;
process_the_script_element();
}
// https://www.w3.org/TR/SVGMobile12/script.html#ScriptContentProcessing
void SVGScriptElement::process_the_script_element()
{
@ -114,6 +132,8 @@ void SVGScriptElement::process_the_script_element()
} else {
// Inline script content
script_content = child_text_content();
if (script_content.is_empty())
return;
}
// 3. The 'script' element's "already processed" flag is set to true.