mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-22 00:41:55 +00:00
LibWeb/SVG: Process script element when its text content changes
This commit is contained in:
parent
db7aa68340
commit
a187d5f28f
Notes:
github-actions[bot]
2025-02-26 15:09:59 +00:00
Author: https://github.com/tcl3
Commit: a187d5f28f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3703
Reviewed-by: https://github.com/awesomekling ✅
6 changed files with 42 additions and 3 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue