layout: Refactor a few things, mostly just to obey the line limit.

This commit is contained in:
Patrick Walton 2014-09-26 20:35:32 -07:00
parent fb5952fed0
commit 690bf079f7

View file

@ -1056,7 +1056,7 @@ impl Fragment {
let content_box = self.content_box();
let absolute_content_box = rect_to_absolute(content_box);
// Add a clip, if applicable.
// Create special per-fragment-type display items.
match self.specific {
UnscannedTextFragment(_) => fail!("Shouldn't see unscanned fragments here."),
TableColumnFragment(_) => fail!("Shouldn't see table column fragments here."),
@ -1090,7 +1090,6 @@ impl Fragment {
};
accumulator.push(display_list, TextDisplayItemClass(text_display_item));
// Create display items for text decoration
{
let line = |maybe_color: Option<RGBA>, rect: || -> LogicalRect<Au>| {
@ -1139,13 +1138,13 @@ impl Fragment {
debug!("{:?}", self.build_debug_borders_around_text_fragments(display_list,
flow_origin,
text_fragment))
},
GenericFragment | IframeFragment(..) | TableFragment | TableCellFragment | TableRowFragment |
TableWrapperFragment | InlineBlockFragment(_) => {
}
GenericFragment | IframeFragment(..) | TableFragment | TableCellFragment |
TableRowFragment | TableWrapperFragment | InlineBlockFragment(_) => {
// FIXME(pcwalton): This is a bit of an abuse of the logging infrastructure. We
// should have a real `SERVO_DEBUG` system.
debug!("{:?}", self.build_debug_borders_around_fragment(display_list, flow_origin))
},
}
ImageFragment(_) => {
match self.specific {
ImageFragment(ref image_fragment) => {
@ -1188,13 +1187,15 @@ impl Fragment {
// problematic if iframes are outside the area we're computing the display list for, since
// they won't be able to reflow at all until the user scrolls to them. Perhaps we should
// separate this into two parts: first we should send the size only to the constellation
// once that's computed during assign-block-sizes, and second we should should send the origin
// to the constellation here during display list construction. This should work because
// layout for the iframe only needs to know size, and origin is only relevant if the
// iframe is actually going to be displayed.
// once that's computed during assign-block-sizes, and second we should should send the
// origin to the constellation here during display list construction. This should work
// because layout for the iframe only needs to know size, and origin is only relevant if
// the iframe is actually going to be displayed.
match self.specific {
IframeFragment(ref iframe_fragment) => {
self.finalize_position_and_size_of_iframe(iframe_fragment, flow_origin, layout_context)
self.finalize_position_and_size_of_iframe(iframe_fragment,
flow_origin,
layout_context)
}
_ => {}
}
@ -1287,8 +1288,8 @@ impl Fragment {
/// Returns, and computes, the block-size of this fragment.
pub fn content_block_size(&self, layout_context: &LayoutContext) -> Au {
match self.specific {
GenericFragment | IframeFragment(_) | TableFragment | TableCellFragment | TableRowFragment |
TableWrapperFragment | InlineBlockFragment(_) => Au(0),
GenericFragment | IframeFragment(_) | TableFragment | TableCellFragment |
TableRowFragment | TableWrapperFragment | InlineBlockFragment(_) => Au(0),
ImageFragment(ref image_fragment_info) => {
image_fragment_info.computed_block_size()
}
@ -1466,10 +1467,12 @@ impl Fragment {
pub fn assign_replaced_inline_size_if_necessary(&mut self,
container_inline_size: Au) {
match self.specific {
GenericFragment | IframeFragment(_) | TableFragment | TableCellFragment | TableRowFragment |
TableWrapperFragment => return,
GenericFragment | IframeFragment(_) | TableFragment | TableCellFragment |
TableRowFragment | TableWrapperFragment => return,
TableColumnFragment(_) => fail!("Table column fragments do not have inline_size"),
UnscannedTextFragment(_) => fail!("Unscanned text fragments should have been scanned by now!"),
UnscannedTextFragment(_) => {
fail!("Unscanned text fragments should have been scanned by now!")
}
ImageFragment(_) | ScannedTextFragment(_) | InlineBlockFragment(_) => {}
};
@ -1541,16 +1544,18 @@ impl Fragment {
}
}
/// Assign block-size for this fragment if it is replaced content. The inline-size must have been assigned
/// first.
/// Assign block-size for this fragment if it is replaced content. The inline-size must have
/// been assigned first.
///
/// Ideally, this should follow CSS 2.1 § 10.6.2.
pub fn assign_replaced_block_size_if_necessary(&mut self) {
match self.specific {
GenericFragment | IframeFragment(_) | TableFragment | TableCellFragment | TableRowFragment |
TableWrapperFragment => return,
GenericFragment | IframeFragment(_) | TableFragment | TableCellFragment |
TableRowFragment | TableWrapperFragment => return,
TableColumnFragment(_) => fail!("Table column fragments do not have block_size"),
UnscannedTextFragment(_) => fail!("Unscanned text fragments should have been scanned by now!"),
UnscannedTextFragment(_) => {
fail!("Unscanned text fragments should have been scanned by now!")
}
ImageFragment(_) | ScannedTextFragment(_) | InlineBlockFragment(_) => {}
}