Skip to content

Commit

Permalink
Export mo-invisibleoperators-*.html reftests to WPT.
Browse files Browse the repository at this point in the history
These tests are testing Gecko's special handling of invisible operators
introduced in bug 969867 and bug 522393. mo-invisibleoperators-2.html
is just dynamically replacing the invisible operators into ASCII text
and is compatible with MathML-Core implementations.
mo-invisibleoperators.html verifies that invisible operators are really
invisible (no size, background, foreground) which is also compatible
with MathML-Core implementations, as long as the default math fonts
really have empty glyphs for these operators, which should be the case
for modern font sets.

Differential Revision: https://phabricator.services.mozilla.com/D199698

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1876684
gecko-commit: 3225b8ea16e45772092f8ecf0dfa40215019ca9d
gecko-reviewers: emilio
  • Loading branch information
fred-wang authored and moz-wptsync-bot committed Jan 31, 2024
1 parent 896d4b0 commit 7f5cd8c
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<math>
<mo>1</mo>
</math>
<p>
<math>
<mo>2</mo>
</math>
<p>
<math>
<mo>3</mo>
</math>
<p>
<math>
<mo>4</mo>
</math>
<p>
<table>
<tr>
<td style="border: 1px solid;">
<math>
<mo>x</mo>
</math>
</td>
</tr>
</table>
</html>
48 changes: 48 additions & 0 deletions mathml/presentation-markup/operators/mo-invisibleoperators-2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<link rel="match" href="mo-invisibleoperators-2-ref.html">
<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
<link rel="help" href="This test verifies proper invalidation after dynamically replacing the text of invisible operators.">
<meta name="assert" content="https://bugzilla.mozilla.org/show_bug.cgi?id=522393">
</head>
<body>
<math>
<mo id="mo1">&#x2061;<!-- FUNCTION APPLICATION --></mo>
</math>
<p>
<math>
<mo id="mo2">&#x2062;<!-- INVISIBLE TIMES --></mo>
</math>
<p>
<math>
<mo id="mo3">&#x2063;<!-- INVISIBLE SEPARATOR --></mo>
</math>
<p>
<math>
<mo id="mo4">&#x2064;<!-- INVISIBLE PLUS --></mo>
</math>
<p>
<!-- Test preferred width after dynamic change-->
<table>
<tr>
<td style="border: 1px solid;">
<math>
<mo id="mo5">&ApplyFunction;</mo>
</math>
</td>
</tr>
</table>
<script type="text/javascript">
function doTest() {
document.getElementById('mo1').firstChild.data = '1';
document.getElementById('mo2').firstChild.data = '2';
document.getElementById('mo3').firstChild.data = '3';
document.getElementById('mo4').firstChild.data = '4';
document.getElementById('mo5').firstChild.data = 'x';
document.documentElement.removeAttribute("class");
}
window.addEventListener("TestRendered", doTest);
</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<math>
<mrow>
<mn>1</mn>
<mn>2</mn>
<mn>3</mn>
<mn>4</mn>
<mn>5</mn>
<mspace height="2em" width="0.1em"></mspace>
</mrow>
</math>
</html>
33 changes: 33 additions & 0 deletions mathml/presentation-markup/operators/mo-invisibleoperators.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<link rel="match" href="mo-invisibleoperators-ref.html">
<link rel="help" href="https://w3c.github.io/mathml-core/#operator-fence-separator-or-accent-mo">
<link rel="help" href="This test verifies that invisible operators rendered with the default fonts do not add spacing, foreground or background.">
<meta name="assert" content="https://bugzilla.mozilla.org/show_bug.cgi?id=969867">
<meta name="assert" content="https://bugzilla.mozilla.org/show_bug.cgi?id=522393">
</head>
<math>
<mrow>
<mn>1</mn>
<mo>&#x2061;<!-- FUNCTION APPLICATION --></mo>
<mn>2</mn>
<mo>&#x2062;<!-- INVISIBLE TIMES --></mo>
<mn>3</mn>
<mo>&#x2063;<!-- INVISIBLE SEPARATOR --></mo>
<mn>4</mn>
<mo>&#x2064;<!-- INVISIBLE PLUS --></mo>
<mn>5</mn>
<!-- Hack. The invisible operators may not belong to the same font as
the numbers, so they may have different heights. The mspace
compensates for this by ensuring the height of the mrow does not
depend on character height -->
<mspace height="2em" width="0.1em"></mspace>
</mrow>
</math>
<p>
<!-- Should be invisible -->
<math>
<mo style="background: red; color: blue;">&ApplyFunction;</mo>
</math>
</html>

0 comments on commit 7f5cd8c

Please sign in to comment.