From 040c09fbc51ac282b7224799851d62cd3a60ee7f Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Thu, 17 Sep 2015 08:36:27 -0700 Subject: [PATCH] Always reset HAS_NEWLY_CONSTRUCTED_FLOW during flow construction This extra reflows when the HAS_NEWLY_CONSTRUCTED_FLOW flag remained set during a later reflow. This masked other incremental layout bugs, including the one tested by the reftest in the commit following this one. --- components/layout/construct.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/components/layout/construct.rs b/components/layout/construct.rs index dd1d58a6acc..d7e1628dd38 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -1296,10 +1296,9 @@ impl<'a> FlowConstructor<'a> { pub fn repair_if_possible(&mut self, node: &ThreadSafeLayoutNode) -> bool { // We can skip reconstructing the flow if we don't have to reconstruct and none of our kids // did either. - if node.restyle_damage().contains(RECONSTRUCT_FLOW) { - return false - } - + // + // We visit the kids first and reset their HAS_NEWLY_CONSTRUCTED_FLOW flags after checking + // them. NOTE: Make sure not to bail out early before resetting all the flags! let mut need_to_reconstruct = false; for kid in node.children() { if kid.flags().contains(HAS_NEWLY_CONSTRUCTED_FLOW) { @@ -1311,6 +1310,11 @@ impl<'a> FlowConstructor<'a> { return false } + if node.restyle_damage().contains(RECONSTRUCT_FLOW) { + return false + } + + let mut style = node.style().clone(); let mut layout_data_ref = node.mutate_layout_data(); let layout_data = layout_data_ref.as_mut().expect("no layout data");