Auto merge of #19051 - CYBAI:moz-script-min-size-no-mako, r=emilio,canaltinova

style: Move font -moz-script-min-size outside of mako

This is a sub-PR for #19015
r? emilio

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #19034 (github issue number if applicable).
- [X] These changes do not require tests because _____

<!-- 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/19051)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-10-30 15:00:05 -05:00 committed by GitHub
commit 10227e3cd2
6 changed files with 64 additions and 56 deletions

View file

@ -8,9 +8,11 @@ use app_units::Au;
use std::fmt;
use style_traits::ToCss;
use values::animated::ToAnimatedValue;
use values::computed::NonNegativeLength;
use values::computed::{Context, NonNegativeLength, ToComputedValue};
use values::specified::font as specified;
use values::specified::length::{FontBaseSize, NoCalcLength};
pub use values::computed::Length as MozScriptMinSize;
pub use values::specified::font::XTextZoom;
#[derive(Animate, ComputeSquaredDistance, MallocSizeOf, ToAnimatedZero)]
@ -94,3 +96,28 @@ impl ToAnimatedValue for FontSize {
}
}
}
impl ToComputedValue for specified::MozScriptMinSize {
type ComputedValue = MozScriptMinSize;
fn to_computed_value(&self, cx: &Context) -> MozScriptMinSize {
// this value is used in the computation of font-size, so
// we use the parent size
let base_size = FontBaseSize::InheritedStyle;
match self.0 {
NoCalcLength::FontRelative(value) => {
value.to_computed_value(cx, base_size)
}
NoCalcLength::ServoCharacterWidth(value) => {
value.to_computed_value(base_size.resolve(cx))
}
ref l => {
l.to_computed_value(cx)
}
}
}
fn from_computed_value(other: &MozScriptMinSize) -> Self {
specified::MozScriptMinSize(ToComputedValue::from_computed_value(other))
}
}

View file

@ -36,7 +36,7 @@ pub use self::angle::Angle;
pub use self::background::{BackgroundSize, BackgroundRepeat};
pub use self::border::{BorderImageSlice, BorderImageWidth, BorderImageSideWidth};
pub use self::border::{BorderRadius, BorderCornerRadius, BorderSpacing};
pub use self::font::XTextZoom;
pub use self::font::{XTextZoom, MozScriptMinSize};
pub use self::box_::{AnimationIterationCount, AnimationName, ScrollSnapType, VerticalAlign};
pub use self::color::{Color, ColorPropertyValue, RGBAColor};
pub use self::effects::{BoxShadow, Filter, SimpleShadow};