Auto merge of #18451 - Manishearth:stylo-calc-fontsize, r=emilio

stylo: Add support for calcs in base size calculation

This tracks an offset along with the ratio for the keyword font size data.
The offset gets used when a calc is involved whilst inheriting font-size
(it is the computed value of that calc ignoring em/percentage portions,
which go into the ratio). If the family or language changes, the new font
size can be computed by taking the keyword's size in the context of that
family/language, multiplying it by the ratio, and adding the offset.

r=emilio https://bugzilla.mozilla.org/show_bug.cgi?id=1380980

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18451)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-09-11 21:01:57 -05:00 committed by GitHub
commit f91ea02bf7
7 changed files with 106 additions and 91 deletions

View file

@ -14,8 +14,7 @@ use properties;
use properties::{ComputedValues, StyleBuilder};
#[cfg(feature = "servo")]
use servo_url::ServoUrl;
use std::f32;
use std::fmt;
use std::{f32, fmt, ops};
#[cfg(feature = "servo")]
use std::sync::Arc;
use style_traits::ToCss;
@ -563,6 +562,13 @@ impl NonNegativeAu {
}
}
impl ops::Add<NonNegativeAu> for NonNegativeAu {
type Output = NonNegativeAu;
fn add(self, other: Self) -> Self {
(self.0 + other.0).into()
}
}
impl From<Au> for NonNegativeAu {
#[inline]
fn from(au: Au) -> NonNegativeAu {