From de06249408012868c7e9d1e66dd74ced9eb57bd9 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Mon, 21 Oct 2013 13:15:12 +0200 Subject: [PATCH] Use Au::scale_by instead of duplicating it. --- src/components/style/common_types.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/components/style/common_types.rs b/src/components/style/common_types.rs index be3e87bb072..7bde565a5b5 100644 --- a/src/components/style/common_types.rs +++ b/src/components/style/common_types.rs @@ -146,16 +146,13 @@ pub mod computed { // TODO, as needed: root font size, viewport size, etc. } - #[inline] - fn mul(a: Au, b: CSSFloat) -> Au { Au(((*a as CSSFloat) * b) as i32) } - pub fn compute_Au(value: specified::Length, context: &Context) -> Au { match value { specified::Au_(value) => value, - specified::Em(value) => mul(context.font_size, value), + specified::Em(value) => context.font_size.scale_by(value), specified::Ex(value) => { let x_height = 0.5; // TODO: find that from the font - mul(context.font_size, value * x_height) + context.font_size.scale_by(value * x_height) }, } }