Import WebKit tests for inferred mrow (baseline alignment, stretchy operators) (#16558)
Original tests:
https://trac.webkit.org/browser/webkit/trunk/LayoutTests/mathml/presentation/inferred-mrow-baseline.html
https://trac.webkit.org/browser/webkit/trunk/LayoutTests/mathml/presentation/inferred-mrow-stretchy.html
diff --git a/mathml/presentation-markup/mrow/inferred-mrow-baseline.html b/mathml/presentation-markup/mrow/inferred-mrow-baseline.html
new file mode 100644
index 0000000..0904d9f
--- /dev/null
+++ b/mathml/presentation-markup/mrow/inferred-mrow-baseline.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Baseline of inferred mrows</title>
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#mrow">
+<meta name="assert" content="Baseline for mrow-like elements is correct.">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script type="text/javascript">
+ setup({ explicit_done: true });
+ window.addEventListener("load", runTests);
+ function runTests()
+ {
+ ["Mrow", "Sqrt", "Style", "Error", "Phantom", "Math", "Menclose", "Mpadded"].forEach((tag) => {
+ var x = document.getElementById("above" + tag).getBoundingClientRect();
+ var y = document.getElementById("below" + tag).getBoundingClientRect();
+ test(function() {
+ assert_equals(x.bottom, y.top);
+ }, "baseline alignment inside " + tag);
+ });
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math><mrow><mspace id="aboveMrow" width="10px" height="30px" style="background: purple"></mspace><mspace id="belowMrow" width="10px" depth="30px" style="background: blue"></mspace></mrow></math>
+ <math><msqrt><mspace id="aboveSqrt" width="10px" height="30px" style="background: purple"></mspace><mspace id="belowSqrt" width="10px" depth="30px" style="background: blue"></mspace></msqrt></math>
+ <math><mstyle><mspace id="aboveStyle" width="10px" height="30px" style="background: purple"></mspace><mspace id="belowStyle" width="10px" depth="30px" style="background: blue"></mspace></mstyle></math>
+ <math><merror><mspace id="aboveError" width="10px" height="30px" style="background: purple"></mspace><mspace id="belowError" width="10px" depth="30px" style="background: blue"></mspace></merror></math>
+ <math><mphantom><mspace style="visibility: visible;" id="abovePhantom" width="10px" height="30px" style="background: purple"></mspace><mspace style="visibility: visible;" id="belowPhantom" width="10px" depth="30px" style="background: blue"></mspace></mphantom></math>
+ <math><mspace id="aboveMath" width="10px" height="30px" style="background: purple"></mspace><mspace id="belowMath" width="10px" depth="30px" style="background: blue"></mspace></math>
+ <math><menclose notation="box"><mspace id="aboveMenclose" width="10px" height="30px" style="background: purple"
+></mspace><mspace id="belowMenclose" width="10px" depth="30px" style="background: blue"></mspace></menclose></math>
+ <math><mpadded notation="box"><mspace id="aboveMpadded" width="10px" height="30px" style="background: purple"
+></mspace><mspace id="belowMpadded" width="10px" depth="30px" style="background: blue"></mspace></mpadded></math>
+ </p>
+</body>
+</html>
diff --git a/mathml/presentation-markup/mrow/inferred-mrow-stretchy.html b/mathml/presentation-markup/mrow/inferred-mrow-stretchy.html
new file mode 100644
index 0000000..f75726c
--- /dev/null
+++ b/mathml/presentation-markup/mrow/inferred-mrow-stretchy.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Stretchy in inferred mrows</title>
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#mrow">
+<meta name="assert" content="Baseline for mrow-like elements is correct.">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<style>
+ mo {
+ font-size: 10px;
+ font-family: axisheight5000-verticalarrow14000;
+ }
+ @font-face {
+ font-family: axisheight5000-verticalarrow14000;
+ src: url("/fonts/math/axisheight5000-verticalarrow14000.woff");
+ }
+</style>
+<script type="text/javascript">
+ setup({ explicit_done: true });
+ window.addEventListener("load", function() {
+ // Delay the check to workaround WebKit's bug https://webkit.org/b/174030.
+ requestAnimationFrame(() => { document.fonts.ready.then(runTests); });
+ });
+ function runTests()
+ {
+ ["Mrow", "Sqrt", "Style", "Error", "Phantom", "Math", "Menclose", "Mpadded"].forEach((tag) => {
+ var mo = document.getElementById("mo" + tag);
+ test(function() {
+ assert_greater_than_equal(mo.getBoundingClientRect().height, 100);
+ }, "operator stretching inside " + tag);
+ });
+ done();
+ }
+</script>
+</head>
+<body>
+ <div id="log"></div>
+ <p>
+ <math><mrow><mo id="moMrow">↨</mo><mspace width="1px" height="100px" style="background: blue"></mspace></mrow></math>
+ <math><msqrt><mo id="moSqrt">↨</mo><mspace width="1px" height="100px" style="background: magenta"></mspace></msqrt></math>
+ <math><mstyle><mo id="moStyle">↨</mo><mspace width="1px" height="100px" style="background: magenta"></mspace></mstyle></math>
+ <math><merror><mo id="moError">↨</mo><mspace width="1px" height="100px" style="background: magenta"></mspace></merror></math>
+ <math><mphantom><mo style="visibilty: visible;" id="moPhantom">↨</mo><mspace width="1px" height="100px" style="background: magenta"></mspace></mphantom></math>
+ <math><mo id="moMath">↨</mo><mspace width="1px" height="100px" style="background: magenta"></mspace></math>
+ <math><menclose notation="box"><mo id="moMenclose">↨</mo><mspace width="1px" height="100px" style="background: magenta"></mspace></menclose></math>
+ <math><mpadded notation="box"><mo id="moMpadded">↨</mo><mspace width="1px" height="100px" style="background: magenta"></mspace></mpadded></math>
+ </p>
+</body>
+</html>