aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/traversal.rs
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2014-10-14 16:51:30 -0600
committerbors-servo <metajack+bors@gmail.com>2014-10-14 16:51:30 -0600
commit56989b8dec4aa95a3b484d45f15b23f9b3daaf13 (patch)
tree91c6c430b9a9513be320bc69d79b63f1523f2af5 /components/layout/traversal.rs
parente2d7777c41135b71293c195d2a9d7a1bc2afd0ca (diff)
parentf552e2f7501337fae76ad66401a1e011d00211df (diff)
downloadservo-56989b8dec4aa95a3b484d45f15b23f9b3daaf13.tar.gz
servo-56989b8dec4aa95a3b484d45f15b23f9b3daaf13.zip
auto merge of #3640 : cgaebel/servo/incremental-flow-construction, r=pcwalton
This also hides the not-yet-working parts of incremental reflow behind a runtime flag. As I get the failing reftests passing, I'll send pull requests for them one by one.
Diffstat (limited to 'components/layout/traversal.rs')
-rw-r--r--components/layout/traversal.rs33
1 files changed, 27 insertions, 6 deletions
diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs
index 41896ba1fad..b9686e84276 100644
--- a/components/layout/traversal.rs
+++ b/components/layout/traversal.rs
@@ -132,8 +132,15 @@ impl<'a> PreorderDomTraversal for RecalcStyleForNode<'a> {
// Just needs to be wrapped in an option for `match_node`.
let some_bf = Some(bf);
- if node.is_dirty() {
- // First, check to see whether we can share a style with someone.
+ if node.is_dirty() || node.has_dirty_siblings() {
+ // Remove existing CSS styles from changed nodes, to force
+ // non-incremental reflow.
+ if node.has_changed() {
+ let node = ThreadSafeLayoutNode::new(&node);
+ node.unstyle();
+ }
+
+ // Check to see whether we can share a style with someone.
let style_sharing_candidate_cache =
self.layout_context.style_sharing_candidate_cache();
let sharing_result = unsafe {
@@ -194,17 +201,31 @@ impl<'a> PostorderDomTraversal for ConstructFlows<'a> {
fn process(&self, node: LayoutNode) {
// Construct flows for this node.
{
- let node = ThreadSafeLayoutNode::new(&node);
- let mut flow_constructor = FlowConstructor::new(self.layout_context);
- flow_constructor.process(&node);
+ let tnode = ThreadSafeLayoutNode::new(&node);
+
+ // Always re-construct if incremental layout is turned off.
+ if !self.layout_context.shared.opts.incremental_layout {
+ unsafe {
+ node.set_dirty_descendants(true);
+ }
+ }
+
+ if node.has_dirty_descendants() {
+ tnode.set_restyle_damage(RestyleDamage::all());
+ debug!("Constructing flow for {}", tnode.debug_id());
+ let mut flow_constructor = FlowConstructor::new(self.layout_context);
+ flow_constructor.process(&tnode);
+ }
// Reset the layout damage in this node. It's been propagated to the
// flow by the flow constructor.
- node.set_restyle_damage(RestyleDamage::empty());
+ tnode.set_restyle_damage(RestyleDamage::empty());
}
unsafe {
+ node.set_changed(false);
node.set_dirty(false);
+ node.set_dirty_siblings(false);
node.set_dirty_descendants(false);
}