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

@ -182,25 +182,28 @@ where
/// Flush the current set, unmarking it as dirty, and returns an iterator
/// over the new stylesheet list.
///
/// Returns true if any elements were invalidated.
pub fn flush<E>(
&mut self,
document_element: Option<E>,
) -> (StylesheetIterator<S>, OriginSet)
) -> (StylesheetIterator<S>, OriginSet, bool)
where
E: TElement,
{
debug!("StylesheetSet::flush");
let mut origins = OriginSet::empty();
let mut have_invalidations = false;
for (data, origin) in self.invalidation_data.iter_mut_origins() {
if data.dirty {
data.invalidations.flush(document_element);
have_invalidations |= data.invalidations.flush(document_element);
data.dirty = false;
origins |= origin;
}
}
(self.iter(), origins)
(self.iter(), origins, have_invalidations)
}
/// Flush stylesheets, but without running any of the invalidation passes.