mirror of
https://github.com/servo/servo.git
synced 2025-08-02 12:10:29 +01:00
Auto merge of #19164 - emilio:more-traversal-cleanup, r=nox
style: More traversal cleanup. This is cleanup that allows me to fix https://bugzilla.mozilla.org/show_bug.cgi?id=1415013 in a more straight-forward way. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19164) <!-- Reviewable:end -->
This commit is contained in:
commit
d117694ecc
6 changed files with 67 additions and 179 deletions
|
@ -573,8 +573,14 @@ impl Document {
|
|||
self.encoding.set(encoding);
|
||||
}
|
||||
|
||||
pub fn content_and_heritage_changed(&self, node: &Node, damage: NodeDamage) {
|
||||
node.dirty(damage);
|
||||
pub fn content_and_heritage_changed(&self, node: &Node) {
|
||||
if node.is_in_doc() {
|
||||
node.note_dirty_descendants();
|
||||
}
|
||||
|
||||
// FIXME(emilio): This is very inefficient, ideally the flag above would
|
||||
// be enough and incremental layout could figure out from there.
|
||||
node.dirty(NodeDamage::OtherNodeDamage);
|
||||
}
|
||||
|
||||
/// Reflows and disarms the timer if the reflow timer has expired.
|
||||
|
|
|
@ -483,6 +483,19 @@ impl Node {
|
|||
self.flags.set(flags);
|
||||
}
|
||||
|
||||
// FIXME(emilio): This and the function below should move to Element.
|
||||
pub fn note_dirty_descendants(&self) {
|
||||
debug_assert!(self.is_in_doc());
|
||||
|
||||
for ancestor in self.inclusive_ancestors() {
|
||||
if ancestor.get_flag(NodeFlags::HAS_DIRTY_DESCENDANTS) {
|
||||
return;
|
||||
}
|
||||
|
||||
ancestor.set_flag(NodeFlags::HAS_DIRTY_DESCENDANTS, true);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn has_dirty_descendants(&self) -> bool {
|
||||
self.get_flag(NodeFlags::HAS_DIRTY_DESCENDANTS)
|
||||
}
|
||||
|
@ -2499,7 +2512,7 @@ impl VirtualMethods for Node {
|
|||
if let Some(list) = self.child_list.get() {
|
||||
list.as_children_list().children_changed(mutation);
|
||||
}
|
||||
self.owner_doc().content_and_heritage_changed(self, NodeDamage::OtherNodeDamage);
|
||||
self.owner_doc().content_and_heritage_changed(self);
|
||||
}
|
||||
|
||||
// This handles the ranges mentioned in steps 2-3 when removing a node.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue