diff options
author | Jack Moffitt <jack@metajack.im> | 2013-08-05 17:24:34 -0600 |
---|---|---|
committer | Jack Moffitt <jack@metajack.im> | 2013-08-05 17:24:34 -0600 |
commit | 3837b9538a078456cf6e11dda955fc764ef80520 (patch) | |
tree | a1861eca542c922408bf11658e5e9241559f7794 | |
parent | 9fcf8b4402ea2fd10c7ff44fce86a59020ac4b82 (diff) | |
download | servo-3837b9538a078456cf6e11dda955fc764ef80520.tar.gz servo-3837b9538a078456cf6e11dda955fc764ef80520.zip |
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.
-rw-r--r-- | src/components/main/layout/float.rs | 16 |
1 files 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); |