layout: Remove get_font_arc in favor of clone_font.

Since they do the same.
This commit is contained in:
Emilio Cobos Álvarez 2016-12-31 03:17:41 +01:00
parent b49eb6f566
commit fa26e87030
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
4 changed files with 5 additions and 10 deletions

View file

@ -2005,7 +2005,7 @@ impl Fragment {
} }
// See CSS 2.1 § 10.8.1. // See CSS 2.1 § 10.8.1.
let font_metrics = text::font_metrics_for_style(&mut layout_context.font_context(), let font_metrics = text::font_metrics_for_style(&mut layout_context.font_context(),
self.style.get_font_arc()); self.style.clone_font());
let line_height = text::line_height_from_style(&*self.style, &font_metrics); let line_height = text::line_height_from_style(&*self.style, &font_metrics);
InlineMetrics::from_font_metrics(&info.run.font_metrics, line_height) InlineMetrics::from_font_metrics(&info.run.font_metrics, line_height)
} }
@ -2085,7 +2085,7 @@ impl Fragment {
vertical_align::T::middle => { vertical_align::T::middle => {
let font_metrics = let font_metrics =
text::font_metrics_for_style(&mut layout_context.font_context(), text::font_metrics_for_style(&mut layout_context.font_context(),
style.get_font_arc()); style.clone_font());
offset += (content_inline_metrics.ascent - offset += (content_inline_metrics.ascent -
content_inline_metrics.space_below_baseline - content_inline_metrics.space_below_baseline -
font_metrics.x_height).scale_by(0.5) font_metrics.x_height).scale_by(0.5)

View file

@ -1089,7 +1089,7 @@ impl InlineFlow {
return LineMetrics::new(Au(0), Au(0)) return LineMetrics::new(Au(0), Au(0))
} }
let font_style = style.get_font_arc(); let font_style = style.clone_font();
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, &font_metrics); let line_height = text::line_height_from_style(style, &font_metrics);
let inline_metrics = InlineMetrics::from_font_metrics(&font_metrics, line_height); let inline_metrics = InlineMetrics::from_font_metrics(&font_metrics, line_height);
@ -1112,7 +1112,7 @@ impl InlineFlow {
for inline_context in fragments.iter() for inline_context in fragments.iter()
.filter_map(|fragment| fragment.inline_context.as_ref()) { .filter_map(|fragment| fragment.inline_context.as_ref()) {
for node in &inline_context.nodes { for node in &inline_context.nodes {
let font_style = node.style.get_font_arc(); let font_style = node.style.clone_font();
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(&*node.style, &font_metrics); let line_height = text::line_height_from_style(&*node.style, &font_metrics);
let inline_metrics = InlineMetrics::from_font_metrics(&font_metrics, line_height); let inline_metrics = InlineMetrics::from_font_metrics(&font_metrics, line_height);

View file

@ -154,7 +154,7 @@ impl TextRunScanner {
let word_break; let word_break;
{ {
let in_fragment = self.clump.front().unwrap(); let in_fragment = self.clump.front().unwrap();
let font_style = in_fragment.style().get_font_arc(); let font_style = in_fragment.style().clone_font();
let inherited_text_style = in_fragment.style().get_inheritedtext(); let inherited_text_style = in_fragment.style().get_inheritedtext();
fontgroup = font_context.layout_font_group_for_style(font_style); fontgroup = font_context.layout_font_group_for_style(font_style);
compression = match in_fragment.white_space() { compression = match in_fragment.white_space() {

View file

@ -1322,11 +1322,6 @@ impl ComputedValues {
)) ))
} }
#[inline]
pub fn get_font_arc(&self) -> Arc<style_structs::Font> {
self.font.clone()
}
// http://dev.w3.org/csswg/css-transforms/#grouping-property-values // http://dev.w3.org/csswg/css-transforms/#grouping-property-values
pub fn get_used_transform_style(&self) -> computed_values::transform_style::T { pub fn get_used_transform_style(&self) -> computed_values::transform_style::T {
use computed_values::mix_blend_mode; use computed_values::mix_blend_mode;