aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2016-10-24 18:22:01 -0700
committerPatrick Walton <pcwalton@mimiga.net>2016-10-26 14:14:16 -0700
commitba005a93b89c5b6b1a4ce315c5d30058f7bfae1e (patch)
tree7601a0ae9ebc7cfb69db14273f6ba9e5035cabbf
parent824a5e2e13fc02b93c9257e794253788d94dd8fc (diff)
downloadservo-ba005a93b89c5b6b1a4ce315c5d30058f7bfae1e.tar.gz
servo-ba005a93b89c5b6b1a4ce315c5d30058f7bfae1e.zip
layout: Minor style cleanup.
-rw-r--r--components/layout/construct.rs21
-rw-r--r--components/layout/flow.rs3
-rw-r--r--components/layout/table.rs8
-rw-r--r--components/layout/table_wrapper.rs14
4 files changed, 30 insertions, 16 deletions
diff --git a/components/layout/construct.rs b/components/layout/construct.rs
index f59c76d2885..d3a0c63e7a6 100644
--- a/components/layout/construct.rs
+++ b/components/layout/construct.rs
@@ -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));
diff --git a/components/layout/flow.rs b/components/layout/flow.rs
index 8959760bcee..2c85febaf2c 100644
--- a/components/layout/flow.rs
+++ b/components/layout/flow.rs
@@ -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 { "" },
diff --git a/components/layout/table.rs b/components/layout/table.rs
index a1ec2553f99..9abd030f68b 100644
--- a/components/layout/table.rs
+++ b/components/layout/table.rs
@@ -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;
diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs
index 7d8deff2ac9..ec029f8d06f 100644
--- a/components/layout/table_wrapper.rs
+++ b/components/layout/table_wrapper.rs
@@ -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,