mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 11:18:13 +00:00
LibXML: Prevent entering the root node of an SVG document twice
Currently, if an SVG document is parsed, we enter the root <svg> element twice - first when its node is appended, and then immediately after the call to append its node. Prevent this by only ever entering nodes from the appropriate location inside the call to append the node.
This commit is contained in:
parent
71b184accf
commit
b6228507ac
1 changed files with 3 additions and 2 deletions
|
@ -71,7 +71,9 @@ size_t Parser::s_debug_indent_level { 0 };
|
|||
void Parser::append_node(NonnullOwnPtr<Node> node)
|
||||
{
|
||||
if (m_entered_node) {
|
||||
m_entered_node->content.get<Node::Element>().children.append(move(node));
|
||||
auto& entered_element = m_entered_node->content.get<Node::Element>();
|
||||
entered_element.children.append(move(node));
|
||||
enter_node(*entered_element.children.last());
|
||||
} else {
|
||||
m_root_node = move(node);
|
||||
enter_node(*m_root_node);
|
||||
|
@ -620,7 +622,6 @@ ErrorOr<void, ParseError> Parser::parse_element()
|
|||
auto& node = *start_tag;
|
||||
auto& tag = node.content.get<Node::Element>();
|
||||
append_node(move(start_tag));
|
||||
enter_node(node);
|
||||
ScopeGuard quit {
|
||||
[&] {
|
||||
leave_node();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue