From ca03f4df6d2dd64bec30393fde7b88e2efd22b29 Mon Sep 17 00:00:00 2001 From: Frederic Wang Date: Wed, 23 Sep 2020 13:04:48 +0000 Subject: [PATCH] style: Implement the math-style property. This patch renames the internal -moz-math-display to math-style and exposes it under the layout.css.math-style.enabled preference. The initial value becomes "normal" but that does not affect the default MathML behavior since the UA style sheet sets the math-style property explicitly on tags. WPT tests are updated to use the syntax approved by the CSSWG. Intent to prototype: https://groups.google.com/forum/#!msg/mozilla.dev.platform/1hQQ7ISudGo/_yLEckEeBQAJ Differential Revision: https://phabricator.services.mozilla.com/D90731 --- components/style/properties/longhands/font.mako.rs | 12 ++++++------ components/style/values/computed/font.rs | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/components/style/properties/longhands/font.mako.rs b/components/style/properties/longhands/font.mako.rs index 2ed226f781d..f706ddad9de 100644 --- a/components/style/properties/longhands/font.mako.rs +++ b/components/style/properties/longhands/font.mako.rs @@ -239,14 +239,14 @@ ${helpers.predefined_type( )} ${helpers.single_keyword( - "-moz-math-display", - "inline block", + "math-style", + "normal compact", engines="gecko", - gecko_constant_prefix="NS_MATHML_DISPLAYSTYLE", - gecko_ffi_name="mMathDisplay", - enabled_in="ua", - spec="Internal (not web-exposed)", + gecko_pref="layout.css.math-style.enabled", + spec="https://mathml-refresh.github.io/mathml-core/#the-math-style-property", + has_effect_on_gecko_scrollbars=False, animation_value_type="none", + enabled_in="ua", )} ${helpers.single_keyword( diff --git a/components/style/values/computed/font.rs b/components/style/values/computed/font.rs index af56e59abd3..de97ea03303 100644 --- a/components/style/values/computed/font.rs +++ b/components/style/values/computed/font.rs @@ -819,14 +819,14 @@ impl ToComputedValue for specified::MozScriptLevel { type ComputedValue = MozScriptLevel; fn to_computed_value(&self, cx: &Context) -> i8 { - use crate::properties::longhands::_moz_math_display::SpecifiedValue as DisplayValue; + 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; - let display = cx.builder.get_parent_font().clone__moz_math_display(); - if display == DisplayValue::Inline { + let style = cx.builder.get_parent_font().clone_math_style(); + if style == MathStyleValue::Compact { parent + 1 } else { parent