mirror of
https://github.com/servo/servo.git
synced 2025-08-16 10:55:34 +01:00
style: Move font -moz-script-min-size outside of mako
This commit is contained in:
parent
c7172052f9
commit
63cd930fd0
6 changed files with 64 additions and 56 deletions
|
@ -12,9 +12,11 @@ use parser::{Parse, ParserContext};
|
|||
use properties::longhands::system_font::SystemFont;
|
||||
use std::fmt;
|
||||
use style_traits::{ToCss, StyleParseErrorKind, ParseError};
|
||||
use values::computed::{font as computed, Context, NonNegativeLength, ToComputedValue};
|
||||
use values::computed::{font as computed, Context, Length, NonNegativeLength, ToComputedValue};
|
||||
use values::specified::{LengthOrPercentage, NoCalcLength};
|
||||
use values::specified::length::FontBaseSize;
|
||||
use values::specified::length::{AU_PER_PT, AU_PER_PX, FontBaseSize};
|
||||
|
||||
const DEFAULT_SCRIPT_MIN_SIZE_PT: u32 = 8;
|
||||
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
|
||||
/// A specified font-size value
|
||||
|
@ -391,3 +393,24 @@ impl ToCss for XTextZoom {
|
|||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||
#[derive(Clone, Debug, PartialEq, ToCss)]
|
||||
/// Specifies the minimum font size allowed due to changes in scriptlevel.
|
||||
/// Ref: https://wiki.mozilla.org/MathML:mstyle
|
||||
pub struct MozScriptMinSize(pub NoCalcLength);
|
||||
|
||||
impl MozScriptMinSize {
|
||||
#[inline]
|
||||
/// Calculate initial value of -moz-script-min-size.
|
||||
pub fn get_initial_value() -> Length {
|
||||
Length::new(DEFAULT_SCRIPT_MIN_SIZE_PT as f32 * (AU_PER_PT / AU_PER_PX))
|
||||
}
|
||||
}
|
||||
|
||||
impl Parse for MozScriptMinSize {
|
||||
fn parse<'i, 't>(_: &ParserContext, input: &mut Parser<'i, 't>) -> Result<MozScriptMinSize, ParseError<'i>> {
|
||||
debug_assert!(false, "Should be set directly by presentation attributes only.");
|
||||
Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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::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};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue