Incremental Style Recalc

This patch puts in the initial framework for incremental reflow. Nodes' styles
are no longer recalculated unless the node has changed.

I've been hacking on the general problem of incremental reflow for the past
couple weeks, and I've yet to get a full implementation that actually passes all
the reftests + wikipedia + cnn. Therefore, I'm going to try to land the different
parts of it one by one.

This patch only does incremental style recalc, without incremental flow
construction, inline-size bubbling, reflow, or display lists. Those will be coming
in that order as I finish them.

At least with this strategy, I can land a working version of incremental reflow,
even if not yet complete.

r? @pcwalton
This commit is contained in:
Clark Gaebel 2014-10-06 11:40:05 -04:00
parent 510f8a817f
commit d12c6e7383
31 changed files with 641 additions and 424 deletions

View file

@ -471,6 +471,13 @@ pub trait PreorderFlowTraversal {
/// The operation to perform. Return true to continue or false to stop.
fn process(&mut self, flow: &mut Flow) -> bool;
/// Returns true if this node must be processed in-order. If this returns false,
/// we skip the operation for this node, but continue processing the descendants.
/// This is called *after* parent nodes are visited.
fn should_process(&mut self, _flow: &mut Flow) -> bool {
true
}
/// Returns true if this node should be pruned. If this returns true, we skip the operation
/// entirely and do not process any descendant nodes. This is called *before* child nodes are
/// visited. The default implementation never prunes any nodes.
@ -1031,6 +1038,10 @@ impl<'a> MutableFlowUtils for &'a mut Flow + 'a {
return true
}
if !traversal.should_process(self) {
return true
}
if !traversal.process(self) {
return false
}
@ -1240,4 +1251,3 @@ impl ContainingBlockLink {
}
}
}