layout: Remove FontStyle in favor of using the font style struct

directly, and optimize `get_layout_font_group()` to use a small vector.

Seems to be a 38% layout win on a site I tested with a lot of text.
This commit is contained in:
Patrick Walton 2014-10-15 22:09:15 -07:00
parent f3066c70da
commit a6fcec468f
6 changed files with 52 additions and 87 deletions

View file

@ -930,8 +930,8 @@ impl InlineFlow {
return (Au(0), Au(0))
}
let font_style = text::computed_style_to_font_style(style);
let font_metrics = text::font_metrics_for_style(font_context, &font_style);
let font_style = style.get_font();
let font_metrics = text::font_metrics_for_style(font_context, font_style);
let line_height = text::line_height_from_style(style, &font_metrics);
let inline_metrics = InlineMetrics::from_font_metrics(&font_metrics, line_height);
@ -944,8 +944,8 @@ impl InlineFlow {
match frag.inline_context {
Some(ref inline_context) => {
for style in inline_context.styles.iter() {
let font_style = text::computed_style_to_font_style(&**style);
let font_metrics = text::font_metrics_for_style(font_context, &font_style);
let font_style = style.get_font();
let font_metrics = text::font_metrics_for_style(font_context, font_style);
let line_height = text::line_height_from_style(&**style, &font_metrics);
let inline_metrics = InlineMetrics::from_font_metrics(&font_metrics,
line_height);