From e6435b7ec43f42cc3a756b94cd64e3a2ee914e1d Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 20 Jun 2016 10:45:21 +0200 Subject: [PATCH 01/14] Pass SharedStyleContext to adjust_fragments_for_collapsed_margins_if_root. --- components/layout/block.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/components/layout/block.rs b/components/layout/block.rs index 94b7cc43b2c..059cfe1c00a 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -58,6 +58,7 @@ use style::computed_values::{position, text_align, transform, transform_style}; use style::context::StyleContext; use style::logical_geometry::{LogicalPoint, LogicalRect, LogicalSize, WritingMode}; use style::properties::{ComputedValues, ServoComputedValues}; +use style::servo::SharedStyleContext; use style::values::computed::{LengthOrNone, LengthOrPercentageOrNone}; use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto}; use util::geometry::MAX_RECT; @@ -696,8 +697,8 @@ impl BlockFlow { /// /// TODO(#2017, pcwalton): This is somewhat inefficient (traverses kids twice); can we do /// better? - fn adjust_fragments_for_collapsed_margins_if_root<'a>(&mut self, - layout_context: &'a LayoutContext<'a>) { + fn adjust_fragments_for_collapsed_margins_if_root(&mut self, + shared_context: &SharedStyleContext) { if !self.is_root() { return } @@ -727,7 +728,7 @@ impl BlockFlow { // infrastructure to make it scrollable. let viewport_size = LogicalSize::from_physical(self.fragment.style.writing_mode, - layout_context.shared_context().viewport_size); + shared_context.viewport_size); let block_size = max(viewport_size.block, self.fragment.border_box.size.block + block_start_margin_value + block_end_margin_value); @@ -1030,7 +1031,7 @@ impl BlockFlow { self.fragment.inline_start_offset(), Au(0))); self.base.floats = floats.clone(); - self.adjust_fragments_for_collapsed_margins_if_root(layout_context); + self.adjust_fragments_for_collapsed_margins_if_root(layout_context.shared_context()); } else { // We don't need to reflow, but we still need to perform in-order traversals if // necessary. From e142b78850efc4df06c23014a9515cb742e47e1e Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 20 Jun 2016 10:46:45 +0200 Subject: [PATCH 02/14] Pass SharedStyleContext to calculate_absolute_block_size_and_margins. --- components/layout/block.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/layout/block.rs b/components/layout/block.rs index 059cfe1c00a..4a7b4ac149b 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -475,7 +475,7 @@ impl<'a> PreorderFlowTraversal for AbsoluteAssignBSizesTraversal<'a> { return } - block.calculate_absolute_block_size_and_margins(&self.0); + block.calculate_absolute_block_size_and_margins(self.0.shared_context()); } } @@ -1202,10 +1202,10 @@ impl BlockFlow { } } - fn calculate_absolute_block_size_and_margins(&mut self, layout_context: &LayoutContext) { + fn calculate_absolute_block_size_and_margins(&mut self, shared_context: &SharedStyleContext) { let opaque_self = OpaqueFlow::from_flow(self); let containing_block_block_size = - self.containing_block_size(&layout_context.shared_context().viewport_size, opaque_self).block; + self.containing_block_size(&shared_context.viewport_size, opaque_self).block; // This is the stored content block-size value from assign-block-size let content_block_size = self.fragment.border_box.size.block; From 6f4b8f2505e28a1c79c5c53e52e27b5bb94de28f Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 20 Jun 2016 10:57:28 +0200 Subject: [PATCH 03/14] Store SharedStyleContext in AbsoluteAssignBSizesTraversal. --- components/layout/block.rs | 6 +++--- components/layout/inline.rs | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/components/layout/block.rs b/components/layout/block.rs index 4a7b4ac149b..16ef0c28c53 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -452,7 +452,7 @@ fn translate_including_floats(cur_b: &mut Au, delta: Au, floats: &mut Floats) { /// /// Note that flows with position 'fixed' just form a flat list as they all /// have the Root flow as their CB. -pub struct AbsoluteAssignBSizesTraversal<'a>(pub &'a LayoutContext<'a>); +pub struct AbsoluteAssignBSizesTraversal<'a>(pub &'a SharedStyleContext); impl<'a> PreorderFlowTraversal for AbsoluteAssignBSizesTraversal<'a> { #[inline] @@ -475,7 +475,7 @@ impl<'a> PreorderFlowTraversal for AbsoluteAssignBSizesTraversal<'a> { return } - block.calculate_absolute_block_size_and_margins(self.0.shared_context()); + block.calculate_absolute_block_size_and_margins(self.0); } } @@ -1046,7 +1046,7 @@ impl BlockFlow { // This is preorder because the block-size of an absolute flow may depend on // the block-size of its containing block, which may also be an absolute flow. (&mut *self as &mut Flow).traverse_preorder_absolute_flows( - &mut AbsoluteAssignBSizesTraversal(layout_context)); + &mut AbsoluteAssignBSizesTraversal(layout_context.shared_context())); } // Don't remove the dirty bits yet if we're absolutely-positioned, since our final size diff --git a/components/layout/inline.rs b/components/layout/inline.rs index ab2054a00ac..d2fa2cc84f4 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -33,6 +33,7 @@ use std::sync::Arc; use std::{fmt, i32, isize, mem}; use style::computed_values::{display, overflow_x, position, text_align, text_justify}; 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::values::computed::LengthOrPercentage; @@ -1466,7 +1467,7 @@ impl Flow for InlineFlow { // This is preorder because the block-size of an absolute flow may depend on // the block-size of its containing block, which may also be an absolute flow. (&mut *self as &mut Flow).traverse_preorder_absolute_flows( - &mut AbsoluteAssignBSizesTraversal(layout_context)); + &mut AbsoluteAssignBSizesTraversal(layout_context.shared_context())); } self.base.position.size.block = match self.lines.last() { From f20ea08a1bc2cd390a716f5c565377028e2d5be2 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 20 Jun 2016 19:30:18 +0200 Subject: [PATCH 04/14] Pass SharedStyleContext to explicit_block_containing_size. --- components/layout/block.rs | 16 ++++++++-------- components/layout/flow.rs | 5 +++-- components/layout/list_item.rs | 3 ++- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/components/layout/block.rs b/components/layout/block.rs index 16ef0c28c53..a96ad64e437 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -1136,14 +1136,14 @@ impl BlockFlow { self.base.position.size); } - pub fn explicit_block_containing_size(&self, layout_context: &LayoutContext) -> Option { + pub fn explicit_block_containing_size(&self, shared_context: &SharedStyleContext) -> Option { if self.is_root() || self.is_fixed() { let viewport_size = LogicalSize::from_physical(self.fragment.style.writing_mode, - layout_context.shared_context().viewport_size); + shared_context.viewport_size); Some(viewport_size.block) } else if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) && self.base.block_container_explicit_block_size.is_none() { - self.base.absolute_cb.explicit_block_containing_size(layout_context) + self.base.absolute_cb.explicit_block_containing_size(shared_context) } else { self.base.block_container_explicit_block_size } @@ -1331,7 +1331,7 @@ impl BlockFlow { box_sizing::T::border_box => self.fragment.border_padding.block_start_end(), box_sizing::T::content_box => Au(0), }; - let parent_container_size = self.explicit_block_containing_size(layout_context); + let parent_container_size = self.explicit_block_containing_size(layout_context.shared_context()); // https://drafts.csswg.org/css-ui-3/#box-sizing let explicit_content_size = self .explicit_block_size(parent_container_size) @@ -2844,7 +2844,7 @@ impl ISizeAndMarginsComputer for AbsoluteReplaced { let opaque_block = OpaqueFlow::from_flow(block); let containing_block_inline_size = block.containing_block_size(&layout_context.shared_context().viewport_size, opaque_block).inline; - let container_block_size = block.explicit_block_containing_size(layout_context); + let container_block_size = block.explicit_block_containing_size(layout_context.shared_context()); let fragment = block.fragment(); fragment.assign_replaced_inline_size_if_necessary(containing_block_inline_size, container_block_size); // For replaced absolute flow, the rest of the constraint solving will @@ -2903,7 +2903,7 @@ impl ISizeAndMarginsComputer for BlockReplaced { parent_flow_inline_size: Au, layout_context: &LayoutContext) -> MaybeAuto { - let container_block_size = block.explicit_block_containing_size(layout_context); + let container_block_size = block.explicit_block_containing_size(layout_context.shared_context()); let fragment = block.fragment(); fragment.assign_replaced_inline_size_if_necessary(parent_flow_inline_size, container_block_size); // For replaced block flow, the rest of the constraint solving will @@ -2961,7 +2961,7 @@ impl ISizeAndMarginsComputer for FloatReplaced { parent_flow_inline_size: Au, layout_context: &LayoutContext) -> MaybeAuto { - let container_block_size = block.explicit_block_containing_size(layout_context); + let container_block_size = block.explicit_block_containing_size(layout_context.shared_context()); let fragment = block.fragment(); fragment.assign_replaced_inline_size_if_necessary(parent_flow_inline_size, container_block_size); // For replaced block flow, the rest of the constraint solving will @@ -3049,7 +3049,7 @@ impl ISizeAndMarginsComputer for InlineBlockReplaced { parent_flow_inline_size: Au, layout_context: &LayoutContext) -> MaybeAuto { - let container_block_size = block.explicit_block_containing_size(layout_context); + let container_block_size = block.explicit_block_containing_size(layout_context.shared_context()); let fragment = block.fragment(); fragment.assign_replaced_inline_size_if_necessary(parent_flow_inline_size, container_block_size); // For replaced block flow, the rest of the constraint solving will diff --git a/components/layout/flow.rs b/components/layout/flow.rs index 3dc7fac29dc..64a7c0709ed 100644 --- a/components/layout/flow.rs +++ b/components/layout/flow.rs @@ -52,6 +52,7 @@ use style::computed_values::{clear, display, empty_cells, float, position, overf use style::dom::TRestyleDamage; use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode}; use style::properties::{self, ComputedValues, ServoComputedValues}; +use style::servo::SharedStyleContext; use style::values::computed::LengthOrPercentageOrAuto; use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, TableFlow}; use table_caption::TableCaptionFlow; @@ -1560,7 +1561,7 @@ impl ContainingBlockLink { } #[inline] - pub fn explicit_block_containing_size(&self, layout_context: &LayoutContext) -> Option { + pub fn explicit_block_containing_size(&self, shared_context: &SharedStyleContext) -> Option { match self.link { None => { panic!("Link to containing block not established; perhaps you forgot to call \ @@ -1569,7 +1570,7 @@ impl ContainingBlockLink { Some(ref link) => { let flow = link.upgrade().unwrap(); if flow.is_block_like() { - flow.as_block().explicit_block_containing_size(layout_context) + flow.as_block().explicit_block_containing_size(shared_context) } else if flow.is_inline_flow() { Some(flow.as_inline().minimum_block_size_above_baseline) } else { diff --git a/components/layout/list_item.rs b/components/layout/list_item.rs index be0620b817d..0e34b324338 100644 --- a/components/layout/list_item.rs +++ b/components/layout/list_item.rs @@ -23,6 +23,7 @@ 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 text; @@ -88,7 +89,7 @@ impl Flow for ListItemFlow { 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); + let container_block_size = self.block_flow.explicit_block_containing_size(layout_context.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 From 2a1e2f491a61e9b164df6b1c5f84208f520e907d Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 20 Jun 2016 19:37:32 +0200 Subject: [PATCH 05/14] Pass SharedStyleContext to containing_block_inline_size. --- components/layout/block.rs | 16 ++++++++-------- components/layout/table_wrapper.rs | 12 +++++++----- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/components/layout/block.rs b/components/layout/block.rs index a96ad64e437..d5b588909c1 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -2279,7 +2279,7 @@ pub trait ISizeAndMarginsComputer { layout_context: &LayoutContext) -> ISizeConstraintInput { let containing_block_inline_size = - self.containing_block_inline_size(block, parent_flow_inline_size, layout_context); + self.containing_block_inline_size(block, parent_flow_inline_size, layout_context.shared_context()); block.fragment.compute_block_direction_margins(containing_block_inline_size); block.fragment.compute_inline_direction_margins(containing_block_inline_size); @@ -2387,13 +2387,13 @@ pub trait ISizeAndMarginsComputer { MaybeAuto::from_style(block.fragment().style().content_inline_size(), self.containing_block_inline_size(block, parent_flow_inline_size, - layout_context)) + layout_context.shared_context())) } fn containing_block_inline_size(&self, _: &mut BlockFlow, parent_flow_inline_size: Au, - _: &LayoutContext) + _: &SharedStyleContext) -> Au { parent_flow_inline_size } @@ -2410,7 +2410,7 @@ pub trait ISizeAndMarginsComputer { layout_context); let containing_block_inline_size = - self.containing_block_inline_size(block, parent_flow_inline_size, layout_context); + self.containing_block_inline_size(block, parent_flow_inline_size, layout_context.shared_context()); let mut solution = self.solve_inline_size_constraints(block, &input); @@ -2728,10 +2728,10 @@ impl ISizeAndMarginsComputer for AbsoluteNonReplaced { fn containing_block_inline_size(&self, block: &mut BlockFlow, _: Au, - layout_context: &LayoutContext) + shared_context: &SharedStyleContext) -> Au { let opaque_block = OpaqueFlow::from_flow(block); - block.containing_block_size(&layout_context.shared_context().viewport_size, opaque_block).inline + block.containing_block_size(&shared_context.viewport_size, opaque_block).inline } fn set_inline_position_of_flow_if_necessary(&self, @@ -2855,10 +2855,10 @@ impl ISizeAndMarginsComputer for AbsoluteReplaced { fn containing_block_inline_size(&self, block: &mut BlockFlow, _: Au, - layout_context: &LayoutContext) + shared_context: &SharedStyleContext) -> Au { let opaque_block = OpaqueFlow::from_flow(block); - block.containing_block_size(&layout_context.shared_context().viewport_size, opaque_block).inline + block.containing_block_size(&shared_context.viewport_size, opaque_block).inline } fn set_inline_position_of_flow_if_necessary(&self, diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs index 8a7d47562f4..eb3cdcadd47 100644 --- a/components/layout/table_wrapper.rs +++ b/components/layout/table_wrapper.rs @@ -30,8 +30,10 @@ 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; use style::values::CSSFloat; use style::values::computed::LengthOrPercentageOrAuto; use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize}; @@ -772,7 +774,7 @@ impl ISizeAndMarginsComputer for Table { let containing_block_inline_size = self.containing_block_inline_size(block, parent_flow_inline_size, - layout_context); + layout_context.shared_context()); initial_computed_inline_size(block, containing_block_inline_size, self.minimum_width_of_all_columns, @@ -807,7 +809,7 @@ impl ISizeAndMarginsComputer for FloatedTable { let containing_block_inline_size = self.containing_block_inline_size(block, parent_flow_inline_size, - layout_context); + layout_context.shared_context()); initial_computed_inline_size(block, containing_block_inline_size, self.minimum_width_of_all_columns, @@ -842,7 +844,7 @@ impl ISizeAndMarginsComputer for AbsoluteTable { let containing_block_inline_size = self.containing_block_inline_size(block, parent_flow_inline_size, - layout_context); + layout_context.shared_context()); initial_computed_inline_size(block, containing_block_inline_size, self.minimum_width_of_all_columns, @@ -852,9 +854,9 @@ impl ISizeAndMarginsComputer for AbsoluteTable { fn containing_block_inline_size(&self, block: &mut BlockFlow, parent_flow_inline_size: Au, - layout_context: &LayoutContext) + shared_context: &SharedStyleContext) -> Au { - AbsoluteNonReplaced.containing_block_inline_size(block, parent_flow_inline_size, layout_context) + AbsoluteNonReplaced.containing_block_inline_size(block, parent_flow_inline_size, shared_context) } fn solve_inline_size_constraints(&self, From 5c12755fa6f95c787e2f67eae8600c95af710171 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 20 Jun 2016 19:43:14 +0200 Subject: [PATCH 06/14] Pass SharedStyleContext to initial_computed_inline_size. --- components/layout/block.rs | 24 ++++++++++++------------ components/layout/table_wrapper.rs | 13 ++++++------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/components/layout/block.rs b/components/layout/block.rs index d5b588909c1..b89b6a3d8a9 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -2287,7 +2287,7 @@ pub trait ISizeAndMarginsComputer { let mut computed_inline_size = self.initial_computed_inline_size(block, parent_flow_inline_size, - layout_context); + layout_context.shared_context()); let style = block.fragment.style(); match (computed_inline_size, style.get_position().box_sizing) { (MaybeAuto::Specified(size), box_sizing::T::border_box) => { @@ -2382,12 +2382,12 @@ pub trait ISizeAndMarginsComputer { fn initial_computed_inline_size(&self, block: &mut BlockFlow, parent_flow_inline_size: Au, - layout_context: &LayoutContext) + shared_context: &SharedStyleContext) -> MaybeAuto { MaybeAuto::from_style(block.fragment().style().content_inline_size(), self.containing_block_inline_size(block, parent_flow_inline_size, - layout_context.shared_context())) + shared_context)) } fn containing_block_inline_size(&self, @@ -2839,12 +2839,12 @@ impl ISizeAndMarginsComputer for AbsoluteReplaced { fn initial_computed_inline_size(&self, block: &mut BlockFlow, _: Au, - layout_context: &LayoutContext) + shared_context: &SharedStyleContext) -> MaybeAuto { let opaque_block = OpaqueFlow::from_flow(block); let containing_block_inline_size = - block.containing_block_size(&layout_context.shared_context().viewport_size, opaque_block).inline; - let container_block_size = block.explicit_block_containing_size(layout_context.shared_context()); + block.containing_block_size(&shared_context.viewport_size, opaque_block).inline; + let container_block_size = block.explicit_block_containing_size(shared_context); let fragment = block.fragment(); fragment.assign_replaced_inline_size_if_necessary(containing_block_inline_size, container_block_size); // For replaced absolute flow, the rest of the constraint solving will @@ -2901,9 +2901,9 @@ impl ISizeAndMarginsComputer for BlockReplaced { fn initial_computed_inline_size(&self, block: &mut BlockFlow, parent_flow_inline_size: Au, - layout_context: &LayoutContext) + shared_context: &SharedStyleContext) -> MaybeAuto { - let container_block_size = block.explicit_block_containing_size(layout_context.shared_context()); + let container_block_size = block.explicit_block_containing_size(shared_context); let fragment = block.fragment(); fragment.assign_replaced_inline_size_if_necessary(parent_flow_inline_size, container_block_size); // For replaced block flow, the rest of the constraint solving will @@ -2959,9 +2959,9 @@ impl ISizeAndMarginsComputer for FloatReplaced { fn initial_computed_inline_size(&self, block: &mut BlockFlow, parent_flow_inline_size: Au, - layout_context: &LayoutContext) + shared_context: &SharedStyleContext) -> MaybeAuto { - let container_block_size = block.explicit_block_containing_size(layout_context.shared_context()); + let container_block_size = block.explicit_block_containing_size(shared_context); let fragment = block.fragment(); fragment.assign_replaced_inline_size_if_necessary(parent_flow_inline_size, container_block_size); // For replaced block flow, the rest of the constraint solving will @@ -3047,9 +3047,9 @@ impl ISizeAndMarginsComputer for InlineBlockReplaced { fn initial_computed_inline_size(&self, block: &mut BlockFlow, parent_flow_inline_size: Au, - layout_context: &LayoutContext) + shared_context: &SharedStyleContext) -> MaybeAuto { - let container_block_size = block.explicit_block_containing_size(layout_context.shared_context()); + let container_block_size = block.explicit_block_containing_size(shared_context); let fragment = block.fragment(); fragment.assign_replaced_inline_size_if_necessary(parent_flow_inline_size, container_block_size); // For replaced block flow, the rest of the constraint solving will diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs index eb3cdcadd47..3b1f63dfd2a 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; @@ -769,12 +768,12 @@ impl ISizeAndMarginsComputer for Table { fn initial_computed_inline_size(&self, block: &mut BlockFlow, parent_flow_inline_size: Au, - layout_context: &LayoutContext) + shared_context: &SharedStyleContext) -> MaybeAuto { let containing_block_inline_size = self.containing_block_inline_size(block, parent_flow_inline_size, - layout_context.shared_context()); + shared_context); initial_computed_inline_size(block, containing_block_inline_size, self.minimum_width_of_all_columns, @@ -804,12 +803,12 @@ impl ISizeAndMarginsComputer for FloatedTable { fn initial_computed_inline_size(&self, block: &mut BlockFlow, parent_flow_inline_size: Au, - layout_context: &LayoutContext) + shared_context: &SharedStyleContext) -> MaybeAuto { let containing_block_inline_size = self.containing_block_inline_size(block, parent_flow_inline_size, - layout_context.shared_context()); + shared_context); initial_computed_inline_size(block, containing_block_inline_size, self.minimum_width_of_all_columns, @@ -839,12 +838,12 @@ impl ISizeAndMarginsComputer for AbsoluteTable { fn initial_computed_inline_size(&self, block: &mut BlockFlow, parent_flow_inline_size: Au, - layout_context: &LayoutContext) + shared_context: &SharedStyleContext) -> MaybeAuto { let containing_block_inline_size = self.containing_block_inline_size(block, parent_flow_inline_size, - layout_context.shared_context()); + shared_context); initial_computed_inline_size(block, containing_block_inline_size, self.minimum_width_of_all_columns, From 018bebe90dc527b796c3ab66993aad522dc0c14a Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 20 Jun 2016 19:48:05 +0200 Subject: [PATCH 07/14] Pass SharedStyleContext to compute_inline_size_constraint_inputs. --- components/layout/block.rs | 8 ++++---- components/layout/table.rs | 3 ++- components/layout/table_wrapper.rs | 7 ++++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/components/layout/block.rs b/components/layout/block.rs index b89b6a3d8a9..60971496b3d 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -2276,10 +2276,10 @@ pub trait ISizeAndMarginsComputer { fn compute_inline_size_constraint_inputs(&self, block: &mut BlockFlow, parent_flow_inline_size: Au, - layout_context: &LayoutContext) + shared_context: &SharedStyleContext) -> ISizeConstraintInput { let containing_block_inline_size = - self.containing_block_inline_size(block, parent_flow_inline_size, layout_context.shared_context()); + self.containing_block_inline_size(block, parent_flow_inline_size, shared_context); block.fragment.compute_block_direction_margins(containing_block_inline_size); block.fragment.compute_inline_direction_margins(containing_block_inline_size); @@ -2287,7 +2287,7 @@ pub trait ISizeAndMarginsComputer { let mut computed_inline_size = self.initial_computed_inline_size(block, parent_flow_inline_size, - layout_context.shared_context()); + shared_context); let style = block.fragment.style(); match (computed_inline_size, style.get_position().box_sizing) { (MaybeAuto::Specified(size), box_sizing::T::border_box) => { @@ -2407,7 +2407,7 @@ pub trait ISizeAndMarginsComputer { parent_flow_inline_size: Au) { let mut input = self.compute_inline_size_constraint_inputs(block, parent_flow_inline_size, - layout_context); + layout_context.shared_context()); let containing_block_inline_size = self.containing_block_inline_size(block, parent_flow_inline_size, layout_context.shared_context()); diff --git a/components/layout/table.rs b/components/layout/table.rs index 2f91ea6774d..ff9048201a7 100644 --- a/components/layout/table.rs +++ b/components/layout/table.rs @@ -25,6 +25,7 @@ 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::values::CSSFloat; @@ -521,7 +522,7 @@ impl ISizeAndMarginsComputer for InternalTable { parent_flow_inline_size: Au) { let mut input = self.compute_inline_size_constraint_inputs(block, parent_flow_inline_size, - layout_context); + layout_context.shared_context()); // Tables are always at least as wide as their minimum inline size. let minimum_inline_size = diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs index 3b1f63dfd2a..8002b97f9bf 100644 --- a/components/layout/table_wrapper.rs +++ b/components/layout/table_wrapper.rs @@ -30,6 +30,7 @@ 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; @@ -234,7 +235,7 @@ impl TableWrapperFlow { let input = inline_size_computer.compute_inline_size_constraint_inputs(&mut self.block_flow, parent_flow_inline_size, - layout_context); + layout_context.shared_context()); let solution = inline_size_computer.solve_inline_size_constraints(&mut self.block_flow, &input); @@ -254,7 +255,7 @@ impl TableWrapperFlow { let input = inline_size_computer.compute_inline_size_constraint_inputs(&mut self.block_flow, parent_flow_inline_size, - layout_context); + layout_context.shared_context()); let solution = inline_size_computer.solve_inline_size_constraints(&mut self.block_flow, &input); @@ -273,7 +274,7 @@ impl TableWrapperFlow { let input = inline_size_computer.compute_inline_size_constraint_inputs(&mut self.block_flow, parent_flow_inline_size, - layout_context); + layout_context.shared_context()); let solution = inline_size_computer.solve_inline_size_constraints(&mut self.block_flow, &input); From 9731a001dbe430570aaadf7c1a8fbfb2913bd4df Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 20 Jun 2016 19:55:48 +0200 Subject: [PATCH 08/14] Pass SharedStyleContext to compute_used_inline_size. --- components/layout/block.rs | 26 +++++++++++++------------- components/layout/flex.rs | 3 ++- components/layout/table.rs | 7 ++++--- components/layout/table_cell.rs | 3 ++- components/layout/table_row.rs | 3 ++- components/layout/table_rowgroup.rs | 3 ++- 6 files changed, 25 insertions(+), 20 deletions(-) diff --git a/components/layout/block.rs b/components/layout/block.rs index 60971496b3d..082c6232c3f 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -590,56 +590,56 @@ impl BlockFlow { /// Compute the actual inline size and position for this block. pub fn compute_used_inline_size(&mut self, - layout_context: &LayoutContext, + shared_context: &SharedStyleContext, containing_block_inline_size: Au) { let block_type = self.block_type(); match block_type { BlockType::AbsoluteReplaced => { let inline_size_computer = AbsoluteReplaced; inline_size_computer.compute_used_inline_size(self, - layout_context, + shared_context, containing_block_inline_size); } BlockType::AbsoluteNonReplaced => { let inline_size_computer = AbsoluteNonReplaced; inline_size_computer.compute_used_inline_size(self, - layout_context, + shared_context, containing_block_inline_size); } BlockType::FloatReplaced => { let inline_size_computer = FloatReplaced; inline_size_computer.compute_used_inline_size(self, - layout_context, + shared_context, containing_block_inline_size); } BlockType::FloatNonReplaced => { let inline_size_computer = FloatNonReplaced; inline_size_computer.compute_used_inline_size(self, - layout_context, + shared_context, containing_block_inline_size); } BlockType::InlineBlockReplaced => { let inline_size_computer = InlineBlockReplaced; inline_size_computer.compute_used_inline_size(self, - layout_context, + shared_context, containing_block_inline_size); } BlockType::InlineBlockNonReplaced => { let inline_size_computer = InlineBlockNonReplaced; inline_size_computer.compute_used_inline_size(self, - layout_context, + shared_context, containing_block_inline_size); } BlockType::Replaced => { let inline_size_computer = BlockReplaced; inline_size_computer.compute_used_inline_size(self, - layout_context, + shared_context, containing_block_inline_size); } BlockType::NonReplaced => { let inline_size_computer = BlockNonReplaced; inline_size_computer.compute_used_inline_size(self, - layout_context, + shared_context, containing_block_inline_size); } } @@ -1297,7 +1297,7 @@ impl BlockFlow { /// This is run in the `AssignISizes` traversal. fn propagate_and_compute_used_inline_size(&mut self, layout_context: &LayoutContext) { let containing_block_inline_size = self.base.block_container_inline_size; - self.compute_used_inline_size(layout_context, containing_block_inline_size); + self.compute_used_inline_size(layout_context.shared_context(), containing_block_inline_size); if self.base.flags.is_float() { self.float.as_mut().unwrap().containing_inline_size = containing_block_inline_size } @@ -2403,14 +2403,14 @@ pub trait ISizeAndMarginsComputer { /// CSS Section 10.4: Minimum and Maximum inline-sizes fn compute_used_inline_size(&self, block: &mut BlockFlow, - layout_context: &LayoutContext, + shared_context: &SharedStyleContext, parent_flow_inline_size: Au) { let mut input = self.compute_inline_size_constraint_inputs(block, parent_flow_inline_size, - layout_context.shared_context()); + shared_context); let containing_block_inline_size = - self.containing_block_inline_size(block, parent_flow_inline_size, layout_context.shared_context()); + self.containing_block_inline_size(block, parent_flow_inline_size, shared_context); let mut solution = self.solve_inline_size_constraints(block, &input); diff --git a/components/layout/flex.rs b/components/layout/flex.rs index dd279bbdfdf..200402cf42f 100644 --- a/components/layout/flex.rs +++ b/components/layout/flex.rs @@ -25,6 +25,7 @@ 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::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto, LengthOrPercentageOrNone}; @@ -413,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, containing_block_inline_size); + self.block_flow.compute_used_inline_size(layout_context.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 } diff --git a/components/layout/table.rs b/components/layout/table.rs index ff9048201a7..08fe3b395d6 100644 --- a/components/layout/table.rs +++ b/components/layout/table.rs @@ -28,6 +28,7 @@ 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; use style::values::CSSFloat; use style::values::computed::LengthOrPercentageOrAuto; use table_row::TableRowFlow; @@ -348,7 +349,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, + layout_context.shared_context(), containing_block_inline_size); let inline_start_content_edge = self.block_flow.fragment.border_padding.inline_start; @@ -518,11 +519,11 @@ impl ISizeAndMarginsComputer for InternalTable { /// CSS Section 10.4: Minimum and Maximum inline-sizes fn compute_used_inline_size(&self, block: &mut BlockFlow, - layout_context: &LayoutContext, + shared_context: &SharedStyleContext, parent_flow_inline_size: Au) { let mut input = self.compute_inline_size_constraint_inputs(block, parent_flow_inline_size, - layout_context.shared_context()); + shared_context); // Tables are always at least as wide as their minimum inline size. let minimum_inline_size = diff --git a/components/layout/table_cell.rs b/components/layout/table_cell.rs index 4f043e351c4..8e487ba97da 100644 --- a/components/layout/table_cell.rs +++ b/components/layout/table_cell.rs @@ -23,6 +23,7 @@ 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 table::InternalTable; @@ -174,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, + layout_context.shared_context(), containing_block_inline_size); let inline_start_content_edge = diff --git a/components/layout/table_row.rs b/components/layout/table_row.rs index dbeafead32e..69608513bd1 100644 --- a/components/layout/table_row.rs +++ b/components/layout/table_row.rs @@ -25,6 +25,7 @@ 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::values::computed::LengthOrPercentageOrAuto; @@ -327,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, + layout_context.shared_context(), containing_block_inline_size); // Spread out the completed inline sizes among columns with spans > 1. diff --git a/components/layout/table_rowgroup.rs b/components/layout/table_rowgroup.rs index e7e3e2fa938..a5226310993 100644 --- a/components/layout/table_rowgroup.rs +++ b/components/layout/table_rowgroup.rs @@ -21,6 +21,7 @@ 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 table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, TableLikeFlow}; @@ -154,7 +155,7 @@ impl Flow for TableRowGroupFlow { border_collapse: border_collapse, }; inline_size_computer.compute_used_inline_size(&mut self.block_flow, - layout_context, + layout_context.shared_context(), containing_block_inline_size); let column_computed_inline_sizes = &self.column_computed_inline_sizes; From 959f8c11cddfa5ec066a40904f8eafb7ad75229d Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 20 Jun 2016 19:58:32 +0200 Subject: [PATCH 09/14] Pass SharedStyleContext to TableWrapperFlow::compute_used_inline_size. --- components/layout/table_wrapper.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs index 8002b97f9bf..574d275af12 100644 --- a/components/layout/table_wrapper.rs +++ b/components/layout/table_wrapper.rs @@ -206,7 +206,7 @@ impl TableWrapperFlow { fn compute_used_inline_size( &mut self, - layout_context: &LayoutContext, + shared_context: &SharedStyleContext, parent_flow_inline_size: Au, intermediate_column_inline_sizes: &[IntermediateColumnInlineSize]) { let (border_padding, spacing) = self.border_padding_and_spacing(); @@ -235,7 +235,7 @@ impl TableWrapperFlow { let input = inline_size_computer.compute_inline_size_constraint_inputs(&mut self.block_flow, parent_flow_inline_size, - layout_context.shared_context()); + shared_context); let solution = inline_size_computer.solve_inline_size_constraints(&mut self.block_flow, &input); @@ -255,7 +255,7 @@ impl TableWrapperFlow { let input = inline_size_computer.compute_inline_size_constraint_inputs(&mut self.block_flow, parent_flow_inline_size, - layout_context.shared_context()); + shared_context); let solution = inline_size_computer.solve_inline_size_constraints(&mut self.block_flow, &input); @@ -274,7 +274,7 @@ impl TableWrapperFlow { let input = inline_size_computer.compute_inline_size_constraint_inputs(&mut self.block_flow, parent_flow_inline_size, - layout_context.shared_context()); + shared_context); let solution = inline_size_computer.solve_inline_size_constraints(&mut self.block_flow, &input); @@ -346,7 +346,7 @@ impl Flow for TableWrapperFlow { containing_block_inline_size; } - self.compute_used_inline_size(layout_context, + self.compute_used_inline_size(layout_context.shared_context(), containing_block_inline_size, &intermediate_column_inline_sizes); From 21b8d2bd91a7199399d55805f709448ca410a8b9 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Tue, 21 Jun 2016 14:06:30 +0200 Subject: [PATCH 10/14] Pass SharedStyleContext to propagate_assigned_inline_size_to_children. --- components/layout/block.rs | 8 ++++---- components/layout/multicol.rs | 2 +- components/layout/table.rs | 2 +- components/layout/table_cell.rs | 2 +- components/layout/table_row.rs | 2 +- components/layout/table_rowgroup.rs | 2 +- components/layout/table_wrapper.rs | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/components/layout/block.rs b/components/layout/block.rs index 082c6232c3f..1f9396e6596 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -1311,7 +1311,7 @@ impl BlockFlow { /// and the code for block layout is significantly simpler. #[inline(always)] pub fn propagate_assigned_inline_size_to_children(&mut self, - layout_context: &LayoutContext, + shared_context: &SharedStyleContext, inline_start_content_edge: Au, inline_end_content_edge: Au, content_inline_size: Au, @@ -1331,7 +1331,7 @@ impl BlockFlow { box_sizing::T::border_box => self.fragment.border_padding.block_start_end(), box_sizing::T::content_box => Au(0), }; - let parent_container_size = self.explicit_block_containing_size(layout_context.shared_context()); + let parent_container_size = self.explicit_block_containing_size(shared_context); // https://drafts.csswg.org/css-ui-3/#box-sizing let explicit_content_size = self .explicit_block_size(parent_container_size) @@ -1339,7 +1339,7 @@ impl BlockFlow { // Calculate containing block inline size. let containing_block_size = if flags.contains(IS_ABSOLUTELY_POSITIONED) { - self.containing_block_size(&layout_context.shared_context().viewport_size, opaque_self).inline + self.containing_block_size(&shared_context.viewport_size, opaque_self).inline } else { content_inline_size }; @@ -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, + self.propagate_assigned_inline_size_to_children(layout_context.shared_context(), inline_start_content_edge, inline_end_content_edge, content_inline_size, diff --git a/components/layout/multicol.rs b/components/layout/multicol.rs index 09f0efd1130..fa50eb7a217 100644 --- a/components/layout/multicol.rs +++ b/components/layout/multicol.rs @@ -119,7 +119,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, inline_start_content_edge, inline_end_content_edge, column_width, + layout_context.shared_context(), inline_start_content_edge, inline_end_content_edge, column_width, |_, _, _, _, _, _| {}); } diff --git a/components/layout/table.rs b/components/layout/table.rs index 08fe3b395d6..fa91db53c36 100644 --- a/components/layout/table.rs +++ b/components/layout/table.rs @@ -400,7 +400,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, + self.block_flow.propagate_assigned_inline_size_to_children(layout_context.shared_context(), inline_start_content_edge, inline_end_content_edge, content_inline_size, diff --git a/components/layout/table_cell.rs b/components/layout/table_cell.rs index 8e487ba97da..833a044951c 100644 --- a/components/layout/table_cell.rs +++ b/components/layout/table_cell.rs @@ -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, + self.block_flow.propagate_assigned_inline_size_to_children(layout_context.shared_context(), inline_start_content_edge, inline_end_content_edge, content_inline_size, diff --git a/components/layout/table_row.rs b/components/layout/table_row.rs index 69608513bd1..1398b3ec91d 100644 --- a/components/layout/table_row.rs +++ b/components/layout/table_row.rs @@ -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, + self.block_flow.propagate_assigned_inline_size_to_children(layout_context.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 a5226310993..f03103ba87c 100644 --- a/components/layout/table_rowgroup.rs +++ b/components/layout/table_rowgroup.rs @@ -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, + self.block_flow.propagate_assigned_inline_size_to_children(layout_context.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 574d275af12..a3fab380ae0 100644 --- a/components/layout/table_wrapper.rs +++ b/components/layout/table_wrapper.rs @@ -376,7 +376,7 @@ impl Flow for TableWrapperFlow { match assigned_column_inline_sizes { None => { self.block_flow - .propagate_assigned_inline_size_to_children(layout_context, + .propagate_assigned_inline_size_to_children(layout_context.shared_context(), inline_start_content_edge, inline_end_content_edge, content_inline_size, @@ -384,7 +384,7 @@ impl Flow for TableWrapperFlow { } Some(ref assigned_column_inline_sizes) => { self.block_flow - .propagate_assigned_inline_size_to_children(layout_context, + .propagate_assigned_inline_size_to_children(layout_context.shared_context(), inline_start_content_edge, inline_end_content_edge, content_inline_size, From c33ac876ff4101703b11b1742ec5e117c21000a6 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Wed, 22 Jun 2016 13:44:15 +0200 Subject: [PATCH 11/14] Pass SharedStyleContext to propagate_and_compute_used_inline_size. --- components/layout/block.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/layout/block.rs b/components/layout/block.rs index 1f9396e6596..03b04d2f81e 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -1295,9 +1295,9 @@ impl BlockFlow { /// Compute inline size based using the `block_container_inline_size` set by the parent flow. /// /// This is run in the `AssignISizes` traversal. - fn propagate_and_compute_used_inline_size(&mut self, layout_context: &LayoutContext) { + fn propagate_and_compute_used_inline_size(&mut self, shared_context: &SharedStyleContext) { let containing_block_inline_size = self.base.block_container_inline_size; - self.compute_used_inline_size(layout_context.shared_context(), containing_block_inline_size); + self.compute_used_inline_size(shared_context, containing_block_inline_size); if self.base.flags.is_float() { self.float.as_mut().unwrap().containing_inline_size = containing_block_inline_size } @@ -1640,7 +1640,7 @@ impl BlockFlow { // Our inline-size was set to the inline-size of the containing block by the flow's parent. // Now compute the real value. - self.propagate_and_compute_used_inline_size(layout_context); + self.propagate_and_compute_used_inline_size(layout_context.shared_context()); // Now for some speculation. match self.formatting_context_type() { From ea15f6940432755cc66844358160ed9fd3e3ac17 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Wed, 22 Jun 2016 13:46:54 +0200 Subject: [PATCH 12/14] Pass SharedStyleContext to compute_inline_sizes. --- components/layout/block.rs | 8 ++++---- components/layout/multicol.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/layout/block.rs b/components/layout/block.rs index 03b04d2f81e..741d0369daa 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -1616,7 +1616,7 @@ impl BlockFlow { } } - pub fn compute_inline_sizes(&mut self, layout_context: &LayoutContext) { + pub fn compute_inline_sizes(&mut self, shared_context: &SharedStyleContext) { if !self.base.restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW) { return } @@ -1634,13 +1634,13 @@ impl BlockFlow { debug!("Setting root position"); self.base.position.start = LogicalPoint::zero(self.base.writing_mode); self.base.block_container_inline_size = LogicalSize::from_physical( - self.base.writing_mode, layout_context.shared_context().viewport_size).inline; + self.base.writing_mode, shared_context.viewport_size).inline; self.base.block_container_writing_mode = self.base.writing_mode; } // Our inline-size was set to the inline-size of the containing block by the flow's parent. // Now compute the real value. - self.propagate_and_compute_used_inline_size(layout_context.shared_context()); + self.propagate_and_compute_used_inline_size(shared_context); // Now for some speculation. match self.formatting_context_type() { @@ -1722,7 +1722,7 @@ impl Flow for BlockFlow { fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) { let _scope = layout_debug_scope!("block::assign_inline_sizes {:x}", self.base.debug_id()); - self.compute_inline_sizes(layout_context); + self.compute_inline_sizes(layout_context.shared_context()); // Move in from the inline-start border edge. let inline_start_content_edge = self.fragment.border_box.start.i + diff --git a/components/layout/multicol.rs b/components/layout/multicol.rs index fa50eb7a217..5b35e3ab9e1 100644 --- a/components/layout/multicol.rs +++ b/components/layout/multicol.rs @@ -79,7 +79,7 @@ impl Flow for MulticolFlow { fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) { debug!("assign_inline_sizes({}): assigning inline_size for flow", "multicol"); - self.block_flow.compute_inline_sizes(layout_context); + self.block_flow.compute_inline_sizes(layout_context.shared_context()); // Move in from the inline-start border edge. let inline_start_content_edge = self.block_flow.fragment.border_box.start.i + From ea45e76840286b00229d52be833e373e67f36dfa Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Wed, 22 Jun 2016 14:06:20 +0200 Subject: [PATCH 13/14] Pass SharedStyleContext to assign_inline_sizes. --- components/layout/block.rs | 6 +++--- components/layout/flex.rs | 14 +++++++------- components/layout/flow.rs | 2 +- components/layout/inline.rs | 3 ++- components/layout/list_item.rs | 8 ++++---- components/layout/multicol.rs | 13 +++++++------ components/layout/table.rs | 7 +++---- components/layout/table_caption.rs | 5 +++-- components/layout/table_cell.rs | 8 ++++---- components/layout/table_colgroup.rs | 3 ++- components/layout/table_row.rs | 8 ++++---- components/layout/table_rowgroup.rs | 8 ++++---- components/layout/table_wrapper.rs | 9 ++++----- components/layout/traversal.rs | 2 +- 14 files changed, 49 insertions(+), 47 deletions(-) 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] From 577c2d2078ac0e3f8bf179bf8d131d7f3bc20b85 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Wed, 22 Jun 2016 14:57:55 +0200 Subject: [PATCH 14/14] Store SharedStyleContext in AssignISizes. --- components/layout/parallel.rs | 3 +-- components/layout/sequential.rs | 3 ++- components/layout/traversal.rs | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/components/layout/parallel.rs b/components/layout/parallel.rs index b0afae2eeed..ba23c0d7061 100644 --- a/components/layout/parallel.rs +++ b/components/layout/parallel.rs @@ -203,9 +203,8 @@ impl<'a> ParallelPostorderFlowTraversal for AssignBSizes<'a> {} fn assign_inline_sizes(unsafe_flows: UnsafeFlowList, proxy: &mut WorkerProxy) { let shared_layout_context = proxy.user_data(); - let layout_context = LayoutContext::new(shared_layout_context); let assign_inline_sizes_traversal = AssignISizes { - layout_context: &layout_context, + shared_context: &shared_layout_context.style_context, }; assign_inline_sizes_traversal.run_parallel(unsafe_flows, proxy) } diff --git a/components/layout/sequential.rs b/components/layout/sequential.rs index a761251b77f..9d51df51a80 100644 --- a/components/layout/sequential.rs +++ b/components/layout/sequential.rs @@ -17,6 +17,7 @@ use fragment::FragmentBorderBoxIterator; use generated_content::ResolveGeneratedContent; use gfx::display_list::{DisplayItem, StackingContext}; use script_layout_interface::restyle_damage::{REFLOW, STORE_OVERFLOW}; +use style::context::StyleContext; use traversal::{AssignBSizes, AssignISizes, BubbleISizes, BuildDisplayList, ComputeAbsolutePositions}; use util::opts; @@ -70,7 +71,7 @@ pub fn traverse_flow_tree_preorder(root: &mut FlowRef, } } - let assign_inline_sizes = AssignISizes { layout_context: &layout_context }; + let assign_inline_sizes = AssignISizes { shared_context: layout_context.shared_context() }; let assign_block_sizes = AssignBSizes { layout_context: &layout_context }; doit(root, assign_inline_sizes, assign_block_sizes); diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs index bae8ecc355f..9888db994c0 100644 --- a/components/layout/traversal.rs +++ b/components/layout/traversal.rs @@ -18,6 +18,7 @@ use style::dom::TNode; use style::matching::MatchMethods; use style::properties::ServoComputedValues; use style::selector_impl::ServoSelectorImpl; +use style::servo::SharedStyleContext; use style::traversal::{DomTraversalContext, STYLE_BLOOM}; use style::traversal::{put_thread_local_bloom_filter, recalc_style_at}; use util::opts; @@ -168,13 +169,13 @@ impl<'a> PostorderFlowTraversal for BubbleISizes<'a> { /// The assign-inline-sizes traversal. In Gecko this corresponds to `Reflow`. #[derive(Copy, Clone)] pub struct AssignISizes<'a> { - pub layout_context: &'a LayoutContext<'a>, + pub shared_context: &'a SharedStyleContext, } impl<'a> PreorderFlowTraversal for AssignISizes<'a> { #[inline] fn process(&self, flow: &mut Flow) { - flow.assign_inline_sizes(self.layout_context.shared_context()); + flow.assign_inline_sizes(self.shared_context); } #[inline]