diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index f0e490cf495..b3d492a4ac5 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -817,7 +817,13 @@ impl Node { match self.type_id() { NodeTypeId::CharacterData(CharacterDataTypeId::Text(TextTypeId::Text)) => { - self.parent_node.get().unwrap().dirty(damage) + // For content changes in text nodes, we should accurately use + // [`NodeDamage::ContentOrHeritage`] to mark the parent node, thereby + // reducing the scope of incremental box tree construction. + self.parent_node + .get() + .unwrap() + .dirty(NodeDamage::ContentOrHeritage) }, NodeTypeId::Element(_) => self.downcast::().unwrap().restyle(damage), NodeTypeId::DocumentFragment(DocumentFragmentTypeId::ShadowRoot) => self