From 7ca3c8d6e3baddeb8a1602d92ce0c8bc55f13026 Mon Sep 17 00:00:00 2001 From: Glenn Watson Date: Mon, 16 Mar 2015 14:17:54 +1000 Subject: [PATCH 1/2] Restore part of PR #5125 that was accidentally removed in PR #5160. --- components/layout/construct.rs | 44 ++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/components/layout/construct.rs b/components/layout/construct.rs index b29b6507c2d..bcc218702d2 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -588,7 +588,7 @@ impl<'a> FlowConstructor<'a> { if node.type_id() == Some(NodeTypeId::Element(ElementTypeId::HTMLElement( HTMLElementTypeId::HTMLTextAreaElement))) { for kid in node.children() { - kid.set_flow_construction_result(ConstructionResult::None) + self.set_flow_construction_result(&kid, ConstructionResult::None) } } @@ -744,7 +744,7 @@ impl<'a> FlowConstructor<'a> { fn build_fragments_for_replaced_inline_content(&mut self, node: &ThreadSafeLayoutNode) -> ConstructionResult { for kid in node.children() { - kid.set_flow_construction_result(ConstructionResult::None) + self.set_flow_construction_result(&kid, ConstructionResult::None) } // If this node is ignorable whitespace, bail out now. @@ -1095,7 +1095,7 @@ impl<'a> FlowConstructor<'a> { -> ConstructionResult { // CSS 2.1 ยง 17.2.1. Treat all child fragments of a `table-column` as `display: none`. for kid in node.children() { - kid.set_flow_construction_result(ConstructionResult::None) + self.set_flow_construction_result(&kid, ConstructionResult::None) } let specific = SpecificFragmentInfo::TableColumn(TableColumnFragmentInfo::new(node)); @@ -1222,15 +1222,15 @@ impl<'a> PostorderNodeMutTraversal for FlowConstructor<'a> { // results of children. (display::T::none, _, _) => { for child in node.children() { - child.set_flow_construction_result(ConstructionResult::None); + self.set_flow_construction_result(&child, ConstructionResult::None); } - node.set_flow_construction_result(ConstructionResult::None); + self.set_flow_construction_result(node, ConstructionResult::None); } // Table items contribute table flow construction results. (display::T::table, float_value, _) => { let construction_result = self.build_flow_for_table_wrapper(node, float_value); - node.set_flow_construction_result(construction_result) + self.set_flow_construction_result(node, construction_result) } // Absolutely positioned elements will have computed value of @@ -1241,13 +1241,14 @@ impl<'a> PostorderNodeMutTraversal for FlowConstructor<'a> { // below. (display::T::block, _, position::T::absolute) | (_, _, position::T::fixed) => { - node.set_flow_construction_result(self.build_flow_for_nonfloated_block(node)) + let construction_result = self.build_flow_for_nonfloated_block(node); + self.set_flow_construction_result(node, construction_result) } // List items contribute their own special flows. (display::T::list_item, float_value, _) => { - node.set_flow_construction_result(self.build_flow_for_list_item(node, - float_value)) + let construction_result = self.build_flow_for_list_item(node, float_value); + self.set_flow_construction_result(node, construction_result) } // Inline items that are absolutely-positioned contribute inline fragment construction @@ -1255,7 +1256,7 @@ impl<'a> PostorderNodeMutTraversal for FlowConstructor<'a> { (display::T::inline, _, position::T::absolute) => { let construction_result = self.build_fragment_for_absolutely_positioned_inline(node); - node.set_flow_construction_result(construction_result) + self.set_flow_construction_result(node, construction_result) } // Inline items contribute inline fragment construction results. @@ -1263,31 +1264,31 @@ impl<'a> PostorderNodeMutTraversal for FlowConstructor<'a> { // FIXME(pcwalton, #3307): This is not sufficient to handle floated generated content. (display::T::inline, float::T::none, _) => { let construction_result = self.build_fragments_for_inline(node); - node.set_flow_construction_result(construction_result) + self.set_flow_construction_result(node, construction_result) } // Inline-block items contribute inline fragment construction results. (display::T::inline_block, float::T::none, _) => { let construction_result = self.build_fragment_for_inline_block(node); - node.set_flow_construction_result(construction_result) + self.set_flow_construction_result(node, construction_result) } // Table items contribute table flow construction results. (display::T::table_caption, _, _) => { let construction_result = self.build_flow_for_table_caption(node); - node.set_flow_construction_result(construction_result) + self.set_flow_construction_result(node, construction_result) } // Table items contribute table flow construction results. (display::T::table_column_group, _, _) => { let construction_result = self.build_flow_for_table_colgroup(node); - node.set_flow_construction_result(construction_result) + self.set_flow_construction_result(node, construction_result) } // Table items contribute table flow construction results. (display::T::table_column, _, _) => { let construction_result = self.build_fragments_for_table_column(node); - node.set_flow_construction_result(construction_result) + self.set_flow_construction_result(node, construction_result) } // Table items contribute table flow construction results. @@ -1295,19 +1296,19 @@ impl<'a> PostorderNodeMutTraversal for FlowConstructor<'a> { (display::T::table_header_group, _, _) | (display::T::table_footer_group, _, _) => { let construction_result = self.build_flow_for_table_rowgroup(node); - node.set_flow_construction_result(construction_result) + self.set_flow_construction_result(node, construction_result) } // Table items contribute table flow construction results. (display::T::table_row, _, _) => { let construction_result = self.build_flow_for_table_row(node); - node.set_flow_construction_result(construction_result) + self.set_flow_construction_result(node, construction_result) } // Table items contribute table flow construction results. (display::T::table_cell, _, _) => { let construction_result = self.build_flow_for_table_cell(node); - node.set_flow_construction_result(construction_result) + self.set_flow_construction_result(node, construction_result) } // Block flows that are not floated contribute block flow construction results. @@ -1316,14 +1317,15 @@ impl<'a> PostorderNodeMutTraversal for FlowConstructor<'a> { // properties separately. (_, float::T::none, _) => { - node.set_flow_construction_result(self.build_flow_for_nonfloated_block(node)) + let construction_result = self.build_flow_for_nonfloated_block(node); + self.set_flow_construction_result(node, construction_result) } // Floated flows contribute float flow construction results. (_, float_value, _) => { let float_kind = FloatKind::from_property(float_value); - node.set_flow_construction_result( - self.build_flow_for_floated_block(node, float_kind)) + let construction_result = self.build_flow_for_floated_block(node, float_kind); + self.set_flow_construction_result(node, construction_result) } } From 591b10aa58a8232912eaedb058e3e58aa0338244 Mon Sep 17 00:00:00 2001 From: Glenn Watson Date: Mon, 16 Mar 2015 15:04:00 +1000 Subject: [PATCH 2/2] Fix for race condition causing reftests to hang under load. If the root layer has a zero size rectangle, it will never be painted, so assume the pipeline is idle in that case. Re-enable two reftests that were disabled due to this issue. --- components/compositing/compositor.rs | 16 +++++++++++++--- tests/ref/basic.list | 5 ++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 715c3bc8912..895f08795bc 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -15,7 +15,7 @@ use std::cmp; use std::mem; use geom::point::{Point2D, TypedPoint2D}; use geom::rect::{Rect, TypedRect}; -use geom::size::TypedSize2D; +use geom::size::{Size2D, TypedSize2D}; use geom::scale_factor::ScaleFactor; use gfx::color; use gfx::paint_task::Msg as PaintMsg; @@ -450,8 +450,18 @@ impl IOCompositor { return false; } return self.pipeline_details.values().all(|ref details| { - details.paint_state == PaintState::Idle - }); + // If a pipeline exists and has a root layer that has + // zero size, it will never be painted. In this case, + // consider it as idle to avoid hangs in reftests. + if let Some(ref pipeline) = details.pipeline { + if let Some(root_layer) = self.find_pipeline_root_layer(pipeline.id) { + if root_layer.bounds.borrow().size == Size2D::zero() { + return true; + } + } + } + details.paint_state == PaintState::Idle + }); } fn has_paint_msg_tracking(&self) -> bool { diff --git a/tests/ref/basic.list b/tests/ref/basic.list index e568e5e2311..96d9178e7b1 100644 --- a/tests/ref/basic.list +++ b/tests/ref/basic.list @@ -95,6 +95,8 @@ flaky_cpu == append_style_a.html append_style_b.html == iframe/bg_color.html iframe/bg_color_ref.html == iframe/hide_and_show.html iframe/hide_and_show_ref.html +== iframe/hide_layers1.html iframe/hide_layers_ref.html +== iframe/hide_layers2.html iframe/hide_layers_ref.html == iframe/multiple_external.html iframe/multiple_external_ref.html == iframe/overflow.html iframe/overflow_ref.html == iframe/positioning_margin.html iframe/positioning_margin_ref.html @@ -107,9 +109,6 @@ flaky_cpu == append_style_a.html append_style_b.html == iframe/simple_inline_width_height.html iframe/simple_inline_width_height_ref.html == iframe/simple_inline_width_percentage.html iframe/simple_inline_width_percentage_ref.html -# gw: race condition here caused by pipelines never painting when removed from document -#== iframe/hide_layers1.html iframe/hide_layers_ref.html -#== iframe/hide_layers2.html iframe/hide_layers_ref.html != image_rendering_auto_a.html image_rendering_pixelated_a.html == image_rendering_pixelated_a.html image_rendering_pixelated_ref.html == img_block_display_a.html img_block_display_ref.html