Track the restyle root and use it to do less work during the traversal.

MozReview-Commit-ID: A8O3JOpsv4E
This commit is contained in:
Bobby Holley 2017-07-18 18:38:47 -07:00
parent 0534f72925
commit d4aa8e3cef
9 changed files with 132 additions and 68 deletions

View file

@ -501,13 +501,20 @@ pub trait TElement : Eq + PartialEq + Debug + Hash + Sized + Copy + Clone +
unsafe fn unset_animation_only_dirty_descendants(&self) {
}
/// Clear all bits related to dirty descendant.
/// Clear all bits related describing the dirtiness of descendants.
///
/// In Gecko, this corresponds to the regular dirty descendants bit, the
/// animation-only dirty descendants bit, and the lazy frame construction
/// descendants bit.
unsafe fn clear_descendants_bits(&self) { self.unset_dirty_descendants(); }
/// Clear all element flags related to dirtiness.
///
/// In Gecko, this corresponds to the regular dirty descendants bit, the
/// animation-only dirty descendants bit, the lazy frame construction bit,
/// and the lazy frame construction descendants bit.
unsafe fn clear_dirty_bits(&self) { self.unset_dirty_descendants(); }
/// Returns true if this element is a visited link.
///
/// Servo doesn't support visited styles yet.
@ -718,28 +725,6 @@ pub trait TElement : Eq + PartialEq + Debug + Hash + Sized + Copy + Clone +
-> bool;
}
/// Trait abstracting over different kinds of dirty-descendants bits.
pub trait DescendantsBit<E: TElement> {
/// Returns true if the Element has the bit.
fn has(el: E) -> bool;
/// Sets the bit on the Element.
unsafe fn set(el: E);
}
/// Implementation of DescendantsBit for the regular dirty descendants bit.
pub struct DirtyDescendants;
impl<E: TElement> DescendantsBit<E> for DirtyDescendants {
fn has(el: E) -> bool { el.has_dirty_descendants() }
unsafe fn set(el: E) { el.set_dirty_descendants(); }
}
/// Implementation of DescendantsBit for the animation-only dirty descendants bit.
pub struct AnimationOnlyDirtyDescendants;
impl<E: TElement> DescendantsBit<E> for AnimationOnlyDirtyDescendants {
fn has(el: E) -> bool { el.has_animation_only_dirty_descendants() }
unsafe fn set(el: E) { el.set_animation_only_dirty_descendants(); }
}
/// TNode and TElement aren't Send because we want to be careful and explicit
/// about our parallel traversal. However, there are certain situations
/// (including but not limited to the traversal) where we need to send DOM