mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Call children_changed on the parent node consistently
This commit is contained in:
parent
ac6e04ebfb
commit
3a740142d9
1 changed files with 10 additions and 10 deletions
|
@ -70,6 +70,16 @@ impl CharacterData {
|
|||
fn content_changed(&self) {
|
||||
let node = self.upcast::<Node>();
|
||||
node.dirty(NodeDamage::OtherNodeDamage);
|
||||
|
||||
// If this is a Text node, we might need to re-parse (say, if our parent
|
||||
// is a <style> element.) We don't need to if this is a Comment or
|
||||
// ProcessingInstruction.
|
||||
if self.is::<Text>() {
|
||||
if let Some(parent_node) = node.GetParentNode() {
|
||||
let mutation = ChildrenMutation::ChangeText;
|
||||
vtable_for(&parent_node).children_changed(&mutation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,16 +97,6 @@ impl CharacterDataMethods for CharacterData {
|
|||
self.content_changed();
|
||||
let node = self.upcast::<Node>();
|
||||
node.ranges().replace_code_units(node, 0, old_length, new_length);
|
||||
|
||||
// If this is a Text node, we might need to re-parse (say, if our parent
|
||||
// is a <style> element.) We don't need to if this is a Comment or
|
||||
// ProcessingInstruction.
|
||||
if self.is::<Text>() {
|
||||
if let Some(parent_node) = node.GetParentNode() {
|
||||
let mutation = ChildrenMutation::ChangeText;
|
||||
vtable_for(&parent_node).children_changed(&mutation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-characterdata-length
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue