mirror of
https://github.com/servo/servo.git
synced 2025-06-20 15:18:58 +01:00
Make move mutation out of compute_minimum_ascent_and_descent
This commit is contained in:
parent
61216c301d
commit
520675b237
2 changed files with 6 additions and 5 deletions
|
@ -293,7 +293,9 @@ impl<'a> FlowConstructor<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut inline_flow = box InlineFlow::from_fragments((*node).clone(), fragments);
|
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>;
|
let mut inline_flow = inline_flow as Box<Flow>;
|
||||||
TextRunScanner::new().scan_for_runs(self.font_context(), inline_flow);
|
TextRunScanner::new().scan_for_runs(self.font_context(), inline_flow);
|
||||||
let mut inline_flow = FlowRef::new(inline_flow);
|
let mut inline_flow = FlowRef::new(inline_flow);
|
||||||
|
|
|
@ -1057,15 +1057,14 @@ impl InlineFlow {
|
||||||
/// construction.
|
/// construction.
|
||||||
///
|
///
|
||||||
/// `style` is the style of the block.
|
/// `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,
|
font_context: &mut FontContext,
|
||||||
style: &ComputedValues) {
|
style: &ComputedValues) -> (Au, Au) {
|
||||||
let font_style = text::computed_style_to_font_style(style);
|
let font_style = text::computed_style_to_font_style(style);
|
||||||
let font_metrics = text::font_metrics_for_style(font_context, &font_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 line_height = text::line_height_from_style(style, style.get_font().font_size);
|
||||||
let inline_metrics = InlineMetrics::from_font_metrics(&font_metrics, line_height);
|
let inline_metrics = InlineMetrics::from_font_metrics(&font_metrics, line_height);
|
||||||
self.minimum_height_above_baseline = inline_metrics.height_above_baseline;
|
(inline_metrics.height_above_baseline, inline_metrics.depth_below_baseline)
|
||||||
self.minimum_depth_below_baseline = inline_metrics.depth_below_baseline;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue