mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Don't traverse any elements that needed only for animation-only restyles in normal traversal.
Before this patch, we were setting the dirty descendants bit in animation-only restyles and it triggered unnecessary traversal for elements that does not need the traversal (i.e no need selector matching).
This commit is contained in:
parent
5a8e2562d5
commit
a3da636f69
2 changed files with 11 additions and 3 deletions
|
@ -462,9 +462,13 @@ pub trait DomTraversal<E: TElement> : Sync {
|
|||
let el = kid.as_element();
|
||||
if el.as_ref().and_then(|el| el.borrow_data())
|
||||
.map_or(false, |d| d.has_styles()) {
|
||||
if self.shared_context().traversal_flags.for_animation_only() {
|
||||
unsafe { parent.set_animation_only_dirty_descendants(); }
|
||||
} else {
|
||||
unsafe { parent.set_dirty_descendants(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
f(thread_local, kid);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -300,7 +300,9 @@ pub extern "C" fn Servo_TraverseSubtree(root: RawGeckoElementBorrowed,
|
|||
return false;
|
||||
}
|
||||
|
||||
element.has_dirty_descendants() || element.borrow_data().unwrap().restyle.contains_restyle_data()
|
||||
element.has_dirty_descendants() ||
|
||||
element.has_animation_only_dirty_descendants() ||
|
||||
element.borrow_data().unwrap().restyle.contains_restyle_data()
|
||||
}
|
||||
|
||||
/// Checks whether the rule tree has crossed its threshold for unused nodes, and
|
||||
|
@ -2801,7 +2803,9 @@ pub extern "C" fn Servo_AssertTreeIsClean(root: RawGeckoElementBorrowed) {
|
|||
|
||||
let root = GeckoElement(root);
|
||||
fn assert_subtree_is_clean<'le>(el: GeckoElement<'le>) {
|
||||
debug_assert!(!el.has_dirty_descendants() && !el.has_animation_only_dirty_descendants());
|
||||
debug_assert!(!el.has_dirty_descendants() && !el.has_animation_only_dirty_descendants(),
|
||||
"{:?} has still dirty bit {:?} or animation-only dirty bit {:?}",
|
||||
el, el.has_dirty_descendants(), el.has_animation_only_dirty_descendants());
|
||||
for child in el.as_node().traversal_children() {
|
||||
if let Some(child) = child.as_element() {
|
||||
assert_subtree_is_clean(child);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue