Skip to content
Permalink
Browse files

Make move mutation out of compute_minimum_ascent_and_descent

  • Loading branch information
brendanzab committed Jun 20, 2014
1 parent 61216c3 commit 520675b237eb40d23f83b028ec1521e8fb2214e3
Showing with 6 additions and 5 deletions.
  1. +3 −1 src/components/main/layout/construct.rs
  2. +3 −4 src/components/main/layout/inline.rs
@@ -293,7 +293,9 @@ impl<'a> FlowConstructor<'a> {
}

let mut inline_flow = box InlineFlow::from_fragments((*node).clone(), fragments);
inline_flow.compute_minimum_ascent_and_descent(self.font_context(), &**node.style());
let (ascent, descent) = inline_flow.compute_minimum_ascent_and_descent(self.font_context(), &**node.style());
inline_flow.minimum_height_above_baseline = ascent;
inline_flow.minimum_depth_below_baseline = descent;
let mut inline_flow = inline_flow as Box<Flow>;
TextRunScanner::new().scan_for_runs(self.font_context(), inline_flow);
let mut inline_flow = FlowRef::new(inline_flow);
@@ -1057,15 +1057,14 @@ impl InlineFlow {
/// construction.
///
/// `style` is the style of the block.
pub fn compute_minimum_ascent_and_descent(&mut self,
pub fn compute_minimum_ascent_and_descent(&self,
font_context: &mut FontContext,
style: &ComputedValues) {
style: &ComputedValues) -> (Au, Au) {
let font_style = text::computed_style_to_font_style(style);
let font_metrics = text::font_metrics_for_style(font_context, &font_style);
let line_height = text::line_height_from_style(style, style.get_font().font_size);
let inline_metrics = InlineMetrics::from_font_metrics(&font_metrics, line_height);
self.minimum_height_above_baseline = inline_metrics.height_above_baseline;
self.minimum_depth_below_baseline = inline_metrics.depth_below_baseline;
(inline_metrics.height_above_baseline, inline_metrics.depth_below_baseline)
}
}

0 comments on commit 520675b

Please sign in to comment.
You can’t perform that action at this time.