servo: Merge #19384 - Call children_changed on the parent node consistently (from CYBAI:fix-19177); r=emilio

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #19177
- [x] There are tests for these changes

Source-Repo: https://github.com/servo/servo
Source-Revision: 5568c4e3d30c4f777ee25f1a5d1765755b2c1a32

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 6ec5ce1e18ad67e7428c4575e3019fb61d8ca4f6
This commit is contained in:
CYBAI 2017-11-28 04:08:51 -06:00
Родитель b0078ebf2b
Коммит 5ad2eebeb0
1 изменённых файлов: 10 добавлений и 10 удалений

Просмотреть файл

@ -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