diff options
author | Ms2ger <Ms2ger@gmail.com> | 2016-06-20 19:30:18 +0200 |
---|---|---|
committer | Ms2ger <Ms2ger@gmail.com> | 2016-06-22 14:17:33 +0200 |
commit | f20ea08a1bc2cd390a716f5c565377028e2d5be2 (patch) | |
tree | d0c53b5f30fd1234b2b1c8d1e807f4c1ecf9deeb | |
parent | 6f4b8f2505e28a1c79c5c53e52e27b5bb94de28f (diff) | |
download | servo-f20ea08a1bc2cd390a716f5c565377028e2d5be2.tar.gz servo-f20ea08a1bc2cd390a716f5c565377028e2d5be2.zip |
Pass SharedStyleContext to explicit_block_containing_size.
-rw-r--r-- | components/layout/block.rs | 16 | ||||
-rw-r--r-- | components/layout/flow.rs | 5 | ||||
-rw-r--r-- | 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<Au> { + pub fn explicit_block_containing_size(&self, shared_context: &SharedStyleContext) -> Option<Au> { 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<Au> { + pub fn explicit_block_containing_size(&self, shared_context: &SharedStyleContext) -> Option<Au> { 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 |