Auto merge of #5584 - pcwalton:fix-a-float-redux, r=glennw

As far as I can tell, this is a cut-and-paste of old buggy code from
block flows. Delegating to the correct block flow code fixes the sidebar
float placement on Guardians of the Galaxy.

r? @glennw
This commit is contained in:
bors-servo 2015-04-08 03:57:36 -05:00
commit f4da0f0e94
5 changed files with 112 additions and 16 deletions

View file

@ -1417,6 +1417,8 @@ impl BlockFlow {
match style.get_box().display {
display::T::table_cell |
display::T::table_caption |
display::T::table_row_group |
display::T::table |
display::T::inline_block => {
FormattingContextType::Other
}
@ -1693,7 +1695,7 @@ impl Flow for BlockFlow {
fn assign_block_size<'a>(&mut self, ctx: &'a LayoutContext<'a>) {
if self.is_replaced_content() {
let _scope = layout_debug_scope!("assign_replaced_block_size_if_necessary {:x}",
self.base.debug_id());
self.base.debug_id());
// Assign block-size for fragment if it is an image fragment.
let containing_block_block_size =
@ -1704,10 +1706,12 @@ impl Flow for BlockFlow {
}
} else if self.is_root() || self.base.flags.is_float() || self.is_inline_block() {
// Root element margins should never be collapsed according to CSS § 8.3.1.
debug!("assign_block_size: assigning block_size for root flow {:?}", flow::base(self).debug_id());
debug!("assign_block_size: assigning block_size for root flow {:?}",
flow::base(self).debug_id());
self.assign_block_size_block_base(ctx, MarginsMayCollapseFlag::MarginsMayNotCollapse);
} else {
debug!("assign_block_size: assigning block_size for block {:?}", flow::base(self).debug_id());
debug!("assign_block_size: assigning block_size for block {:?}",
flow::base(self).debug_id());
self.assign_block_size_block_base(ctx, MarginsMayCollapseFlag::MarginsMayCollapse);
}
}

View file

@ -336,9 +336,11 @@ impl Flow for TableWrapperFlow {
}
fn assign_block_size<'a>(&mut self, ctx: &'a LayoutContext<'a>) {
fn assign_block_size<'a>(&mut self, layout_context: &'a LayoutContext<'a>) {
debug!("assign_block_size: assigning block_size for table_wrapper");
self.block_flow.assign_block_size_block_base(ctx, MarginsMayCollapseFlag::MarginsMayNotCollapse);
self.block_flow
.assign_block_size_block_base(layout_context,
MarginsMayCollapseFlag::MarginsMayNotCollapse);
}
fn compute_absolute_position(&mut self) {
@ -353,17 +355,8 @@ impl Flow for TableWrapperFlow {
layout_context: &'a LayoutContext<'a>,
parent_thread_id: u8)
-> bool {
if self.block_flow.base.flags.is_float() {
self.block_flow.place_float();
return true
}
let impacted = self.block_flow.base.flags.impacted_by_floats();
if impacted {
self.block_flow.base.thread_id = parent_thread_id;
self.assign_block_size(layout_context);
}
impacted
self.block_flow.assign_block_size_for_inorder_child_if_necessary(layout_context,
parent_thread_id)
}
fn update_late_computed_inline_position_if_necessary(&mut self, inline_position: Au) {