diff options
Diffstat (limited to 'components')
-rw-r--r-- | components/layout/block.rs | 6 | ||||
-rw-r--r-- | components/layout/fragment.rs | 13 | ||||
-rw-r--r-- | components/layout/inline.rs | 3 |
3 files changed, 18 insertions, 4 deletions
diff --git a/components/layout/block.rs b/components/layout/block.rs index fa3a13c58e7..c77c9266345 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -2134,9 +2134,9 @@ pub trait ISizeAndMarginsComputer { } fn containing_block_inline_size(&self, - _: &mut BlockFlow, - parent_flow_inline_size: Au, - _: &LayoutContext) + _: &mut BlockFlow, + parent_flow_inline_size: Au, + _: &LayoutContext) -> Au { parent_flow_inline_size } diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index b5c96816933..c8d496c04bf 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -1897,6 +1897,19 @@ impl Fragment { } } + /// Determines the inline sizes of inline-block fragments. These cannot be fully computed until + /// inline size assignment has run for the child flow: thus it is computed "late", during + /// block size assignment. + pub fn update_late_computed_replaced_inline_size_if_necessary(&mut self) { + if let SpecificFragmentInfo::InlineBlock(ref mut inline_block_info) = self.specific { + let block_flow = inline_block_info.flow_ref.as_block(); + let margin = block_flow.fragment.style.logical_margin(); + self.border_box.size.inline = block_flow.fragment.border_box.size.inline + + MaybeAuto::from_style(margin.inline_start, Au(0)).specified_or_zero() + + MaybeAuto::from_style(margin.inline_end, Au(0)).specified_or_zero() + } + } + pub fn update_late_computed_inline_position_if_necessary(&mut self) { match self.specific { SpecificFragmentInfo::InlineAbsoluteHypothetical(ref mut info) => { diff --git a/components/layout/inline.rs b/components/layout/inline.rs index 79d4db2fe5f..07a3068d65b 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -1283,10 +1283,11 @@ impl Flow for InlineFlow { // TODO(pcwalton): Cache the line scanner? debug!("assign_block_size_inline: floats in: {:?}", self.base.floats); - // Assign the block-size for the inline fragments. + // Assign the block-size and late-computed inline-sizes for the inline fragments. let containing_block_block_size = self.base.block_container_explicit_block_size.unwrap_or(Au(0)); for fragment in self.fragments.fragments.iter_mut() { + fragment.update_late_computed_replaced_inline_size_if_necessary(); fragment.assign_replaced_block_size_if_necessary( containing_block_block_size); } |