Skip to content

Commit 0eecdc7

Browse files
fred-wangmoz-wptsync-bot
authored andcommitted
Tweak inferred-mrow-stretchy.html and add separate tests for bug 2020658 and bug 236963.
The goal of inferred-mrow-stretchy.html is to verify that stretching happens inside various elements using the mrow layout algorithm (either as part of their own layout algorithm, or because they wrap their children in an anonymous mrow), a concept called "inferred mrow" in MathML 3. However, with how the test is currently written, some of these elements are actually embellished operators and so what's actually tested is the stretching during the layout of the <math> element. Adding a <mn> child ensures that these elements are not embellished and allows to recover the original goal of this test. Incidentally, the two failures in the .ini file are commented to mention the old bug 236963. A separate test embellished-operator-004.html is added to preverse existing testing of such embellished <mrow> that is the sole child of a <math> element. We try various level of <mrow> showing our existing failures for 0 or 2 levels (respectively bug 236963 and bug 2020658). Differential Revision: https://phabricator.services.mozilla.com/D287516 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=2023048 gecko-commit: 082e6f7f2319b41b018adbe6ee05f33874656a08 gecko-reviewers: emilio
1 parent 14877f0 commit 0eecdc7

File tree

2 files changed

+93
-14
lines changed

2 files changed

+93
-14
lines changed

mathml/presentation-markup/mrow/inferred-mrow-stretchy.html

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,26 @@
4646
<body>
4747
<div id="log"></div>
4848
<p>
49-
<math><mrow><mo id="moMrow">&#x21A8;</mo><mspace width="1px" height="100px" style="background: blue"></mspace></mrow></math>
50-
<math><msqrt><mo id="moSqrt">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace></msqrt></math>
51-
<math><mstyle><mo id="moStyle">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace></mstyle></math>
52-
<math><merror><mo id="moError">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace></merror></math>
53-
<math><mphantom><mo style="visibilty: visible;" id="moPhantom">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace></mphantom></math>
54-
<math><mo id="moMath">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace></math>
49+
<!-- mo operators below should stretch to cover the height of the mspace
50+
sibling. The mn element ensures its parent is not an embellished operator,
51+
so that this test really verifies the stretching is performed during the
52+
layout of the parent and not as part of the stretching of an embellished
53+
operator during the layout of the <math> ancestor. -->
54+
<math><mrow><mo id="moMrow">&#x21A8;</mo><mspace width="1px" height="100px" style="background: blue"></mspace><mn></mn></mrow></math>
55+
<math><msqrt><mo id="moSqrt">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace><mn></mn></msqrt></math>
56+
<math><mstyle><mo id="moStyle">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace><mn></mn></mstyle></math>
57+
<math><merror><mo id="moError">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace><mn></mn></merror></math>
58+
<math><mphantom><mo style="visibilty: visible;" id="moPhantom">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace><mn></mn></mphantom></math>
59+
<math><mo id="moMath">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace><mn></mn></math>
5560
<!-- menclose is treated as <unknown> in MathML Core -->
56-
<math><menclose notation="box"><mo id="moMenclose">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace></menclose></math>
57-
<math><mpadded lspace="10px"><mo id="moMpadded">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace></mpadded></math>
58-
<math><unknown><mo id="moUnknown">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace></unknown></math>
59-
<math><mtable><mtr><mtd><mo id="moMtd">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace></mtd></mtr></mtable></math>
60-
<math><none><mo id="moNone">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace></none></math>
61-
<math><mprescripts><mo id="moMprescripts">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace></mprescripts></math>
62-
<math><mfenced><mo id="moMfenced">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace></mfenced></math>
63-
<math><a><mo id="moA">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace></a></math>
61+
<math><menclose notation="box"><mo id="moMenclose">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace><mn></mn></menclose></math>
62+
<math><mpadded lspace="10px"><mo id="moMpadded">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace><mn></mn></mpadded></math>
63+
<math><unknown><mo id="moUnknown">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace><mn></mn></unknown></math>
64+
<math><mtable><mtr><mtd><mo id="moMtd">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace><mn></mn></mtd></mtr></mtable></math>
65+
<math><none><mo id="moNone">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace><mn></mn></none></math>
66+
<math><mprescripts><mo id="moMprescripts">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace><mn></mn></mprescripts></math>
67+
<math><mfenced><mo id="moMfenced">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace><mn></mn></mfenced></math>
68+
<math><a><mo id="moA">&#x21A8;</mo><mspace width="1px" height="100px" style="background: magenta"></mspace><mn></mn></a></math>
6469
</p>
6570
</body>
6671
</html>
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Stretching of core operator with various levels of nested mrows</title>
6+
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=236963">
7+
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=2020658">
8+
<link rel="help" href="https://w3c.github.io/mathml-core/#embellished-operators">
9+
<link rel="help" href="https://w3c.github.io/mathml-core/#layout-of-mrow">
10+
<link rel="help" href="https://w3c.github.io/mathml-core/#the-top-level-math-element">
11+
<link rel="help" href="https://w3c.github.io/mathml-core/#algorithm-for-stretching-operators-along-the-block-axis">
12+
<meta name="assert" content="Operators stretch with various levels of nested mrow.">
13+
<script src="/mathml/support/feature-detection.js"></script>
14+
<script src="/mathml/support/fonts.js"></script>
15+
<script src="/resources/testharness.js"></script>
16+
<script src="/resources/testharnessreport.js"></script>
17+
<style>
18+
mo {
19+
font-size: 10px;
20+
font-family: axisheight5000-verticalarrow14000;
21+
}
22+
@font-face {
23+
font-family: axisheight5000-verticalarrow14000;
24+
src: url("/fonts/math/axisheight5000-verticalarrow14000.woff");
25+
}
26+
</style>
27+
<script type="text/javascript">
28+
setup({ explicit_done: true });
29+
window.addEventListener("load", () => { loadAllFonts().then(runTests); });
30+
function runTests()
31+
{
32+
Array.from(document.querySelectorAll("[data-title]")).forEach(mo => {
33+
test(function() {
34+
assert_true(MathMLFeatureDetection.has_mspace());
35+
assert_greater_than_equal(mo.getBoundingClientRect().height, 100);
36+
}, `Vertical stretching performed for ${mo.dataset.title}.`);
37+
});
38+
done();
39+
}
40+
</script>
41+
</head>
42+
<body>
43+
<div id="log"></div>
44+
<p>
45+
<!-- The <math> element uses mrow layout. The <mo> child should stretch to
46+
at least the size of the <mspace> sibling.
47+
-->
48+
<math><mo data-title="math > mo">&#x21A8;</mo><mspace width="1px" height="100px" style="background: lightblue"></mspace></math>
49+
<math display="block"><mo data-title="Stretching for math[display=block] > mo">&#x21A8;</mo><mspace width="1px" height="100px" style="background: lightblue"></mspace></math>
50+
51+
<!-- The <mrow> child of the <math> element is an embellished operator. Per
52+
the "algorithm for stretching operators along the block axis", it
53+
should first be laid out with block stretch constraint (ascent=0,
54+
descent=0) and then laid out again with a stretch constraint that
55+
includes at least the size of the <mspace> descendant. So again the
56+
<mo> descendant should stretch at least to the size of the <mspace>.
57+
-->
58+
<math><mrow><mo data-title="math > mrow > mo">&#x21A8;</mo><mspace width="1px" height="100px" style="background: lightblue"></mspace></mrow></math>
59+
<math display="block"><mrow><mo data-title="Stretching for math[display=block] > mrow > mo">&#x21A8;</mo><mspace width="1px" height="100px" style="background: lightblue"></mspace></mrow></math>
60+
61+
<!-- Same with two nested <mrow>. -->
62+
<math><mrow><mrow><mo data-title="math > mrow > mrow > mo">&#x21A8;</mo><mspace width="1px" height="100px" style="background: lightblue"></mspace></mrow></mrow></math>
63+
<math display="block"><mrow><mrow><mo data-title="Stretching for math[display=block] > mrow > mrow > mo">&#x21A8;</mo><mspace width="1px" height="100px" style="background: lightblue"></mspace></mrow></mrow></math>
64+
65+
<!-- Same with three nested <mrow>. -->
66+
<math><mrow><mrow><mrow><mo data-title="math > mrow > mrow > mrow > mo">&#x21A8;</mo><mspace width="1px" height="100px" style="background: lightblue"></mspace></mrow></mrow></mrow></math>
67+
<math display="block"><mrow><mrow><mrow><mo data-title="Stretching for math[display=block] > mrow > mrow > mrow > mo">&#x21A8;</mo><mspace width="1px" height="100px" style="background: lightblue"></mspace></mrow></mrow></mrow></math>
68+
69+
<!-- Same with four nested <mrow>. -->
70+
<math><mrow><mrow><mrow><mrow><mo data-title="math > mrow > mrow > mrow > mrow > mo">&#x21A8;</mo><mspace width="1px" height="100px" style="background: lightblue"></mspace></mrow></mrow></mrow></mrow></math>
71+
<math display="block"><mrow><mrow><mrow><mrow><mo data-title="Stretching for math[display=block] > mrow > mrow > mrow > mrow > mo">&#x21A8;</mo><mspace width="1px" height="100px" style="background: lightblue"></mspace></mrow></mrow></mrow></mrow></math>
72+
</p>
73+
</body>
74+
</html>

0 commit comments

Comments
 (0)