commit e6d3ff306881214403bab305c681164007924d75 parent ad000f73448ad810640e4eb601be1c2c5c53317f Author: eri <eri@igalia.com> Date: Wed, 19 Nov 2025 04:47:37 +0000 Bug 1997564 - Make `math-depth` animate like an integer r=emilio,fredw,firefox-style-system-reviewers Change the animation type for `math-depth` from discrete to integer, as specified by the MathML Core specification: https://w3c.github.io/mathml-core/#propdef-math-depth Update the test that I added to remove the unnecessary and incorrect case that I added checking `add` and `auto-add`. Those are already covered by checking the parsing of computed values and the integer animation testing is enough. Differential Revision: https://phabricator.services.mozilla.com/D270840 Diffstat:
8 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/devtools/server/actors/animation-type-longhand.js b/devtools/server/actors/animation-type-longhand.js @@ -117,7 +117,6 @@ exports.ANIMATION_TYPE_FOR_LONGHANDS = [ "mask-repeat", "mask-type", "masonry-auto-flow", - "math-depth", "math-shift", "math-style", "mix-blend-mode", @@ -326,6 +325,7 @@ exports.ANIMATION_TYPE_FOR_LONGHANDS = [ "mask-position-x", "mask-position-y", "mask-size", + "math-depth", "object-position", "offset-anchor", "offset-path", diff --git a/layout/style/test/test_transitions_per_property.html b/layout/style/test/test_transitions_per_property.html @@ -214,6 +214,7 @@ var supported_properties = { /* test_length_percent_pair_unclamped */ ], "mask-size": [ test_background_size_transition, test_length_percent_pair_clamped ], + "math-depth": [ test_integer_transition ], "max-height": [ test_length_transition, test_percent_transition, test_length_clamped, test_percent_clamped ], "max-width": [ test_length_transition, test_percent_transition, diff --git a/servo/components/style/properties/longhands/font.mako.rs b/servo/components/style/properties/longhands/font.mako.rs @@ -308,7 +308,6 @@ ${helpers.predefined_type( "MathDepth", "0", engines="gecko", - animation_type="discrete", spec="https://mathml-refresh.github.io/mathml-core/#the-math-script-level-property", affects="", )} diff --git a/servo/components/style/values/computed/font.rs b/servo/components/style/values/computed/font.rs @@ -19,6 +19,7 @@ use crate::values::specified::font::{ self as specified, KeywordInfo, MAX_FONT_WEIGHT, MIN_FONT_WEIGHT, }; use crate::values::specified::length::{FontBaseSize, LineHeightBase, NoCalcLength}; +use crate::values::CSSInteger; use crate::Atom; use cssparser::{serialize_identifier, CssStringWriter, Parser}; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; @@ -1100,6 +1101,21 @@ impl ToComputedValue for specified::MathDepth { } } +impl ToAnimatedValue for MathDepth { + type AnimatedValue = CSSInteger; + + #[inline] + fn to_animated_value(self, _: &crate::values::animated::Context) -> Self::AnimatedValue { + self.into() + } + + #[inline] + fn from_animated_value(animated: Self::AnimatedValue) -> Self { + use std::{cmp, i8}; + cmp::min(animated, i8::MAX as i32) as i8 + } +} + /// - Use a signed 8.8 fixed-point value (representable range -128.0..128) /// /// Values of <angle> below -90 or above 90 are not permitted, so we use an out diff --git a/testing/web-platform/meta/web-animations/animation-model/animation-types/accumulation-per-property-002.html.ini b/testing/web-platform/meta/web-animations/animation-model/animation-types/accumulation-per-property-002.html.ini @@ -7,6 +7,3 @@ [text-decoration: "underline" onto "overline"] expected: FAIL - - [math-depth: integer] - expected: FAIL diff --git a/testing/web-platform/meta/web-animations/animation-model/animation-types/addition-per-property-002.html.ini b/testing/web-platform/meta/web-animations/animation-model/animation-types/addition-per-property-002.html.ini @@ -7,6 +7,3 @@ [text-decoration: "underline" onto "overline"] expected: FAIL - - [math-depth: integer] - expected: FAIL diff --git a/testing/web-platform/meta/web-animations/animation-model/animation-types/interpolation-per-property-002.html.ini b/testing/web-platform/meta/web-animations/animation-model/animation-types/interpolation-per-property-002.html.ini @@ -16,6 +16,3 @@ [text-decoration uses discrete animation when animating between "underline" and "overline" with keyframe easing] expected: FAIL - - [math-depth supports animating as an integer] - expected: FAIL diff --git a/testing/web-platform/tests/web-animations/animation-model/animation-types/property-list.js b/testing/web-platform/tests/web-animations/animation-model/animation-types/property-list.js @@ -907,11 +907,7 @@ const gCSSProperties2 = { }, "math-depth": { // https://w3c.github.io/mathml-core/#propdef-math-depth - types: [ - "integer", - { type: "discrete", options: [ [ "auto-add", "1", "0", "1" ], - [ "add(1)", "2", "1", "2" ] ] }, - ], + types: [ "integer" ], }, "math-shift": { // https://w3c.github.io/mathml-core/#propdef-math-shift