From b90d2c7a0449d469a1625f293d39f519b901b3c6 Mon Sep 17 00:00:00 2001 From: Martin Robinson Date: Sat, 9 Jan 2016 06:31:23 +0500 Subject: [PATCH] servo: Merge #9008 - More aggressively remove Fragment RestyleDamage (from mrobinson:reflow); r=pcwalton Now clean up damage on all fragments that belong to a Flow. This ensures that damage does not re-propagate up to the parent Flow from the Fragments. It also means that the flow tree dump should show a more accurate picture of the state of the flow tree. Source-Repo: https://github.com/servo/servo Source-Revision: 1436ee5afab4ede68ab834c7d6368a7d45ede7ac --- servo/components/layout/block.rs | 9 +++++++-- servo/components/layout/inline.rs | 13 +++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/servo/components/layout/block.rs b/servo/components/layout/block.rs index 7de0d52ef423..d34ecfd546d7 100644 --- a/servo/components/layout/block.rs +++ b/servo/components/layout/block.rs @@ -45,7 +45,7 @@ use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, HAS_LAYER} use fragment::{SpecificFragmentInfo}; use gfx::display_list::{ClippingRegion, DisplayList}; use gfx_traits::LayerId; -use incremental::{REFLOW, REFLOW_OUT_OF_FLOW}; +use incremental::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW, REPAINT}; use layout_debug; use layout_task::DISPLAY_PORT_SIZE_FACTOR; use model::{CollapsibleMargins, MaybeAuto, specified, specified_or_none}; @@ -983,6 +983,7 @@ impl BlockFlow { self.formatting_context_type() == FormattingContextType::None) && !self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) { self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW); + self.fragment.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW); } } @@ -1202,6 +1203,7 @@ impl BlockFlow { self.base.position.size.block = block_size; self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW); + self.fragment.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW); } /// Compute inline size based using the `block_container_inline_size` set by the parent flow. @@ -1430,6 +1432,7 @@ impl BlockFlow { // earlier, lay it out again. self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW); + self.fragment.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW); } fn is_inline_block(&self) -> bool { @@ -1574,7 +1577,8 @@ impl Flow for BlockFlow { LengthOrPercentageOrAuto::Length(_) => false, _ => true, }; - self.bubble_inline_sizes_for_block(consult_children) + self.bubble_inline_sizes_for_block(consult_children); + self.fragment.restyle_damage.remove(BUBBLE_ISIZES); } /// Recursively (top-down) determines the actual inline-size of child contexts and fragments. @@ -1993,6 +1997,7 @@ impl Flow for BlockFlow { self.build_display_list_for_block(box DisplayList::new(), layout_context, BorderPaintingMode::Separate); + self.fragment.restyle_damage.remove(REPAINT); if opts::get().validate_display_list_geometry { self.base.validate_display_list_geometry(); } diff --git a/servo/components/layout/inline.rs b/servo/components/layout/inline.rs index 232de1bb5f20..9f77ecfcb9e2 100644 --- a/servo/components/layout/inline.rs +++ b/servo/components/layout/inline.rs @@ -17,7 +17,7 @@ use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, SpecificFr use gfx::display_list::OpaqueNode; use gfx::font::FontMetrics; use gfx::font_context::FontContext; -use incremental::{REFLOW, REFLOW_OUT_OF_FLOW, RESOLVE_GENERATED_CONTENT}; +use incremental::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW, REPAINT, RESOLVE_GENERATED_CONTENT}; use layout_debug; use model::IntrinsicISizesContribution; use std::cmp::max; @@ -1354,6 +1354,8 @@ impl Flow for InlineFlow { intrinsic_sizes_for_nonbroken_run.union_inline(&intrinsic_sizes_for_fragment); } } + + fragment.restyle_damage.remove(BUBBLE_ISIZES); } // Flush any remaining nonbroken-run and inline-run intrinsic sizes. @@ -1615,6 +1617,9 @@ impl Flow for InlineFlow { }); self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW); + for fragment in &mut self.fragments.fragments { + fragment.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW); + } } fn compute_absolute_position(&mut self, _: &LayoutContext) { @@ -1742,7 +1747,11 @@ impl Flow for InlineFlow { fn update_late_computed_block_position_if_necessary(&mut self, _: Au) {} fn build_display_list(&mut self, layout_context: &LayoutContext) { - self.build_display_list_for_inline(layout_context) + self.build_display_list_for_inline(layout_context); + + for fragment in &mut self.fragments.fragments { + fragment.restyle_damage.remove(REPAINT); + } } fn repair_style(&mut self, _: &Arc) {}