From 3837b9538a078456cf6e11dda955fc764ef80520 Mon Sep 17 00:00:00 2001 From: Jack Moffitt Date: Mon, 5 Aug 2013 17:24:34 -0600 Subject: [PATCH] Fix the handling of flow_contexts in floats. The num_floats was hard-coded to 1 and didn't take into account the children. Also the float context was not being threaded through the children properly. --- src/components/main/layout/float.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/components/main/layout/float.rs b/src/components/main/layout/float.rs index 5de723a5669..f8024464fd6 100644 --- a/src/components/main/layout/float.rs +++ b/src/components/main/layout/float.rs @@ -63,8 +63,7 @@ impl FloatFlowData { pub fn bubble_widths_float(@mut self, ctx: &LayoutContext) { let mut min_width = Au(0); let mut pref_width = Au(0); - - self.common.num_floats = 1; + let mut num_floats = 1; for FloatFlow(self).each_child |child_ctx| { //assert!(child_ctx.starts_block_flow() || child_ctx.starts_inline_flow()); @@ -72,10 +71,14 @@ impl FloatFlowData { do child_ctx.with_mut_base |child_node| { min_width = geometry::max(min_width, child_node.min_width); pref_width = geometry::max(pref_width, child_node.pref_width); - child_node.floats_in = FloatContext::new(child_node.num_floats); + + num_floats = num_floats + child_node.num_floats; } } + self.common.num_floats = num_floats; + + self.box.map(|&box| { let style = box.style(); do box.with_model |model| { @@ -162,8 +165,15 @@ impl FloatFlowData { } pub fn assign_height_float(@mut self, ctx: &mut LayoutContext) { + let mut float_ctx = FloatContext::new(self.common.num_floats); for FloatFlow(self).each_child |kid| { + do kid.with_mut_base |child_node| { + child_node.floats_in = float_ctx.clone(); + } kid.assign_height(ctx); + do kid.with_mut_base |child_node| { + float_ctx = child_node.floats_out.clone(); + } } let mut cur_y = Au(0);