layout: Minor style cleanup.

This commit is contained in:
Patrick Walton 2016-10-24 18:22:01 -07:00
parent 824a5e2e13
commit ba005a93b8
4 changed files with 30 additions and 16 deletions

View file

@ -397,8 +397,9 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
let scanned_fragments =
TextRunScanner::new().scan_for_runs(&mut self.layout_context.font_context(),
fragments.fragments);
let mut inline_flow_ref: FlowRef = Arc::new(
InlineFlow::from_fragments(scanned_fragments, node.style(self.style_context()).writing_mode));
let mut inline_flow_ref: FlowRef =
Arc::new(InlineFlow::from_fragments(scanned_fragments,
node.style(self.style_context()).writing_mode));
// Add all the inline-block fragments as children of the inline flow.
for inline_block_flow in &inline_block_flows {
@ -1019,9 +1020,10 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
/// Builds a flow for a node with `column-count` or `column-width` non-`auto`.
/// This yields a `MulticolFlow` with a single `MulticolColumnFlow` underneath it.
fn build_flow_for_multicol(&mut self, node: &ConcreteThreadSafeLayoutNode,
float_kind: Option<FloatKind>)
-> ConstructionResult {
fn build_flow_for_multicol(&mut self,
node: &ConcreteThreadSafeLayoutNode,
float_kind: Option<FloatKind>)
-> ConstructionResult {
let fragment = Fragment::new(node, SpecificFragmentInfo::Multicol, self.layout_context);
let mut flow: FlowRef = Arc::new(MulticolFlow::from_fragment(fragment, float_kind));
@ -1110,6 +1112,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
// The flow is done.
legalizer.finish(&mut wrapper_flow);
wrapper_flow.finish();
let contains_positioned_fragments = wrapper_flow.contains_positioned_fragments();
if contains_positioned_fragments {
// This is the containing block for all the absolute descendants.
@ -1177,7 +1180,9 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
/// Builds a flow for a node with `display: list-item`. This yields a `ListItemFlow` with
/// possibly other `BlockFlow`s or `InlineFlow`s underneath it.
fn build_flow_for_list_item(&mut self, node: &ConcreteThreadSafeLayoutNode, flotation: float::T)
fn build_flow_for_list_item(&mut self,
node: &ConcreteThreadSafeLayoutNode,
flotation: float::T)
-> ConstructionResult {
let flotation = FloatKind::from_property(flotation);
let marker_fragments = match node.style(self.style_context()).get_list().list_style_image {
@ -1280,7 +1285,9 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
}
/// Builds a flow for a node with 'display: flex'.
fn build_flow_for_flex(&mut self, node: &ConcreteThreadSafeLayoutNode, float_kind: Option<FloatKind>)
fn build_flow_for_flex(&mut self,
node: &ConcreteThreadSafeLayoutNode,
float_kind: Option<FloatKind>)
-> ConstructionResult {
let fragment = self.build_fragment_for_block(node);
let flow = Arc::new(FlexFlow::from_fragment(fragment, float_kind));

View file

@ -959,7 +959,8 @@ impl fmt::Debug for BaseFlow {
};
write!(f,
"sc={:?} pos={:?}, {}{} floatspec-in={:?}, floatspec-out={:?}, overflow={:?}{}{}{}",
"sc={:?} pos={:?}, {}{} floatspec-in={:?}, floatspec-out={:?}, \
overflow={:?}{}{}{}",
self.stacking_context_id,
self.position,
if self.flags.contains(FLOATS_LEFT) { "FL" } else { "" },

View file

@ -124,10 +124,9 @@ impl TableFlow {
}
}
total_inline_sizes.minimum_inline_size = total_inline_sizes.minimum_inline_size +
total_inline_sizes.minimum_inline_size +=
parent_inline_sizes[column_index].minimum_length;
total_inline_sizes.preferred_inline_size =
total_inline_sizes.preferred_inline_size +
total_inline_sizes.preferred_inline_size +=
parent_inline_sizes[column_index].preferred;
column_index += 1
@ -380,7 +379,8 @@ impl Flow for TableFlow {
TableLayout::Fixed => {
// In fixed table layout, we distribute extra space among the unspecified columns
// if there are any, or among all the columns if all are specified.
// See: https://drafts.csswg.org/css-tables-3/#distributing-width-to-columns (infobox)
// See: https://drafts.csswg.org/css-tables-3/#distributing-width-to-columns
// (infobox)
self.column_computed_inline_sizes.clear();
if num_unspecified_inline_sizes != 0 {
let extra_column_inline_size = content_inline_size - total_column_inline_size;

View file

@ -76,6 +76,7 @@ impl TableWrapperFlow {
table_layout: table_layout
}
}
fn border_padding_and_spacing(&mut self) -> (Au, Au) {
let (mut table_border_padding, mut spacing) = (Au(0), Au(0));
for kid in self.block_flow.base.child_iter_mut() {
@ -366,9 +367,12 @@ impl Flow for TableWrapperFlow {
containing_block_inline_size,
&intermediate_column_inline_sizes);
if let TableLayout::Auto = self.table_layout {
self.calculate_table_column_sizes_for_automatic_layout(
&mut intermediate_column_inline_sizes)
match self.table_layout {
TableLayout::Auto => {
self.calculate_table_column_sizes_for_automatic_layout(
&mut intermediate_column_inline_sizes)
}
TableLayout::Fixed => {}
}
let inline_start_content_edge = self.block_flow.fragment.border_box.start.i;
@ -885,7 +889,9 @@ impl ISizeAndMarginsComputer for AbsoluteTable {
parent_flow_inline_size: Au,
shared_context: &SharedStyleContext)
-> Au {
AbsoluteNonReplaced.containing_block_inline_size(block, parent_flow_inline_size, shared_context)
AbsoluteNonReplaced.containing_block_inline_size(block,
parent_flow_inline_size,
shared_context)
}
fn solve_inline_size_constraints(&self,