mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
style: Move font -moz-script-level outside of mako
This commit is contained in:
parent
86b9e7d7d6
commit
d316c55590
6 changed files with 84 additions and 78 deletions
|
@ -505,3 +505,41 @@ impl Parse for MozScriptMinSize {
|
|||
Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
/// Changes the scriptlevel in effect for the children.
|
||||
/// Ref: https://wiki.mozilla.org/MathML:mstyle
|
||||
///
|
||||
/// The main effect of scriptlevel is to control the font size.
|
||||
/// https://www.w3.org/TR/MathML3/chapter3.html#presm.scriptlevel
|
||||
pub enum MozScriptLevel {
|
||||
/// Change `font-size` relatively
|
||||
Relative(i32),
|
||||
/// Change `font-size` absolutely
|
||||
Absolute(i32),
|
||||
/// Change `font-size` automatically
|
||||
Auto
|
||||
}
|
||||
|
||||
impl ToCss for MozScriptLevel {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match *self {
|
||||
MozScriptLevel::Auto => dest.write_str("auto"),
|
||||
MozScriptLevel::Relative(rel) => rel.to_css(dest),
|
||||
// can only be specified by pres attrs; should not
|
||||
// serialize to anything else
|
||||
MozScriptLevel::Absolute(_) => Ok(()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Parse for MozScriptLevel {
|
||||
fn parse<'i, 't>(_: &ParserContext, input: &mut Parser<'i, 't>) -> Result<MozScriptLevel, ParseError<'i>> {
|
||||
if let Ok(i) = input.try(|i| i.expect_integer()) {
|
||||
return Ok(MozScriptLevel::Relative(i))
|
||||
}
|
||||
input.expect_ident_matching("auto")?;
|
||||
Ok(MozScriptLevel::Auto)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ pub use self::align::{AlignItems, AlignJustifyContent, AlignJustifySelf, Justify
|
|||
pub use self::background::{BackgroundRepeat, BackgroundSize};
|
||||
pub use self::border::{BorderCornerRadius, BorderImageSlice, BorderImageWidth};
|
||||
pub use self::border::{BorderImageSideWidth, BorderRadius, BorderSideWidth, BorderSpacing};
|
||||
pub use self::font::{FontWeight, MozScriptMinSize, XTextZoom};
|
||||
pub use self::font::{FontWeight, MozScriptLevel, MozScriptMinSize, XTextZoom};
|
||||
pub use self::box_::{AnimationIterationCount, AnimationName, ScrollSnapType, VerticalAlign};
|
||||
pub use self::color::{Color, ColorPropertyValue, RGBAColor};
|
||||
pub use self::effects::{BoxShadow, Filter, SimpleShadow};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue