Skip to content

Commit

Permalink
More accurate margin collapsing
Browse files Browse the repository at this point in the history
  • Loading branch information
ILyoan committed Sep 11, 2013
1 parent 25a3d4a commit e561570
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/components/main/layout/block.rs
Expand Up @@ -7,7 +7,7 @@
use layout::box::{RenderBox};
use layout::context::LayoutContext;
use layout::display_list_builder::{DisplayListBuilder, ExtraDisplayListData};
use layout::flow::{BlockFlow, FlowContext, FlowData, InlineBlockFlow, FloatFlow};
use layout::flow::{BlockFlow, FlowContext, FlowData, InlineBlockFlow, FloatFlow, InlineFlow};
use layout::inline::InlineLayout;
use layout::model::{MaybeAuto, Specified, Auto};
use layout::float_context::{FloatContext, Invalid};
Expand Down Expand Up @@ -333,6 +333,7 @@ impl BlockFlowData {
margin_bottom = model.margin.bottom;
}
}

for kid in self.common.child_iter() {
match *kid {
BlockFlow(ref info) => {
Expand All @@ -359,10 +360,18 @@ impl BlockFlowData {
}
first_inflow = false;
}
InlineFlow(ref info) => {
collapsing = Au(0);
// Non-empty inline flows prevent collapsing between the previous margion and the next.
if info.common.position.size.height > Au(0) {
collapsible = Au(0);
}
}
// Margins between a floated box and any other box do not collapse.
_ => {
collapsing = Au(0);
}
// TODO: Handling for AbsoluteFlow, InlineBlockFlow and TableFlow?
}

do kid.with_mut_base |child_node| {
Expand Down

5 comments on commit e561570

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from metajack
at ILyoan@e561570

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging ILyoan/servo/margin_collapse_fix = e561570 into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ILyoan/servo/margin_collapse_fix = e561570 merged ok, testing candidate = 585b047

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 585b047

Please sign in to comment.