mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
layout: dirty parent node with NodeDamage::ContentOrHeritage when text content changed (#38057)
This change aims to reduce the scope of incremental box tree construction. Previously, when text content changed, the parent node would always be marked as requiring box tree reconstruction; now, it is adjusted to only mark the parent node as needing to recollect its box tree children. Testing: This should not change observable behavior and is thus covered by existing WPT tests. Signed-off-by: sharpshooter_pt <ibluegalaxy_taoj@163.com>
This commit is contained in:
parent
bf0e3f84d0
commit
f6b98d5c56
1 changed files with 7 additions and 1 deletions
|
@ -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::<Element>().unwrap().restyle(damage),
|
||||
NodeTypeId::DocumentFragment(DocumentFragmentTypeId::ShadowRoot) => self
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue