mirror of
https://github.com/servo/servo.git
synced 2025-07-08 16:03:40 +01:00
Auto merge of #19339 - CYBAI:moz-script-size-multiplier-out-of-mako, r=emilio
style: Move -moz-script-size-multiplier outside of mako This is a sub-PR of #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 #19333 - [x] These changes do not require tests <!-- 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/19339) <!-- Reviewable:end -->
This commit is contained in:
commit
ac576910d2
7 changed files with 53 additions and 26 deletions
|
@ -1514,6 +1514,7 @@ impl Clone for ${style_struct.gecko_struct_name} {
|
||||||
"MaxLength": impl_style_coord,
|
"MaxLength": impl_style_coord,
|
||||||
"MozLength": impl_style_coord,
|
"MozLength": impl_style_coord,
|
||||||
"MozScriptMinSize": impl_absolute_length,
|
"MozScriptMinSize": impl_absolute_length,
|
||||||
|
"MozScriptSizeMultiplier": impl_simple,
|
||||||
"NonNegativeLengthOrPercentage": impl_style_coord,
|
"NonNegativeLengthOrPercentage": impl_style_coord,
|
||||||
"NonNegativeNumber": impl_simple,
|
"NonNegativeNumber": impl_simple,
|
||||||
"Number": impl_simple,
|
"Number": impl_simple,
|
||||||
|
|
|
@ -707,28 +707,14 @@ ${helpers.predefined_type("-x-lang",
|
||||||
enabled_in="",
|
enabled_in="",
|
||||||
spec="Internal (not web-exposed)")}
|
spec="Internal (not web-exposed)")}
|
||||||
|
|
||||||
// MathML properties
|
${helpers.predefined_type("-moz-script-size-multiplier",
|
||||||
<%helpers:longhand name="-moz-script-size-multiplier" products="gecko" animation_value_type="none"
|
"MozScriptSizeMultiplier",
|
||||||
predefined_type="Number" gecko_ffi_name="mScriptSizeMultiplier"
|
products="gecko",
|
||||||
spec="Internal (not web-exposed)"
|
initial_value="computed::MozScriptSizeMultiplier::get_initial_value()",
|
||||||
enabled_in="">
|
animation_value_type="none",
|
||||||
pub use self::computed_value::T as SpecifiedValue;
|
gecko_ffi_name="mScriptSizeMultiplier",
|
||||||
|
enabled_in="",
|
||||||
pub mod computed_value {
|
spec="Internal (not web-exposed)")}
|
||||||
pub type T = f32;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn get_initial_value() -> computed_value::T {
|
|
||||||
::gecko_bindings::structs::NS_MATHML_DEFAULT_SCRIPT_SIZE_MULTIPLIER as f32
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn parse<'i, 't>(_context: &ParserContext, input: &mut Parser<'i, 't>)
|
|
||||||
-> Result<SpecifiedValue, ParseError<'i>> {
|
|
||||||
debug_assert!(false, "Should be set directly by presentation attributes only.");
|
|
||||||
Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError))
|
|
||||||
}
|
|
||||||
</%helpers:longhand>
|
|
||||||
|
|
||||||
${helpers.predefined_type("-moz-script-level",
|
${helpers.predefined_type("-moz-script-level",
|
||||||
"MozScriptLevel",
|
"MozScriptLevel",
|
||||||
|
|
|
@ -16,7 +16,7 @@ use values::specified::font as specified;
|
||||||
use values::specified::length::{FontBaseSize, NoCalcLength};
|
use values::specified::length::{FontBaseSize, NoCalcLength};
|
||||||
|
|
||||||
pub use values::computed::Length as MozScriptMinSize;
|
pub use values::computed::Length as MozScriptMinSize;
|
||||||
pub use values::specified::font::{XTextZoom, XLang, FontSynthesis, FontVariantSettings};
|
pub use values::specified::font::{XTextZoom, XLang, MozScriptSizeMultiplier, FontSynthesis, FontVariantSettings};
|
||||||
|
|
||||||
/// As of CSS Fonts Module Level 3, only the following values are
|
/// As of CSS Fonts Module Level 3, only the following values are
|
||||||
/// valid: 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900
|
/// valid: 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900
|
||||||
|
|
|
@ -39,7 +39,7 @@ pub use self::border::{BorderRadius, BorderCornerRadius, BorderSpacing};
|
||||||
pub use self::font::{FontSize, FontSizeAdjust, FontSynthesis, FontWeight, FontVariantAlternates};
|
pub use self::font::{FontSize, FontSizeAdjust, FontSynthesis, FontWeight, FontVariantAlternates};
|
||||||
pub use self::font::{FontLanguageOverride, FontVariantSettings, FontVariantEastAsian};
|
pub use self::font::{FontLanguageOverride, FontVariantSettings, FontVariantEastAsian};
|
||||||
pub use self::font::{FontVariantLigatures, FontVariantNumeric, FontFeatureSettings};
|
pub use self::font::{FontVariantLigatures, FontVariantNumeric, FontFeatureSettings};
|
||||||
pub use self::font::{MozScriptLevel, MozScriptMinSize, XTextZoom, XLang};
|
pub use self::font::{MozScriptLevel, MozScriptMinSize, MozScriptSizeMultiplier, XTextZoom, XLang};
|
||||||
pub use self::box_::{AnimationIterationCount, AnimationName, ScrollSnapType, VerticalAlign};
|
pub use self::box_::{AnimationIterationCount, AnimationName, ScrollSnapType, VerticalAlign};
|
||||||
pub use self::color::{Color, ColorPropertyValue, RGBAColor};
|
pub use self::color::{Color, ColorPropertyValue, RGBAColor};
|
||||||
pub use self::effects::{BoxShadow, Filter, SimpleShadow};
|
pub use self::effects::{BoxShadow, Filter, SimpleShadow};
|
||||||
|
|
|
@ -21,6 +21,7 @@ use values::specified::{AllowQuirks, LengthOrPercentage, NoCalcLength, Number};
|
||||||
use values::specified::length::{AU_PER_PT, AU_PER_PX, FontBaseSize};
|
use values::specified::length::{AU_PER_PT, AU_PER_PX, FontBaseSize};
|
||||||
|
|
||||||
const DEFAULT_SCRIPT_MIN_SIZE_PT: u32 = 8;
|
const DEFAULT_SCRIPT_MIN_SIZE_PT: u32 = 8;
|
||||||
|
const DEFAULT_SCRIPT_SIZE_MULTIPLIER: f64 = 0.71;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToCss)]
|
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToCss)]
|
||||||
/// A specified font-weight value
|
/// A specified font-weight value
|
||||||
|
@ -1899,3 +1900,41 @@ impl Parse for MozScriptLevel {
|
||||||
Ok(MozScriptLevel::Auto)
|
Ok(MozScriptLevel::Auto)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||||
|
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
|
||||||
|
/// Specifies the multiplier to be used to adjust font size
|
||||||
|
/// due to changes in scriptlevel.
|
||||||
|
///
|
||||||
|
/// Ref: https://www.w3.org/TR/MathML3/chapter3.html#presm.mstyle.attrs
|
||||||
|
pub struct MozScriptSizeMultiplier(pub f32);
|
||||||
|
|
||||||
|
impl MozScriptSizeMultiplier {
|
||||||
|
#[inline]
|
||||||
|
/// Get default value of `-moz-script-size-multiplier`
|
||||||
|
pub fn get_initial_value() -> MozScriptSizeMultiplier {
|
||||||
|
MozScriptSizeMultiplier(DEFAULT_SCRIPT_SIZE_MULTIPLIER as f32)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Parse for MozScriptSizeMultiplier {
|
||||||
|
fn parse<'i, 't>(
|
||||||
|
_: &ParserContext,
|
||||||
|
input: &mut Parser<'i, 't>
|
||||||
|
) -> Result<MozScriptSizeMultiplier, ParseError<'i>> {
|
||||||
|
debug_assert!(false, "Should be set directly by presentation attributes only.");
|
||||||
|
Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<f32> for MozScriptSizeMultiplier {
|
||||||
|
fn from(v: f32) -> Self {
|
||||||
|
MozScriptSizeMultiplier(v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<MozScriptSizeMultiplier> for f32 {
|
||||||
|
fn from(v: MozScriptSizeMultiplier) -> f32 {
|
||||||
|
v.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ pub use self::border::{BorderImageSideWidth, BorderRadius, BorderSideWidth, Bord
|
||||||
pub use self::font::{FontSize, FontSizeAdjust, FontSynthesis, FontWeight, FontVariantAlternates};
|
pub use self::font::{FontSize, FontSizeAdjust, FontSynthesis, FontWeight, FontVariantAlternates};
|
||||||
pub use self::font::{FontLanguageOverride, FontVariantSettings, FontVariantEastAsian};
|
pub use self::font::{FontLanguageOverride, FontVariantSettings, FontVariantEastAsian};
|
||||||
pub use self::font::{FontVariantLigatures, FontVariantNumeric, FontFeatureSettings};
|
pub use self::font::{FontVariantLigatures, FontVariantNumeric, FontFeatureSettings};
|
||||||
pub use self::font::{MozScriptLevel, MozScriptMinSize, XTextZoom, XLang};
|
pub use self::font::{MozScriptLevel, MozScriptMinSize, MozScriptSizeMultiplier, XTextZoom, XLang};
|
||||||
pub use self::box_::{AnimationIterationCount, AnimationName, ScrollSnapType, VerticalAlign};
|
pub use self::box_::{AnimationIterationCount, AnimationName, ScrollSnapType, VerticalAlign};
|
||||||
pub use self::color::{Color, ColorPropertyValue, RGBAColor};
|
pub use self::color::{Color, ColorPropertyValue, RGBAColor};
|
||||||
pub use self::effects::{BoxShadow, Filter, SimpleShadow};
|
pub use self::effects::{BoxShadow, Filter, SimpleShadow};
|
||||||
|
|
|
@ -3182,11 +3182,12 @@ pub extern "C" fn Servo_DeclarationBlock_SetNumberValue(
|
||||||
) {
|
) {
|
||||||
use style::properties::{PropertyDeclaration, LonghandId};
|
use style::properties::{PropertyDeclaration, LonghandId};
|
||||||
use style::properties::longhands::_moz_script_level::SpecifiedValue as MozScriptLevel;
|
use style::properties::longhands::_moz_script_level::SpecifiedValue as MozScriptLevel;
|
||||||
|
use style::properties::longhands::_moz_script_size_multiplier::SpecifiedValue as MozScriptSizeMultiplier;
|
||||||
|
|
||||||
let long = get_longhand_from_id!(property);
|
let long = get_longhand_from_id!(property);
|
||||||
|
|
||||||
let prop = match_wrap_declared! { long,
|
let prop = match_wrap_declared! { long,
|
||||||
MozScriptSizeMultiplier => value,
|
MozScriptSizeMultiplier => MozScriptSizeMultiplier(value),
|
||||||
// Gecko uses Number values to signal that it is absolute
|
// Gecko uses Number values to signal that it is absolute
|
||||||
MozScriptLevel => MozScriptLevel::MozAbsolute(value as i32),
|
MozScriptLevel => MozScriptLevel::MozAbsolute(value as i32),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue