Introduce StylingMode and deprecate explicit dirtiness.

MozReview-Commit-ID: 5tF075EJKBa
This commit is contained in:
Bobby Holley 2016-10-21 16:34:23 -07:00
parent 8bd7978980
commit 05c1f1e016
11 changed files with 204 additions and 116 deletions

View file

@ -4,7 +4,7 @@
//! Implements sequential traversal over the DOM tree.
use dom::TNode;
use dom::{StylingMode, TNode};
use traversal::{RestyleResult, DomTraversalContext};
pub fn traverse_dom<N, C>(root: N,
@ -16,14 +16,8 @@ pub fn traverse_dom<N, C>(root: N,
where N: TNode,
C: DomTraversalContext<N>
{
debug_assert!(context.should_process(node));
if let RestyleResult::Continue = context.process_preorder(node) {
for kid in node.children() {
context.pre_process_child_hook(node, kid);
if context.should_process(kid) {
doit::<N, C>(context, kid);
}
}
C::traverse_children(node, |kid| doit::<N, C>(context, kid));
}
if context.needs_postorder_traversal() {
@ -31,10 +25,10 @@ pub fn traverse_dom<N, C>(root: N,
}
}
debug_assert!(root.styling_mode() != StylingMode::Stop);
let context = C::new(shared, root.opaque());
if context.should_process(root) {
doit::<N, C>(&context, root);
}
doit::<N, C>(&context, root);
// Clear the local LRU cache since we store stateful elements inside.
context.local_context().style_sharing_candidate_cache.borrow_mut().clear();
}