mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Auto merge of #18026 - bholley:continue_traversal_cleanup, r=emilio
Continue cleaning up the traversal entry point machinery https://bugzilla.mozilla.org/show_bug.cgi?id=1388623 <!-- 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/18026) <!-- Reviewable:end -->
This commit is contained in:
commit
2b92a7e82d
4 changed files with 29 additions and 7 deletions
|
@ -69,14 +69,23 @@ impl RestyleData {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Clear all the restyle state associated with this element.
|
/// Clear all the restyle state associated with this element.
|
||||||
fn clear(&mut self) {
|
///
|
||||||
*self = Self::new();
|
/// FIXME(bholley): The only caller of this should probably just assert that
|
||||||
|
/// the hint is empty and call clear_flags_and_damage().
|
||||||
|
fn clear_restyle_state(&mut self) {
|
||||||
|
self.clear_restyle_flags_and_damage();
|
||||||
|
self.hint = RestyleHint::empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Clear restyle flags and damage.
|
/// Clear restyle flags and damage.
|
||||||
fn clear_flags_and_damage(&mut self) {
|
///
|
||||||
|
/// Note that we don't touch the TRAVERSED_WITHOUT_STYLING bit, which gets
|
||||||
|
/// set to the correct value on each traversal. There's no reason anyone
|
||||||
|
/// needs to clear it, and clearing it accidentally mid-traversal could
|
||||||
|
/// cause incorrect style sharing behavior.
|
||||||
|
fn clear_restyle_flags_and_damage(&mut self) {
|
||||||
self.damage = RestyleDamage::empty();
|
self.damage = RestyleDamage::empty();
|
||||||
self.flags = RestyleFlags::empty();
|
self.flags = self.flags & TRAVERSED_WITHOUT_STYLING;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns whether this element or any ancestor is going to be
|
/// Returns whether this element or any ancestor is going to be
|
||||||
|
@ -420,12 +429,12 @@ impl ElementData {
|
||||||
|
|
||||||
/// Drops any restyle state from the element.
|
/// Drops any restyle state from the element.
|
||||||
pub fn clear_restyle_state(&mut self) {
|
pub fn clear_restyle_state(&mut self) {
|
||||||
self.restyle.clear();
|
self.restyle.clear_restyle_state();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Drops restyle flags and damage from the element.
|
/// Drops restyle flags and damage from the element.
|
||||||
pub fn clear_restyle_flags_and_damage(&mut self) {
|
pub fn clear_restyle_flags_and_damage(&mut self) {
|
||||||
self.restyle.clear_flags_and_damage();
|
self.restyle.clear_restyle_flags_and_damage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,8 @@ pub enum PseudoElement {
|
||||||
% endfor
|
% endfor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Important: If you change this, you should also update Gecko's
|
||||||
|
/// nsCSSPseudoElements::IsEagerlyCascadedInServo.
|
||||||
<% EAGER_PSEUDOS = ["Before", "After", "FirstLine", "FirstLetter"] %>
|
<% EAGER_PSEUDOS = ["Before", "After", "FirstLine", "FirstLetter"] %>
|
||||||
<% TREE_PSEUDOS = [pseudo for pseudo in PSEUDOS if pseudo.is_tree_pseudo_element()] %>
|
<% TREE_PSEUDOS = [pseudo for pseudo in PSEUDOS if pseudo.is_tree_pseudo_element()] %>
|
||||||
<% SIMPLE_PSEUDOS = [pseudo for pseudo in PSEUDOS if not pseudo.is_tree_pseudo_element()] %>
|
<% SIMPLE_PSEUDOS = [pseudo for pseudo in PSEUDOS if not pseudo.is_tree_pseudo_element()] %>
|
||||||
|
|
|
@ -603,7 +603,7 @@ where
|
||||||
// data here, since we won't need to perform a post-traversal to pick up
|
// data here, since we won't need to perform a post-traversal to pick up
|
||||||
// any change hints.
|
// any change hints.
|
||||||
if flags.contains(traversal_flags::Forgetful) {
|
if flags.contains(traversal_flags::Forgetful) {
|
||||||
data.clear_restyle_state();
|
data.clear_restyle_flags_and_damage();
|
||||||
}
|
}
|
||||||
|
|
||||||
// There are two cases when we want to clear the dity descendants bit here
|
// There are two cases when we want to clear the dity descendants bit here
|
||||||
|
|
|
@ -258,6 +258,8 @@ pub extern "C" fn Servo_TraverseSubtree(root: RawGeckoElementBorrowed,
|
||||||
|
|
||||||
let element = GeckoElement(root);
|
let element = GeckoElement(root);
|
||||||
|
|
||||||
|
debug!("Servo_TraverseSubtree (flags={:?})", traversal_flags);
|
||||||
|
|
||||||
// It makes no sense to do an animation restyle when we're restyling
|
// It makes no sense to do an animation restyle when we're restyling
|
||||||
// newly-inserted content.
|
// newly-inserted content.
|
||||||
if !traversal_flags.contains(traversal_flags::UnstyledChildrenOnly) {
|
if !traversal_flags.contains(traversal_flags::UnstyledChildrenOnly) {
|
||||||
|
@ -266,6 +268,8 @@ pub extern "C" fn Servo_TraverseSubtree(root: RawGeckoElementBorrowed,
|
||||||
element.has_animation_restyle_hints();
|
element.has_animation_restyle_hints();
|
||||||
|
|
||||||
if needs_animation_only_restyle {
|
if needs_animation_only_restyle {
|
||||||
|
debug!("Servo_TraverseSubtree doing animation-only restyle (aodd={})",
|
||||||
|
element.has_animation_only_dirty_descendants());
|
||||||
traverse_subtree(element,
|
traverse_subtree(element,
|
||||||
raw_data,
|
raw_data,
|
||||||
traversal_flags | traversal_flags::AnimationOnly,
|
traversal_flags | traversal_flags::AnimationOnly,
|
||||||
|
@ -274,6 +278,8 @@ pub extern "C" fn Servo_TraverseSubtree(root: RawGeckoElementBorrowed,
|
||||||
}
|
}
|
||||||
|
|
||||||
if traversal_flags.for_animation_only() {
|
if traversal_flags.for_animation_only() {
|
||||||
|
debug!("Servo_TraverseSubtree complete (animation-only, aodd={})",
|
||||||
|
element.has_animation_only_dirty_descendants());
|
||||||
return element.has_animation_only_dirty_descendants() ||
|
return element.has_animation_only_dirty_descendants() ||
|
||||||
element.borrow_data().unwrap().restyle.is_restyle();
|
element.borrow_data().unwrap().restyle.is_restyle();
|
||||||
}
|
}
|
||||||
|
@ -283,6 +289,11 @@ pub extern "C" fn Servo_TraverseSubtree(root: RawGeckoElementBorrowed,
|
||||||
traversal_flags,
|
traversal_flags,
|
||||||
unsafe { &*snapshots });
|
unsafe { &*snapshots });
|
||||||
|
|
||||||
|
debug!("Servo_TraverseSubtree complete (dd={}, aodd={}, restyle={:?})",
|
||||||
|
element.has_dirty_descendants(),
|
||||||
|
element.has_animation_only_dirty_descendants(),
|
||||||
|
element.borrow_data().unwrap().restyle);
|
||||||
|
|
||||||
element.has_dirty_descendants() ||
|
element.has_dirty_descendants() ||
|
||||||
element.has_animation_only_dirty_descendants() ||
|
element.has_animation_only_dirty_descendants() ||
|
||||||
element.borrow_data().unwrap().restyle.contains_restyle_data()
|
element.borrow_data().unwrap().restyle.contains_restyle_data()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue