diff options
Diffstat (limited to 'src/components/layout/fragment.rs')
-rw-r--r-- | src/components/layout/fragment.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/components/layout/fragment.rs b/src/components/layout/fragment.rs index 66ccb6b2d86..7f61517a328 100644 --- a/src/components/layout/fragment.rs +++ b/src/components/layout/fragment.rs @@ -455,8 +455,10 @@ impl Fragment { } } - pub fn calculate_line_height(&self) -> Au { - text::line_height_from_style(self.style()) + pub fn calculate_line_height(&self, layout_context: &LayoutContext) -> Au { + let font_style = text::computed_style_to_font_style(&*self.style); + let font_metrics = text::font_metrics_for_style(layout_context.font_context(), &font_style); + text::line_height_from_style(&*self.style, &font_metrics) } /// Returns the sum of the inline-sizes of all the borders of this fragment. This is private because @@ -1082,7 +1084,7 @@ impl Fragment { } /// Returns, and computes, the block-size of this fragment. - pub fn content_block_size(&self) -> Au { + pub fn content_block_size(&self, layout_context: &LayoutContext) -> Au { match self.specific { GenericFragment | IframeFragment(_) | TableFragment | TableCellFragment | TableRowFragment | TableWrapperFragment => Au(0), @@ -1091,7 +1093,7 @@ impl Fragment { } ScannedTextFragment(_) => { // Compute the block-size based on the line-block-size and font size. - self.calculate_line_height() + self.calculate_line_height(layout_context) } TableColumnFragment(_) => fail!("Table column fragments do not have block_size"), UnscannedTextFragment(_) => fail!("Unscanned text fragments should have been scanned by now!"), @@ -1370,7 +1372,7 @@ impl Fragment { /// Calculates block-size above baseline, depth below baseline, and ascent for this fragment when /// used in an inline formatting context. See CSS 2.1 § 10.8.1. - pub fn inline_metrics(&self) -> InlineMetrics { + pub fn inline_metrics(&self, layout_context: &LayoutContext) -> InlineMetrics { match self.specific { ImageFragment(ref image_fragment_info) => { let computed_block_size = image_fragment_info.computed_block_size(); @@ -1382,7 +1384,7 @@ impl Fragment { } ScannedTextFragment(ref text_fragment) => { // See CSS 2.1 § 10.8.1. - let line_height = self.calculate_line_height(); + let line_height = self.calculate_line_height(layout_context); InlineMetrics::from_font_metrics(&text_fragment.run.font_metrics, line_height) } _ => { |