diff --git a/components/layout/block.rs b/components/layout/block.rs index 741d0369daa..ab810c59521 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -1719,10 +1719,10 @@ impl Flow for BlockFlow { /// /// Dual fragments consume some inline-size first, and the remainder is assigned to all child /// (block) contexts. - fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) { + fn assign_inline_sizes(&mut self, shared_context: &SharedStyleContext) { let _scope = layout_debug_scope!("block::assign_inline_sizes {:x}", self.base.debug_id()); - self.compute_inline_sizes(layout_context.shared_context()); + self.compute_inline_sizes(shared_context); // Move in from the inline-start border edge. let inline_start_content_edge = self.fragment.border_box.start.i + @@ -1737,7 +1737,7 @@ impl Flow for BlockFlow { let content_inline_size = self.fragment.border_box.size.inline - padding_and_borders; - self.propagate_assigned_inline_size_to_children(layout_context.shared_context(), + self.propagate_assigned_inline_size_to_children(shared_context, inline_start_content_edge, inline_end_content_edge, content_inline_size, diff --git a/components/layout/flex.rs b/components/layout/flex.rs index 200402cf42f..031ebb03e8b 100644 --- a/components/layout/flex.rs +++ b/components/layout/flex.rs @@ -25,9 +25,9 @@ use script_layout_interface::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW}; use std::cmp::max; use std::sync::Arc; use style::computed_values::flex_direction; -use style::context::StyleContext; use style::logical_geometry::LogicalSize; use style::properties::{ComputedValues, ServoComputedValues}; +use style::servo::SharedStyleContext; use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto, LengthOrPercentageOrNone}; /// The size of an axis. May be a specified size, a min/max @@ -185,7 +185,7 @@ impl FlexFlow { // Currently, this is the core of BlockFlow::propagate_assigned_inline_size_to_children() with // all float and table logic stripped out. fn block_mode_assign_inline_sizes(&mut self, - _layout_context: &LayoutContext, + _shared_context: &SharedStyleContext, inline_start_content_edge: Au, inline_end_content_edge: Au, content_inline_size: Au) { @@ -230,7 +230,7 @@ impl FlexFlow { // Currently, this is the core of InlineFlow::propagate_assigned_inline_size_to_children() with // fragment logic stripped out. fn inline_mode_assign_inline_sizes(&mut self, - _layout_context: &LayoutContext, + _shared_context: &SharedStyleContext, inline_start_content_edge: Au, _inline_end_content_edge: Au, content_inline_size: Au) { @@ -403,7 +403,7 @@ impl Flow for FlexFlow { } } - fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) { + fn assign_inline_sizes(&mut self, shared_context: &SharedStyleContext) { let _scope = layout_debug_scope!("flex::assign_inline_sizes {:x}", self.block_flow.base.debug_id()); debug!("assign_inline_sizes"); @@ -414,7 +414,7 @@ impl Flow for FlexFlow { // Our inline-size was set to the inline-size of the containing block by the flow's parent. // Now compute the real value. let containing_block_inline_size = self.block_flow.base.block_container_inline_size; - self.block_flow.compute_used_inline_size(layout_context.shared_context(), containing_block_inline_size); + self.block_flow.compute_used_inline_size(shared_context, containing_block_inline_size); if self.block_flow.base.flags.is_float() { self.block_flow.float.as_mut().unwrap().containing_inline_size = containing_block_inline_size } @@ -461,7 +461,7 @@ impl Flow for FlexFlow { Mode::Inline => { self.available_main_size = available_inline_size; self.available_cross_size = available_block_size; - self.inline_mode_assign_inline_sizes(layout_context, + self.inline_mode_assign_inline_sizes(shared_context, inline_start_content_edge, inline_end_content_edge, content_inline_size) @@ -469,7 +469,7 @@ impl Flow for FlexFlow { Mode::Block => { self.available_main_size = available_block_size; self.available_cross_size = available_inline_size; - self.block_mode_assign_inline_sizes(layout_context, + self.block_mode_assign_inline_sizes(shared_context, inline_start_content_edge, inline_end_content_edge, content_inline_size) diff --git a/components/layout/flow.rs b/components/layout/flow.rs index 64a7c0709ed..73277288e3b 100644 --- a/components/layout/flow.rs +++ b/components/layout/flow.rs @@ -194,7 +194,7 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static { } /// Pass 2 of reflow: computes inline-size. - fn assign_inline_sizes(&mut self, _ctx: &LayoutContext) { + fn assign_inline_sizes(&mut self, _shared_context: &SharedStyleContext) { panic!("assign_inline_sizes not yet implemented") } diff --git a/components/layout/inline.rs b/components/layout/inline.rs index d2fa2cc84f4..af1f6c878cd 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -36,6 +36,7 @@ use style::computed_values::{text_overflow, vertical_align, white_space}; use style::context::StyleContext; use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode}; use style::properties::{ComputedValues, ServoComputedValues}; +use style::servo::SharedStyleContext; use style::values::computed::LengthOrPercentage; use text; use unicode_bidi; @@ -1349,7 +1350,7 @@ impl Flow for InlineFlow { /// Recursively (top-down) determines the actual inline-size of child contexts and fragments. /// When called on this context, the context has had its inline-size set by the parent context. - fn assign_inline_sizes(&mut self, _: &LayoutContext) { + fn assign_inline_sizes(&mut self, _: &SharedStyleContext) { let _scope = layout_debug_scope!("inline::assign_inline_sizes {:x}", self.base.debug_id()); // Initialize content fragment inline-sizes if they haven't been initialized already. diff --git a/components/layout/list_item.rs b/components/layout/list_item.rs index 0e34b324338..f32c3ec873f 100644 --- a/components/layout/list_item.rs +++ b/components/layout/list_item.rs @@ -23,9 +23,9 @@ use inline::InlineMetrics; use script_layout_interface::restyle_damage::RESOLVE_GENERATED_CONTENT; use std::sync::Arc; use style::computed_values::{list_style_type, position}; -use style::context::StyleContext; use style::logical_geometry::LogicalSize; use style::properties::{ComputedValues, ServoComputedValues}; +use style::servo::SharedStyleContext; use text; /// A block with the CSS `display` property equal to `list-item`. @@ -82,14 +82,14 @@ impl Flow for ListItemFlow { self.block_flow.bubble_inline_sizes() } - fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) { - self.block_flow.assign_inline_sizes(layout_context); + fn assign_inline_sizes(&mut self, shared_context: &SharedStyleContext) { + self.block_flow.assign_inline_sizes(shared_context); let mut marker_inline_start = self.block_flow.fragment.border_box.start.i; for marker in self.marker_fragments.iter_mut().rev() { let containing_block_inline_size = self.block_flow.base.block_container_inline_size; - let container_block_size = self.block_flow.explicit_block_containing_size(layout_context.shared_context()); + let container_block_size = self.block_flow.explicit_block_containing_size(shared_context); marker.assign_replaced_inline_size_if_necessary(containing_block_inline_size, container_block_size); // Do this now. There's no need to do this in bubble-widths, since markers do not diff --git a/components/layout/multicol.rs b/components/layout/multicol.rs index 5b35e3ab9e1..e8e974ec5a2 100644 --- a/components/layout/multicol.rs +++ b/components/layout/multicol.rs @@ -23,6 +23,7 @@ use std::sync::Arc; use style::context::StyleContext; use style::logical_geometry::LogicalSize; use style::properties::{ComputedValues, ServoComputedValues}; +use style::servo::SharedStyleContext; use style::values::computed::{LengthOrPercentageOrAuto, LengthOrPercentageOrNone}; use util::print_tree::PrintTree; @@ -77,9 +78,9 @@ impl Flow for MulticolFlow { self.block_flow.bubble_inline_sizes(); } - fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) { + fn assign_inline_sizes(&mut self, shared_context: &SharedStyleContext) { debug!("assign_inline_sizes({}): assigning inline_size for flow", "multicol"); - self.block_flow.compute_inline_sizes(layout_context.shared_context()); + self.block_flow.compute_inline_sizes(shared_context); // Move in from the inline-start border edge. let inline_start_content_edge = self.block_flow.fragment.border_box.start.i + @@ -90,7 +91,7 @@ impl Flow for MulticolFlow { self.block_flow.fragment.margin.inline_end + self.block_flow.fragment.border_padding.inline_end; - self.block_flow.assign_inline_sizes(layout_context); + self.block_flow.assign_inline_sizes(shared_context); let padding_and_borders = self.block_flow.fragment.border_padding.inline_start_end(); let content_inline_size = self.block_flow.fragment.border_box.size.inline - padding_and_borders; @@ -119,7 +120,7 @@ impl Flow for MulticolFlow { self.block_flow.fragment.border_box.size.inline = content_inline_size + padding_and_borders; self.block_flow.propagate_assigned_inline_size_to_children( - layout_context.shared_context(), inline_start_content_edge, inline_end_content_edge, column_width, + shared_context, inline_start_content_edge, inline_end_content_edge, column_width, |_, _, _, _, _, _| {}); } @@ -237,9 +238,9 @@ impl Flow for MulticolColumnFlow { self.block_flow.bubble_inline_sizes(); } - fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) { + fn assign_inline_sizes(&mut self, shared_context: &SharedStyleContext) { debug!("assign_inline_sizes({}): assigning inline_size for flow", "multicol column"); - self.block_flow.assign_inline_sizes(layout_context); + self.block_flow.assign_inline_sizes(shared_context); } fn assign_block_size<'a>(&mut self, ctx: &'a LayoutContext<'a>) { diff --git a/components/layout/table.rs b/components/layout/table.rs index fa91db53c36..0299d9b9b01 100644 --- a/components/layout/table.rs +++ b/components/layout/table.rs @@ -25,7 +25,6 @@ use std::cmp; use std::fmt; use std::sync::Arc; use style::computed_values::{border_collapse, border_spacing, table_layout}; -use style::context::StyleContext; use style::logical_geometry::LogicalSize; use style::properties::{ComputedValues, ServoComputedValues}; use style::servo::SharedStyleContext; @@ -326,7 +325,7 @@ impl Flow for TableFlow { /// Recursively (top-down) determines the actual inline-size of child contexts and fragments. /// When called on this context, the context has had its inline-size set by the parent context. - fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) { + fn assign_inline_sizes(&mut self, shared_context: &SharedStyleContext) { let _scope = layout_debug_scope!("table::assign_inline_sizes {:x}", self.block_flow.base.debug_id()); debug!("assign_inline_sizes({}): assigning inline_size for flow", "table"); @@ -349,7 +348,7 @@ impl Flow for TableFlow { border_collapse: self.block_flow.fragment.style.get_inheritedtable().border_collapse, }; inline_size_computer.compute_used_inline_size(&mut self.block_flow, - layout_context.shared_context(), + shared_context, containing_block_inline_size); let inline_start_content_edge = self.block_flow.fragment.border_padding.inline_start; @@ -400,7 +399,7 @@ impl Flow for TableFlow { &self.collapsed_inline_direction_border_widths_for_table; let mut collapsed_block_direction_border_widths_for_table = self.collapsed_block_direction_border_widths_for_table.iter().peekable(); - self.block_flow.propagate_assigned_inline_size_to_children(layout_context.shared_context(), + self.block_flow.propagate_assigned_inline_size_to_children(shared_context, inline_start_content_edge, inline_end_content_edge, content_inline_size, diff --git a/components/layout/table_caption.rs b/components/layout/table_caption.rs index 1c24491d06d..ad7c43d3f99 100644 --- a/components/layout/table_caption.rs +++ b/components/layout/table_caption.rs @@ -19,6 +19,7 @@ use std::fmt; use std::sync::Arc; use style::logical_geometry::LogicalSize; use style::properties::ServoComputedValues; +use style::servo::SharedStyleContext; use util::print_tree::PrintTree; /// A table formatting context. @@ -55,9 +56,9 @@ impl Flow for TableCaptionFlow { self.block_flow.bubble_inline_sizes(); } - fn assign_inline_sizes(&mut self, ctx: &LayoutContext) { + fn assign_inline_sizes(&mut self, shared_context: &SharedStyleContext) { debug!("assign_inline_sizes({}): assigning inline_size for flow", "table_caption"); - self.block_flow.assign_inline_sizes(ctx); + self.block_flow.assign_inline_sizes(shared_context); } fn assign_block_size<'a>(&mut self, layout_context: &'a LayoutContext<'a>) { diff --git a/components/layout/table_cell.rs b/components/layout/table_cell.rs index 833a044951c..8b6db89ff38 100644 --- a/components/layout/table_cell.rs +++ b/components/layout/table_cell.rs @@ -23,9 +23,9 @@ use script_layout_interface::wrapper_traits::ThreadSafeLayoutNode; use std::fmt; use std::sync::Arc; use style::computed_values::{border_collapse, border_top_style, vertical_align}; -use style::context::StyleContext; use style::logical_geometry::{LogicalMargin, LogicalRect, LogicalSize, WritingMode}; use style::properties::{ComputedValues, ServoComputedValues}; +use style::servo::SharedStyleContext; use table::InternalTable; use table_row::{CollapsedBorder, CollapsedBorderProvenance}; use util::print_tree::PrintTree; @@ -163,7 +163,7 @@ impl Flow for TableCellFlow { /// Recursively (top-down) determines the actual inline-size of child contexts and fragments. /// When called on this context, the context has had its inline-size set by the parent table /// row. - fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) { + fn assign_inline_sizes(&mut self, shared_context: &SharedStyleContext) { let _scope = layout_debug_scope!("table_cell::assign_inline_sizes {:x}", self.block_flow.base.debug_id()); debug!("assign_inline_sizes({}): assigning inline_size for flow", "table_cell"); @@ -175,7 +175,7 @@ impl Flow for TableCellFlow { border_collapse: self.block_flow.fragment.style.get_inheritedtable().border_collapse, }; inline_size_computer.compute_used_inline_size(&mut self.block_flow, - layout_context.shared_context(), + shared_context, containing_block_inline_size); let inline_start_content_edge = @@ -189,7 +189,7 @@ impl Flow for TableCellFlow { let content_inline_size = self.block_flow.fragment.border_box.size.inline - padding_and_borders; - self.block_flow.propagate_assigned_inline_size_to_children(layout_context.shared_context(), + self.block_flow.propagate_assigned_inline_size_to_children(shared_context, inline_start_content_edge, inline_end_content_edge, content_inline_size, diff --git a/components/layout/table_colgroup.rs b/components/layout/table_colgroup.rs index 6dce7bd56d1..f1041e24107 100644 --- a/components/layout/table_colgroup.rs +++ b/components/layout/table_colgroup.rs @@ -20,6 +20,7 @@ use std::fmt; use std::sync::Arc; use style::logical_geometry::LogicalSize; use style::properties::ServoComputedValues; +use style::servo::SharedStyleContext; use style::values::computed::LengthOrPercentageOrAuto; /// A table formatting context. @@ -81,7 +82,7 @@ impl Flow for TableColGroupFlow { /// Table column inline-sizes are assigned in the table flow and propagated to table row flows /// and/or rowgroup flows. Therefore, table colgroup flows do not need to assign inline-sizes. - fn assign_inline_sizes(&mut self, _: &LayoutContext) { + fn assign_inline_sizes(&mut self, _: &SharedStyleContext) { } /// Table columns do not have block-size. diff --git a/components/layout/table_row.rs b/components/layout/table_row.rs index 1398b3ec91d..b8835d493ef 100644 --- a/components/layout/table_row.rs +++ b/components/layout/table_row.rs @@ -25,9 +25,9 @@ use std::fmt; use std::iter::{Enumerate, IntoIterator, Peekable}; use std::sync::Arc; use style::computed_values::{border_collapse, border_spacing, border_top_style}; -use style::context::StyleContext; use style::logical_geometry::{LogicalSize, PhysicalSide, WritingMode}; use style::properties::{ComputedValues, ServoComputedValues}; +use style::servo::SharedStyleContext; use style::values::computed::LengthOrPercentageOrAuto; use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, VecExt}; use table_cell::{CollapsedBordersForCell, TableCellFlow}; @@ -312,7 +312,7 @@ impl Flow for TableRowFlow { pref_inline_size); } - fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) { + fn assign_inline_sizes(&mut self, shared_context: &SharedStyleContext) { let _scope = layout_debug_scope!("table_row::assign_inline_sizes {:x}", self.block_flow.base.debug_id()); debug!("assign_inline_sizes({}): assigning inline_size for flow", "table_row"); @@ -328,7 +328,7 @@ impl Flow for TableRowFlow { border_collapse: self.block_flow.fragment.style.get_inheritedtable().border_collapse, }; inline_size_computer.compute_used_inline_size(&mut self.block_flow, - layout_context.shared_context(), + shared_context, containing_block_inline_size); // Spread out the completed inline sizes among columns with spans > 1. @@ -381,7 +381,7 @@ impl Flow for TableRowFlow { let spacing = self.spacing; let row_writing_mode = self.block_flow.base.writing_mode; let table_writing_mode = self.table_writing_mode; - self.block_flow.propagate_assigned_inline_size_to_children(layout_context.shared_context(), + self.block_flow.propagate_assigned_inline_size_to_children(shared_context, inline_start_content_edge, inline_end_content_edge, containing_block_inline_size, diff --git a/components/layout/table_rowgroup.rs b/components/layout/table_rowgroup.rs index f03103ba87c..91dcb0f00a2 100644 --- a/components/layout/table_rowgroup.rs +++ b/components/layout/table_rowgroup.rs @@ -21,9 +21,9 @@ use std::fmt; use std::iter::{IntoIterator, Iterator, Peekable}; use std::sync::Arc; use style::computed_values::{border_collapse, border_spacing}; -use style::context::StyleContext; use style::logical_geometry::{LogicalSize, WritingMode}; use style::properties::{ComputedValues, ServoComputedValues}; +use style::servo::SharedStyleContext; use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, TableLikeFlow}; use table_row; use util::print_tree::PrintTree; @@ -140,7 +140,7 @@ impl Flow for TableRowGroupFlow { /// Recursively (top-down) determines the actual inline-size of child contexts and fragments. /// When called on this context, the context has had its inline-size set by the parent context. - fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) { + fn assign_inline_sizes(&mut self, shared_context: &SharedStyleContext) { let _scope = layout_debug_scope!("table_rowgroup::assign_inline_sizes {:x}", self.block_flow.base.debug_id()); debug!("assign_inline_sizes({}): assigning inline_size for flow", "table_rowgroup"); @@ -155,7 +155,7 @@ impl Flow for TableRowGroupFlow { border_collapse: border_collapse, }; inline_size_computer.compute_used_inline_size(&mut self.block_flow, - layout_context.shared_context(), + shared_context, containing_block_inline_size); let column_computed_inline_sizes = &self.column_computed_inline_sizes; @@ -165,7 +165,7 @@ impl Flow for TableRowGroupFlow { &self.collapsed_inline_direction_border_widths_for_table; let mut collapsed_block_direction_border_widths_for_table = self.collapsed_block_direction_border_widths_for_table.iter().peekable(); - self.block_flow.propagate_assigned_inline_size_to_children(layout_context.shared_context(), + self.block_flow.propagate_assigned_inline_size_to_children(shared_context, inline_start_content_edge, inline_end_content_edge, content_inline_size, diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs index a3fab380ae0..c331cd9ee2a 100644 --- a/components/layout/table_wrapper.rs +++ b/components/layout/table_wrapper.rs @@ -30,7 +30,6 @@ use std::fmt; use std::ops::Add; use std::sync::Arc; use style::computed_values::{border_collapse, table_layout}; -use style::context::StyleContext; use style::logical_geometry::LogicalSize; use style::properties::{ComputedValues, ServoComputedValues}; use style::servo::SharedStyleContext; @@ -321,7 +320,7 @@ impl Flow for TableWrapperFlow { self.block_flow.bubble_inline_sizes(); } - fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) { + fn assign_inline_sizes(&mut self, shared_context: &SharedStyleContext) { debug!("assign_inline_sizes({}): assigning inline_size for flow", if self.block_flow.base.flags.is_float() { "floated table_wrapper" @@ -346,7 +345,7 @@ impl Flow for TableWrapperFlow { containing_block_inline_size; } - self.compute_used_inline_size(layout_context.shared_context(), + self.compute_used_inline_size(shared_context, containing_block_inline_size, &intermediate_column_inline_sizes); @@ -376,7 +375,7 @@ impl Flow for TableWrapperFlow { match assigned_column_inline_sizes { None => { self.block_flow - .propagate_assigned_inline_size_to_children(layout_context.shared_context(), + .propagate_assigned_inline_size_to_children(shared_context, inline_start_content_edge, inline_end_content_edge, content_inline_size, @@ -384,7 +383,7 @@ impl Flow for TableWrapperFlow { } Some(ref assigned_column_inline_sizes) => { self.block_flow - .propagate_assigned_inline_size_to_children(layout_context.shared_context(), + .propagate_assigned_inline_size_to_children(shared_context, inline_start_content_edge, inline_end_content_edge, content_inline_size, diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs index 0571f903ea4..bae8ecc355f 100644 --- a/components/layout/traversal.rs +++ b/components/layout/traversal.rs @@ -174,7 +174,7 @@ pub struct AssignISizes<'a> { impl<'a> PreorderFlowTraversal for AssignISizes<'a> { #[inline] fn process(&self, flow: &mut Flow) { - flow.assign_inline_sizes(self.layout_context); + flow.assign_inline_sizes(self.layout_context.shared_context()); } #[inline]