Skip to content

Commit

Permalink
Bug 1890523 - Remove extra space above/below stretchy operators. r=em…
Browse files Browse the repository at this point in the history
…ilio

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
  • Loading branch information
fred-wang committed Apr 11, 2024
1 parent 4169690 commit a89aadc
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 50 deletions.
12 changes: 9 additions & 3 deletions layout/mathml/nsMathMLmoFrame.cpp
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions modules/libpref/init/StaticPrefList.yaml
Expand Up @@ -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."
#---------------------------------------------------------------------------
Expand Down
@@ -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
@@ -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

This file was deleted.

This file was deleted.

@@ -0,0 +1,4 @@
[stretchy-largeop-with-default-font-2.html]
[Test that non-stretchy largeops are bigger in display mode.]
expected:
if os == "android": FAIL

0 comments on commit a89aadc

Please sign in to comment.