mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Optimize Node.normalize()
.
Do not copy the discarded node's text data, borrow it. Closes #6658.
This commit is contained in:
parent
36d732a60a
commit
402a2a8717
2 changed files with 7 additions and 3 deletions
|
@ -2330,10 +2330,9 @@ impl<'a> NodeMethods for &'a Node {
|
|||
} else {
|
||||
match prev_text {
|
||||
Some(ref text_node) => {
|
||||
let text_node = text_node.clone();
|
||||
let prev_characterdata =
|
||||
CharacterDataCast::from_ref(text_node.r());
|
||||
let _ = prev_characterdata.AppendData(characterdata.Data());
|
||||
prev_characterdata.append_data(&**characterdata.data());
|
||||
self.remove_child(child.r());
|
||||
},
|
||||
None => prev_text = Some(Root::from_ref(text))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue