servo: Merge #5588 - layout: During inline layout, make place_between_floats use the same line height computation logic as final block size assignment (from pcwalton:line-height-float-placement-redux); r=glennw

Basically, the easiest way to describe the effect of this change is "float placement takes line height into account". It didn't before, which could lead to lines overlapping floats or floats taking up too much vertical space.

Improves Wikipedia.

r? @glennw

Source-Repo: https://github.com/servo/servo
Source-Revision: d8507cce8c3969a08974f44a9f397e75cbe3131d
This commit is contained in:
Patrick Walton
2015-04-09 16:47:03 -05:00
parent a2b4701232
commit 60d1c35a15
3 changed files with 76 additions and 51 deletions

View File

@@ -1268,37 +1268,6 @@ impl Fragment {
}
}
/// Returns, and computes, the block-size of this fragment.
pub fn content_block_size(&self, layout_context: &LayoutContext) -> Au {
match self.specific {
SpecificFragmentInfo::Generic |
SpecificFragmentInfo::GeneratedContent(_) |
SpecificFragmentInfo::Iframe(_) |
SpecificFragmentInfo::Table |
SpecificFragmentInfo::TableCell |
SpecificFragmentInfo::TableRow |
SpecificFragmentInfo::TableWrapper |
SpecificFragmentInfo::InlineBlock(_) |
SpecificFragmentInfo::InlineAbsoluteHypothetical(_) => Au(0),
SpecificFragmentInfo::Image(ref image_fragment_info) => {
image_fragment_info.replaced_image_fragment_info.computed_block_size()
}
SpecificFragmentInfo::Canvas(ref canvas_fragment_info) => {
canvas_fragment_info.replaced_image_fragment_info.computed_block_size()
}
SpecificFragmentInfo::ScannedText(_) => {
// Compute the block-size based on the line-block-size and font size.
self.calculate_line_height(layout_context)
}
SpecificFragmentInfo::TableColumn(_) => {
panic!("Table column fragments do not have block size")
}
SpecificFragmentInfo::UnscannedText(_) => {
panic!("Unscanned text fragments should have been scanned by now!")
}
}
}
/// Returns the dimensions of the content box.
///
/// This is marked `#[inline]` because it is frequently called when only one or two of the