mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: Rename -moz-math-script-level to math-depth.
This renames the internal -moz-math-script-level property in order to prepare for full math-depth support. Currently, the property is guarded under a disabled-by-default flag, so there should be no observable behavior change. Differential Revision: https://phabricator.services.mozilla.com/D91285
This commit is contained in:
parent
4a625be8ad
commit
4dfcf583cf
8 changed files with 27 additions and 26 deletions
|
@ -963,7 +963,7 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> {
|
|||
fn handle_mathml_scriptlevel_if_needed(&mut self) {
|
||||
use crate::values::generics::NonNegative;
|
||||
|
||||
if !self.seen.contains(LonghandId::MozScriptLevel) &&
|
||||
if !self.seen.contains(LonghandId::MathDepth) &&
|
||||
!self.seen.contains(LonghandId::MozScriptMinSize) &&
|
||||
!self.seen.contains(LonghandId::MozScriptSizeMultiplier) {
|
||||
return;
|
||||
|
@ -980,7 +980,7 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> {
|
|||
let parent_font = builder.get_parent_font().gecko();
|
||||
|
||||
let delta =
|
||||
font.mScriptLevel.saturating_sub(parent_font.mScriptLevel);
|
||||
font.mMathDepth.saturating_sub(parent_font.mMathDepth);
|
||||
|
||||
if delta == 0 {
|
||||
return;
|
||||
|
|
|
@ -360,7 +360,7 @@ class Longhand(object):
|
|||
"MasonryAutoFlow",
|
||||
"MozForceBrokenImageIcon",
|
||||
"MozListReversed",
|
||||
"MozScriptLevel",
|
||||
"MathDepth",
|
||||
"MozScriptMinSize",
|
||||
"MozScriptSizeMultiplier",
|
||||
"TextDecorationSkipInk",
|
||||
|
|
|
@ -228,14 +228,15 @@ ${helpers.predefined_type(
|
|||
)}
|
||||
|
||||
${helpers.predefined_type(
|
||||
"-moz-script-level",
|
||||
"MozScriptLevel",
|
||||
"math-depth",
|
||||
"MathDepth",
|
||||
"0",
|
||||
engines="gecko",
|
||||
gecko_pref="layout.css.math-depth.enabled",
|
||||
has_effect_on_gecko_scrollbars=False,
|
||||
animation_value_type="none",
|
||||
enabled_in="ua",
|
||||
gecko_ffi_name="mScriptLevel",
|
||||
spec="Internal (not web-exposed)",
|
||||
spec="https://mathml-refresh.github.io/mathml-core/#the-math-script-level-property",
|
||||
)}
|
||||
|
||||
${helpers.single_keyword(
|
||||
|
|
|
@ -1342,8 +1342,8 @@ impl LonghandId {
|
|||
// preferences properly, see bug 1165538.
|
||||
LonghandId::MozMinFontSizeRatio |
|
||||
|
||||
// Needed to do font-size for MathML. :(
|
||||
LonghandId::MozScriptLevel |
|
||||
// font-size depends on math-depth's computed value.
|
||||
LonghandId::MathDepth |
|
||||
% endif
|
||||
|
||||
// Needed to compute the first available font, in order to
|
||||
|
|
|
@ -811,20 +811,20 @@ impl ToComputedValue for specified::MozScriptMinSize {
|
|||
}
|
||||
}
|
||||
|
||||
/// The computed value of the -moz-script-level property.
|
||||
pub type MozScriptLevel = i8;
|
||||
/// The computed value of the math-depth property.
|
||||
pub type MathDepth = i8;
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
impl ToComputedValue for specified::MozScriptLevel {
|
||||
type ComputedValue = MozScriptLevel;
|
||||
impl ToComputedValue for specified::MathDepth {
|
||||
type ComputedValue = MathDepth;
|
||||
|
||||
fn to_computed_value(&self, cx: &Context) -> i8 {
|
||||
use crate::properties::longhands::math_style::SpecifiedValue as MathStyleValue;
|
||||
use std::{cmp, i8};
|
||||
|
||||
let int = match *self {
|
||||
specified::MozScriptLevel::Auto => {
|
||||
let parent = cx.builder.get_parent_font().clone__moz_script_level() as i32;
|
||||
specified::MathDepth::Auto => {
|
||||
let parent = cx.builder.get_parent_font().clone_math_depth() as i32;
|
||||
let style = cx.builder.get_parent_font().clone_math_style();
|
||||
if style == MathStyleValue::Compact {
|
||||
parent + 1
|
||||
|
@ -832,17 +832,17 @@ impl ToComputedValue for specified::MozScriptLevel {
|
|||
parent
|
||||
}
|
||||
},
|
||||
specified::MozScriptLevel::Relative(rel) => {
|
||||
let parent = cx.builder.get_parent_font().clone__moz_script_level();
|
||||
specified::MathDepth::Relative(rel) => {
|
||||
let parent = cx.builder.get_parent_font().clone_math_depth();
|
||||
parent as i32 + rel
|
||||
},
|
||||
specified::MozScriptLevel::MozAbsolute(abs) => abs,
|
||||
specified::MathDepth::MozAbsolute(abs) => abs,
|
||||
};
|
||||
cmp::min(int, i8::MAX as i32) as i8
|
||||
}
|
||||
|
||||
fn from_computed_value(other: &i8) -> Self {
|
||||
specified::MozScriptLevel::MozAbsolute(*other as i32)
|
||||
specified::MathDepth::MozAbsolute(*other as i32)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ pub use self::font::{FontFeatureSettings, FontVariantLigatures, FontVariantNumer
|
|||
pub use self::font::{FontSize, FontSizeAdjust, FontStretch, FontSynthesis};
|
||||
pub use self::font::{FontVariantAlternates, FontWeight};
|
||||
pub use self::font::{FontVariantEastAsian, FontVariationSettings};
|
||||
pub use self::font::{MozScriptLevel, MozScriptMinSize, MozScriptSizeMultiplier, XLang, XTextZoom};
|
||||
pub use self::font::{MathDepth, MozScriptMinSize, MozScriptSizeMultiplier, XLang, XTextZoom};
|
||||
pub use self::image::{Gradient, Image, LineDirection, MozImageRect};
|
||||
pub use self::length::{CSSPixelLength, ExtremumLength, NonNegativeLength};
|
||||
pub use self::length::{Length, LengthOrNumber, LengthPercentage, NonNegativeLengthOrNumber};
|
||||
|
|
|
@ -2311,7 +2311,7 @@ impl Parse for MozScriptMinSize {
|
|||
///
|
||||
/// The main effect of scriptlevel is to control the font size.
|
||||
/// https://www.w3.org/TR/MathML3/chapter3.html#presm.scriptlevel
|
||||
pub enum MozScriptLevel {
|
||||
pub enum MathDepth {
|
||||
/// Change `font-size` relatively.
|
||||
Relative(i32),
|
||||
/// Change `font-size` absolutely.
|
||||
|
@ -2325,17 +2325,17 @@ pub enum MozScriptLevel {
|
|||
Auto,
|
||||
}
|
||||
|
||||
impl Parse for MozScriptLevel {
|
||||
impl Parse for MathDepth {
|
||||
fn parse<'i, 't>(
|
||||
_: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<MozScriptLevel, ParseError<'i>> {
|
||||
) -> Result<MathDepth, ParseError<'i>> {
|
||||
// We don't bother to handle calc here.
|
||||
if let Ok(i) = input.try_parse(|i| i.expect_integer()) {
|
||||
return Ok(MozScriptLevel::Relative(i));
|
||||
return Ok(MathDepth::Relative(i));
|
||||
}
|
||||
input.expect_ident_matching("auto")?;
|
||||
Ok(MozScriptLevel::Auto)
|
||||
Ok(MathDepth::Auto)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ pub use self::font::{FontFeatureSettings, FontVariantLigatures, FontVariantNumer
|
|||
pub use self::font::{FontSize, FontSizeAdjust, FontSizeKeyword, FontStretch, FontSynthesis};
|
||||
pub use self::font::{FontVariantAlternates, FontWeight};
|
||||
pub use self::font::{FontVariantEastAsian, FontVariationSettings};
|
||||
pub use self::font::{MozScriptLevel, MozScriptMinSize, MozScriptSizeMultiplier, XLang, XTextZoom};
|
||||
pub use self::font::{MathDepth, MozScriptMinSize, MozScriptSizeMultiplier, XLang, XTextZoom};
|
||||
pub use self::image::{EndingShape as GradientEndingShape, Gradient};
|
||||
pub use self::image::{Image, MozImageRect};
|
||||
pub use self::length::{AbsoluteLength, CalcLengthPercentage, CharacterWidth};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue