From 8b208171c7ff93acada99f38364cc03cda509358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Wang?= Date: Thu, 11 Apr 2024 08:38:19 +0000 Subject: [PATCH] Bug 1890523 - Remove extra space above/below stretchy operators. r=emilio Gecko always adds .2em space above and below stretchy operators but this is not part of MathML Core and is causing several WPT failures. The MATH table does not have any parameter for that so it's likely some tweak that was added in the early days of MathML that may no longer be necessary. This patch tentatively removes this feature by placing it under a disabled-by-default flag. Differential Revision: https://phabricator.services.mozilla.com/D207014 --- layout/mathml/nsMathMLmoFrame.cpp | 12 +++++++++--- modules/libpref/init/StaticPrefList.yaml | 7 +++++++ .../mrow/stretch-along-block-axis-001.html.ini | 11 ----------- .../operators/mo-minsize-maxsize-001.html.ini | 14 -------------- .../mo-stretch-properties-001.html.ini | 5 ----- .../mo-stretch-properties-dynamic-001.html.ini | 17 ----------------- 6 files changed, 16 insertions(+), 50 deletions(-) delete mode 100644 testing/web-platform/meta/mathml/presentation-markup/operators/mo-stretch-properties-001.html.ini delete mode 100644 testing/web-platform/meta/mathml/presentation-markup/operators/mo-stretch-properties-dynamic-001.html.ini diff --git a/layout/mathml/nsMathMLmoFrame.cpp b/layout/mathml/nsMathMLmoFrame.cpp index 489697f0e3199..e27709c0b0e5b 100644 --- a/layout/mathml/nsMathMLmoFrame.cpp +++ b/layout/mathml/nsMathMLmoFrame.cpp @@ -596,9 +596,15 @@ nsMathMLmoFrame::Stretch(DrawTarget* aDrawTarget, // get the leading to be left at the top and the bottom of the stretched char // this seems more reliable than using fm->GetLeading() on suspicious fonts - nscoord em; - GetEmHeight(fm, em); - nscoord leading = NSToCoordRound(0.2f * em); + const nscoord leading = [&fm] { + if (StaticPrefs:: + mathml_top_bottom_spacing_for_stretchy_operators_disabled()) { + return 0; + } + nscoord em; + GetEmHeight(fm, em); + return NSToCoordRound(0.2f * (float)em); + }(); // Operators that are stretchy, or those that are to be centered // to cater for fonts that are not math-aware, are handled by the MathMLChar diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index 57ac414488ec2..a4b93d3fd2c07 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -9548,6 +9548,13 @@ mirror: always rust: true +# Whether to disable extra top/bottom spacing for stretchy operators. +- name: mathml.top_bottom_spacing_for_stretchy_operators.disabled + type: bool + value: true + mirror: always + rust: true + #--------------------------------------------------------------------------- # Prefs starting with "media." #--------------------------------------------------------------------------- diff --git a/testing/web-platform/meta/mathml/presentation-markup/mrow/stretch-along-block-axis-001.html.ini b/testing/web-platform/meta/mathml/presentation-markup/mrow/stretch-along-block-axis-001.html.ini index 918e9dcb02ccb..a8cbc937df6b3 100644 --- a/testing/web-platform/meta/mathml/presentation-markup/mrow/stretch-along-block-axis-001.html.ini +++ b/testing/web-platform/meta/mathml/presentation-markup/mrow/stretch-along-block-axis-001.html.ini @@ -1,17 +1,6 @@ [stretch-along-block-axis-001.html] - expected: - if (os == "android") and fission: [OK, TIMEOUT] - [Taking into account stretch axis.] - expected: FAIL - - [Taking into account stretchy property.] - expected: FAIL - [Only operators with a stretchy property and block stretch axis.] expected: FAIL [Operators smaller and larger than non-stretchy siblings.] expected: FAIL - - [Embellished operators] - expected: FAIL diff --git a/testing/web-platform/meta/mathml/presentation-markup/operators/mo-minsize-maxsize-001.html.ini b/testing/web-platform/meta/mathml/presentation-markup/operators/mo-minsize-maxsize-001.html.ini index 363130b009562..843be0fe40a65 100644 --- a/testing/web-platform/meta/mathml/presentation-markup/operators/mo-minsize-maxsize-001.html.ini +++ b/testing/web-platform/meta/mathml/presentation-markup/operators/mo-minsize-maxsize-001.html.ini @@ -1,20 +1,6 @@ [mo-minsize-maxsize-001.html] - expected: - if (os == "android") and fission: [OK, TIMEOUT] [minsize < maxsize < 0 is treated as maxsize = minsize = 0] expected: FAIL - [minsize < 0 is treated as 0] - expected: FAIL - - [target size = 0 is treated as Tascent = Tdescent = minsize/2] - expected: FAIL - - [maxsize < minsize is treated as maxsize = minsize] - expected: FAIL - [minsize/maxsize percentages are relative to the target size] expected: FAIL - - [default minsize/maxsize percentages] - expected: FAIL diff --git a/testing/web-platform/meta/mathml/presentation-markup/operators/mo-stretch-properties-001.html.ini b/testing/web-platform/meta/mathml/presentation-markup/operators/mo-stretch-properties-001.html.ini deleted file mode 100644 index 294cf0bfb844e..0000000000000 --- a/testing/web-platform/meta/mathml/presentation-markup/operators/mo-stretch-properties-001.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[mo-stretch-properties-001.html] - expected: - if (os == "android") and fission: [OK, TIMEOUT] - [Stretchy vertical line] - expected: FAIL diff --git a/testing/web-platform/meta/mathml/presentation-markup/operators/mo-stretch-properties-dynamic-001.html.ini b/testing/web-platform/meta/mathml/presentation-markup/operators/mo-stretch-properties-dynamic-001.html.ini deleted file mode 100644 index 78e9ccef75a21..0000000000000 --- a/testing/web-platform/meta/mathml/presentation-markup/operators/mo-stretch-properties-dynamic-001.html.ini +++ /dev/null @@ -1,17 +0,0 @@ -[mo-stretch-properties-dynamic-001.html] - expected: - if (os == "android") and fission: [OK, TIMEOUT] - [symmetric] - expected: FAIL - - [largeop] - expected: FAIL - - [minsize] - expected: FAIL - - [maxsize] - expected: FAIL - - [stretchy] - expected: FAIL