summaryrefslogtreecommitdiffstats
path: root/layout/mathml/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /layout/mathml/tests
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/mathml/tests')
-rw-r--r--layout/mathml/tests/.eslintrc.js5
-rw-r--r--layout/mathml/tests/chrome.ini6
-rw-r--r--layout/mathml/tests/file_disabled_iframe.html33
-rw-r--r--layout/mathml/tests/mathml_example_test.html28
-rw-r--r--layout/mathml/tests/mochitest.ini14
-rw-r--r--layout/mathml/tests/stretchy-and-large-operators.html88
-rw-r--r--layout/mathml/tests/stretchy-and-large-operators.js289
-rw-r--r--layout/mathml/tests/test_bug330964.html98
-rw-r--r--layout/mathml/tests/test_bug553917.html223
-rw-r--r--layout/mathml/tests/test_bug706406.html71
-rw-r--r--layout/mathml/tests/test_bug827713-2.html149
-rw-r--r--layout/mathml/tests/test_bug827713.html63
-rw-r--r--layout/mathml/tests/test_bug975681.html123
-rw-r--r--layout/mathml/tests/test_disabled.html23
-rw-r--r--layout/mathml/tests/test_disabled_chrome.html51
-rw-r--r--layout/mathml/tests/test_opentype-axis-height.html58
-rw-r--r--layout/mathml/tests/test_opentype-limits.html68
17 files changed, 1390 insertions, 0 deletions
diff --git a/layout/mathml/tests/.eslintrc.js b/layout/mathml/tests/.eslintrc.js
new file mode 100644
index 0000000000..721e0938af
--- /dev/null
+++ b/layout/mathml/tests/.eslintrc.js
@@ -0,0 +1,5 @@
+"use strict";
+
+module.exports = {
+ extends: ["plugin:mozilla/mochitest-test", "plugin:mozilla/chrome-test"],
+};
diff --git a/layout/mathml/tests/chrome.ini b/layout/mathml/tests/chrome.ini
new file mode 100644
index 0000000000..0885f4c6b3
--- /dev/null
+++ b/layout/mathml/tests/chrome.ini
@@ -0,0 +1,6 @@
+[DEFAULT]
+
+support-files =
+ mathml_example_test.html
+
+[test_disabled_chrome.html]
diff --git a/layout/mathml/tests/file_disabled_iframe.html b/layout/mathml/tests/file_disabled_iframe.html
new file mode 100644
index 0000000000..24ff4847ae
--- /dev/null
+++ b/layout/mathml/tests/file_disabled_iframe.html
@@ -0,0 +1,33 @@
+<!doctype html>
+<script>
+window.is = window.parent.is;
+window.SimpleTest = window.parent.SimpleTest;
+</script>
+<div id="testnodes"><span>hi</span> there <!-- mon ami --></div>
+<pre id="test">
+<script>
+ let t = document.getElementById('testnodes');
+ t.innerHTML = null;
+ t.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "math:math"));
+ t.firstChild.textContent = "<foo>";
+ is(t.innerHTML, "<math:math>&lt;foo&gt;</math:math>");
+
+ t.innerHTML = null;
+ t.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "math"));
+ is(t.firstChild.namespaceURI, "http://www.w3.org/1998/Math/MathML");
+ t.firstChild.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "script"));
+ is(t.firstChild.firstChild.namespaceURI, "http://www.w3.org/1998/Math/MathML");
+ t.firstChild.firstChild.textContent = "1&2<3>4\xA0";
+ is(t.innerHTML, '<math><script>1&amp;2&lt;3&gt;4&nbsp;\u003C/script></math>');
+
+ t.innerHTML = null;
+ t.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "math"));
+ is(t.firstChild.namespaceURI, "http://www.w3.org/1998/Math/MathML");
+ t.firstChild.appendChild(document.createElementNS("http://www.w3.org/1998/Math/MathML", "style"));
+ is(t.firstChild.firstChild.namespaceURI, "http://www.w3.org/1998/Math/MathML");
+ t.firstChild.firstChild.textContent = "1&2<3>4\xA0";
+ is(t.innerHTML, '<math><style>1&amp;2&lt;3&gt;4&nbsp;\u003C/style></math>');
+
+ SimpleTest.finish();
+</script>
+</pre>
diff --git a/layout/mathml/tests/mathml_example_test.html b/layout/mathml/tests/mathml_example_test.html
new file mode 100644
index 0000000000..6eee75d013
--- /dev/null
+++ b/layout/mathml/tests/mathml_example_test.html
@@ -0,0 +1,28 @@
+<math xmlns="http://www.w3.org/1998/Math/MathML">
+ <mstyle scriptsizemultiplier="2">
+ <msub>
+ <mtext>O</mtext>
+ <mtext>O</mtext>
+ </msub>
+ <msup>
+ <mtext>O</mtext>
+ <mtext>O</mtext>
+ </msup>
+ <msubsup>
+ <mtext>O</mtext>
+ <mtext>O</mtext>
+ <mtext>O</mtext>
+ </msubsup>
+ <mmultiscripts>
+ <mtext>O</mtext>
+ <mtext>O</mtext>
+ <mtext>O</mtext>
+ <mprescripts/>
+ <mtext>O</mtext>
+ <mtext>O</mtext>
+ </mmultiscripts>
+ </mstyle>
+</math>
+
+<svg id="svgel">
+</svg>
diff --git a/layout/mathml/tests/mochitest.ini b/layout/mathml/tests/mochitest.ini
new file mode 100644
index 0000000000..381a3c3747
--- /dev/null
+++ b/layout/mathml/tests/mochitest.ini
@@ -0,0 +1,14 @@
+[DEFAULT]
+support-files =
+ file_disabled_iframe.html
+
+[test_bug330964.html]
+[test_bug553917.html]
+[test_bug706406.html]
+[test_bug827713-2.html]
+[test_bug827713.html]
+[test_bug975681.html]
+[test_disabled.html]
+[test_opentype-axis-height.html]
+[test_opentype-limits.html]
+skip-if = os == "win" # Fails on WinXP
diff --git a/layout/mathml/tests/stretchy-and-large-operators.html b/layout/mathml/tests/stretchy-and-large-operators.html
new file mode 100644
index 0000000000..13fe14aa71
--- /dev/null
+++ b/layout/mathml/tests/stretchy-and-large-operators.html
@@ -0,0 +1,88 @@
+<!-- -*- mode: HTML; tab-width: 2; indent-tabs-mode: nil; -*- -->
+<!-- vim: set tabstop=2 expandtab shiftwidth=2 textwidth=80: -->
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Test Stretchy and Large Operators</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+ <script type="text/javascript"
+ src="stretchy-and-large-operators.js"></script>
+ <script type="text/javascript">
+
+ var mathml = "http://www.w3.org/1998/Math/MathML";
+
+ function createMo(aOperator, aForm)
+ {
+ var mo = document.createElementNS(mathml, "mo");
+ mo.appendChild(document.createTextNode(aOperator));
+ mo.setAttribute("form", aForm);
+ return mo;
+ }
+
+ function createTest(aEntry)
+ {
+ var opname = aEntry[0];
+ var operator = aEntry[1];
+ var type = aEntry[2];
+ var form = aEntry[3];
+
+ var div = document.createElement("div");
+ div.appendChild(document.createTextNode(opname));
+
+ var math = document.createElementNS(mathml, "math");
+
+ switch (type)
+ {
+ case "l": // largeop
+ math.appendChild(createMo(operator, form));
+ var mstyle = document.createElementNS(mathml, "mstyle");
+ mstyle.setAttribute("displaystyle", "true");
+ mstyle.appendChild(createMo(operator, form));
+ math.appendChild(mstyle);
+ break;
+
+ case "v": // vertical
+ for (var i = 1; i < 10; i+=2) {
+ var mo = createMo(operator, form);
+ mo.setAttribute("minsize", (.5 * i) + "em");
+ math.appendChild(mo);
+ }
+ break;
+
+ case "h": // horizontal
+ for (var i = 1; i < 10; i+=2) {
+ var mo = createMo(operator, form);
+ var mspace = document.createElementNS(mathml, "mspace");
+ mspace.setAttribute("width", (.5 * i) + "em");
+ var mover = document.createElementNS(mathml, "mover");
+ mover.setAttribute("accent", "false");
+ mover.appendChild(mspace);
+ mover.appendChild(mo);
+ math.appendChild(mover);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ div.appendChild(math);
+ document.body.appendChild(div);
+ }
+
+ function init()
+ {
+ for (var i in stretchy_and_large_operators) {
+ createTest(stretchy_and_large_operators[i]);
+ }
+ }
+ </script>
+ </head>
+
+ <body onload="init()">
+
+ </body>
+</html>
diff --git a/layout/mathml/tests/stretchy-and-large-operators.js b/layout/mathml/tests/stretchy-and-large-operators.js
new file mode 100644
index 0000000000..113363b554
--- /dev/null
+++ b/layout/mathml/tests/stretchy-and-large-operators.js
@@ -0,0 +1,289 @@
+// This file is automatically generated. Do not edit.
+var stretchy_and_large_operators = [
+ ["\\u2194.infix: ", "\u2194", "h", "infix"],
+ ["\\u222E.prefix: ", "\u222E", "l", "prefix"],
+ ["\\u2A11.prefix: ", "\u2A11", "l", "prefix"],
+ ["\\u007E.infix: ", "\u007E", "h", "infix"],
+ ["\\u27F8.infix: ", "\u27F8", "h", "infix"],
+ ["\\u02CD.postfix: ", "\u02CD", "h", "postfix"],
+ ["\\u0028.prefix: ", "\u0028", "v", "prefix"],
+ ["\\u220F.prefix: ", "\u220F", "l", "prefix"],
+ ["\\u2225.postfix: ", "\u2225", "v", "postfix"],
+ ["\\u2A13.prefix: ", "\u2A13", "l", "prefix"],
+ ["\\u007C\u007C.infix: ", "\u007C\u007C", "v", "infix"],
+ ["\\u203E.postfix: ", "\u203E", "h", "postfix"],
+ ["\\u27EE.prefix: ", "\u27EE", "v", "prefix"],
+ ["\\u007C.prefix: ", "\u007C", "v", "prefix"],
+ ["\\u2A00.prefix: ", "\u2A00", "l", "prefix"],
+ ["\\u295A.infix: ", "\u295A", "h", "infix"],
+ ["\\u02C6.postfix: ", "\u02C6", "h", "postfix"],
+ ["\\u21E2.infix: ", "\u21E2", "h", "infix"],
+ ["\\u2961.infix: ", "\u2961", "v", "infix"],
+ ["\\u2998.postfix: ", "\u2998", "v", "postfix"],
+ ["\\u2197.infix: ", "\u2197", "v", "infix"],
+ ["\\u21BE.infix: ", "\u21BE", "v", "infix"],
+ ["\\u21A7.infix: ", "\u21A7", "v", "infix"],
+ ["\\u21C7.infix: ", "\u21C7", "h", "infix"],
+ ["\\u2A0D.prefix: ", "\u2A0D", "l", "prefix"],
+ ["\\u23E1.postfix: ", "\u23E1", "h", "postfix"],
+ ["\\u2A18.prefix: ", "\u2A18", "l", "prefix"],
+ ["\\u21A9.infix: ", "\u21A9", "h", "infix"],
+ ["\\u21F0.infix: ", "\u21F0", "h", "infix"],
+ ["\\u2016.prefix: ", "\u2016", "v", "prefix"],
+ ["\\u007D.postfix: ", "\u007D", "v", "postfix"],
+ ["\\u294E.infix: ", "\u294E", "h", "infix"],
+ ["\\u2A02.prefix: ", "\u2A02", "l", "prefix"],
+ ["\\u21D5.infix: ", "\u21D5", "v", "infix"],
+ ["\\u219E.infix: ", "\u219E", "h", "infix"],
+ ["\\u21EE.infix: ", "\u21EE", "v", "infix"],
+ ["\\u22C3.prefix: ", "\u22C3", "l", "prefix"],
+ ["\\u21C9.infix: ", "\u21C9", "h", "infix"],
+ ["\\u21A6.infix: ", "\u21A6", "h", "infix"],
+ ["\\u2044.infix: ", "\u2044", "v", "infix"],
+ ["\\u27F9.infix: ", "\u27F9", "h", "infix"],
+ ["\\u21A1.infix: ", "\u21A1", "v", "infix"],
+ ["\\u2953.infix: ", "\u2953", "h", "infix"],
+ ["\\u2195.infix: ", "\u2195", "v", "infix"],
+ ["\\u21E0.infix: ", "\u21E0", "h", "infix"],
+ ["\\u21E4.infix: ", "\u21E4", "h", "infix"],
+ ["\\u2987.prefix: ", "\u2987", "v", "prefix"],
+ ["\\u2A15.prefix: ", "\u2A15", "l", "prefix"],
+ ["\\u21FE.infix: ", "\u21FE", "h", "infix"],
+ ["\\u2225.prefix: ", "\u2225", "v", "prefix"],
+ ["\\u2233.prefix: ", "\u2233", "l", "prefix"],
+ ["\\u2772.prefix: ", "\u2772", "v", "prefix"],
+ ["\\u27FA.infix: ", "\u27FA", "h", "infix"],
+ ["\\u2230.prefix: ", "\u2230", "l", "prefix"],
+ ["\\u2960.infix: ", "\u2960", "v", "infix"],
+ ["\\u21AF.infix: ", "\u21AF", "v", "infix"],
+ ["\\u20E1.postfix: ", "\u20E1", "h", "postfix"],
+ ["\\u007C\u007C\u007C.postfix: ", "\u007C\u007C\u007C", "v", "postfix"],
+ ["\\u27FB.infix: ", "\u27FB", "h", "infix"],
+ ["\\u295C.infix: ", "\u295C", "v", "infix"],
+ ["\\u007C.postfix: ", "\u007C", "v", "postfix"],
+ ["\\u21D1.infix: ", "\u21D1", "v", "infix"],
+ ["\\u27F7.infix: ", "\u27F7", "h", "infix"],
+ ["\\u21B1.infix: ", "\u21B1", "v", "infix"],
+ ["\\u21EC.infix: ", "\u21EC", "v", "infix"],
+ ["\\u21CC.infix: ", "\u21CC", "h", "infix"],
+ ["\\u27E8.prefix: ", "\u27E8", "v", "prefix"],
+ ["\\u2990.postfix: ", "\u2990", "v", "postfix"],
+ ["\\u21B4.infix: ", "\u21B4", "h", "infix"],
+ ["\\u22C0.prefix: ", "\u22C0", "l", "prefix"],
+ ["\\u2951.infix: ", "\u2951", "v", "infix"],
+ ["\\u2AFF.prefix: ", "\u2AFF", "l", "prefix"],
+ ["\\u21B5.infix: ", "\u21B5", "v", "infix"],
+ ["\\u2215.infix: ", "\u2215", "v", "infix"],
+ ["\\u2988.postfix: ", "\u2988", "v", "postfix"],
+ ["\\u290D.infix: ", "\u290D", "h", "infix"],
+ ["\\u21C1.infix: ", "\u21C1", "h", "infix"],
+ ["\\u290B.infix: ", "\u290B", "v", "infix"],
+ ["\\u2A16.prefix: ", "\u2A16", "l", "prefix"],
+ ["\\u295E.infix: ", "\u295E", "h", "infix"],
+ ["\\u2950.infix: ", "\u2950", "h", "infix"],
+ ["\\u27EB.postfix: ", "\u27EB", "v", "postfix"],
+ ["\\u29FC.prefix: ", "\u29FC", "v", "prefix"],
+ ["\\u21A4.infix: ", "\u21A4", "h", "infix"],
+ ["\\u295D.infix: ", "\u295D", "v", "infix"],
+ ["\\u2A10.prefix: ", "\u2A10", "l", "prefix"],
+ ["\\u2199.infix: ", "\u2199", "h", "infix"],
+ ["\\u222C.prefix: ", "\u222C", "l", "prefix"],
+ ["\\u2959.infix: ", "\u2959", "v", "infix"],
+ ["\\u21EB.infix: ", "\u21EB", "v", "infix"],
+ ["\\u290C.infix: ", "\u290C", "h", "infix"],
+ ["\\u21E9.infix: ", "\u21E9", "v", "infix"],
+ ["\\u2A1A.prefix: ", "\u2A1A", "l", "prefix"],
+ ["\\u2913.infix: ", "\u2913", "v", "infix"],
+ ["\\u2910.infix: ", "\u2910", "h", "infix"],
+ ["\\uFE36.postfix: ", "\uFE36", "h", "postfix"],
+ ["\\u21B0.infix: ", "\u21B0", "v", "infix"],
+ ["\\u296E.infix: ", "\u296E", "v", "infix"],
+ ["\\u2500.infix: ", "\u2500", "h", "infix"],
+ ["\\u2308.prefix: ", "\u2308", "v", "prefix"],
+ ["\\u21A8.infix: ", "\u21A8", "v", "infix"],
+ ["\\u21C6.infix: ", "\u21C6", "h", "infix"],
+ ["\\u21DD.infix: ", "\u21DD", "h", "infix"],
+ ["\\u221A.prefix: ", "\u221A", "v", "prefix"],
+ ["\\u2994.postfix: ", "\u2994", "v", "postfix"],
+ ["\\u2296.prefix: ", "\u2296", "l", "prefix"],
+ ["\\u2985.prefix: ", "\u2985", "v", "prefix"],
+ ["\\u21F6.infix: ", "\u21F6", "h", "infix"],
+ ["\\u298B.prefix: ", "\u298B", "v", "prefix"],
+ ["\\u02C7.postfix: ", "\u02C7", "h", "postfix"],
+ ["\\u2223.prefix: ", "\u2223", "v", "prefix"],
+ ["\\u007C.infix: ", "\u007C", "v", "infix"],
+ ["\\u2A07.prefix: ", "\u2A07", "l", "prefix"],
+ ["\\u2A06.prefix: ", "\u2A06", "l", "prefix"],
+ ["\\u20D6.postfix: ", "\u20D6", "h", "postfix"],
+ ["\\u2A12.prefix: ", "\u2A12", "l", "prefix"],
+ ["\\u2223.postfix: ", "\u2223", "v", "postfix"],
+ ["\\u2958.infix: ", "\u2958", "v", "infix"],
+ ["\\u23DC.postfix: ", "\u23DC", "h", "postfix"],
+ ["\\u2986.postfix: ", "\u2986", "v", "postfix"],
+ ["\\u2B46.infix: ", "\u2B46", "h", "infix"],
+ ["\\u21FD.infix: ", "\u21FD", "h", "infix"],
+ ["\\u007C\u007C\u007C.prefix: ", "\u007C\u007C\u007C", "v", "prefix"],
+ ["\\u21D2.infix: ", "\u21D2", "h", "infix"],
+ ["\\u298C.postfix: ", "\u298C", "v", "postfix"],
+ ["\\u2912.infix: ", "\u2912", "v", "infix"],
+ ["\\u21EA.infix: ", "\u21EA", "v", "infix"],
+ ["\\u21BC.infix: ", "\u21BC", "h", "infix"],
+ ["\\u005B.prefix: ", "\u005B", "v", "prefix"],
+ ["\\u22C2.prefix: ", "\u22C2", "l", "prefix"],
+ ["\\u296F.infix: ", "\u296F", "v", "infix"],
+ ["\\u2B45.infix: ", "\u2B45", "h", "infix"],
+ ["\\u02F7.postfix: ", "\u02F7", "h", "postfix"],
+ ["\\u0332.postfix: ", "\u0332", "h", "postfix"],
+ ["\\u27FE.infix: ", "\u27FE", "h", "infix"],
+ ["\\u0029.postfix: ", "\u0029", "v", "postfix"],
+ ["\\u21C0.infix: ", "\u21C0", "h", "infix"],
+ ["\\u2A0F.prefix: ", "\u2A0F", "l", "prefix"],
+ ["\\u27E7.postfix: ", "\u27E7", "v", "postfix"],
+ ["\\u27ED.postfix: ", "\u27ED", "v", "postfix"],
+ ["\\u27E6.prefix: ", "\u27E6", "v", "prefix"],
+ ["\\u2995.prefix: ", "\u2995", "v", "prefix"],
+ ["\\u219F.infix: ", "\u219F", "v", "infix"],
+ ["\\u21AC.infix: ", "\u21AC", "h", "infix"],
+ ["\\u21A2.infix: ", "\u21A2", "h", "infix"],
+ ["\\u007B.prefix: ", "\u007B", "v", "prefix"],
+ ["\\u222D.prefix: ", "\u222D", "l", "prefix"],
+ ["\\u2A04.prefix: ", "\u2A04", "l", "prefix"],
+ ["\\u2A0C.prefix: ", "\u2A0C", "l", "prefix"],
+ ["\\u27FF.infix: ", "\u27FF", "h", "infix"],
+ ["\\uFE37.postfix: ", "\uFE37", "h", "postfix"],
+ ["\\u007C\u007C.prefix: ", "\u007C\u007C", "v", "prefix"],
+ ["\\u2A14.prefix: ", "\u2A14", "l", "prefix"],
+ ["\\u23DD.postfix: ", "\u23DD", "h", "postfix"],
+ ["\\u29FD.postfix: ", "\u29FD", "v", "postfix"],
+ ["\\u20D7.postfix: ", "\u20D7", "h", "postfix"],
+ ["\\u222F.prefix: ", "\u222F", "l", "prefix"],
+ ["\\u230A.prefix: ", "\u230A", "v", "prefix"],
+ ["\\u27FD.infix: ", "\u27FD", "h", "infix"],
+ ["\\u2AFC.prefix: ", "\u2AFC", "l", "prefix"],
+ ["\\u21E6.infix: ", "\u21E6", "h", "infix"],
+ ["\\u2210.prefix: ", "\u2210", "l", "prefix"],
+ ["\\u298E.postfix: ", "\u298E", "v", "postfix"],
+ ["\\u21E8.infix: ", "\u21E8", "h", "infix"],
+ ["\\u2A0B.prefix: ", "\u2A0B", "l", "prefix"],
+ ["\\u21D0.infix: ", "\u21D0", "h", "infix"],
+ ["\\u27EC.prefix: ", "\u27EC", "v", "prefix"],
+ ["\\u2996.postfix: ", "\u2996", "v", "postfix"],
+ ["\\u2A1C.prefix: ", "\u2A1C", "l", "prefix"],
+ ["\\uFE38.postfix: ", "\uFE38", "h", "postfix"],
+ ["\\u2A0E.prefix: ", "\u2A0E", "l", "prefix"],
+ ["\\u23DF.postfix: ", "\u23DF", "h", "postfix"],
+ ["\\u290F.infix: ", "\u290F", "h", "infix"],
+ ["\\u2954.infix: ", "\u2954", "v", "infix"],
+ ["\\u21DA.infix: ", "\u21DA", "h", "infix"],
+ ["\\u298A.postfix: ", "\u298A", "v", "postfix"],
+ ["\\u2232.prefix: ", "\u2232", "l", "prefix"],
+ ["\\u298D.prefix: ", "\u298D", "v", "prefix"],
+ ["\\u21F3.infix: ", "\u21F3", "v", "infix"],
+ ["\\u2980.postfix: ", "\u2980", "v", "postfix"],
+ ["\\u21B3.infix: ", "\u21B3", "v", "infix"],
+ ["\\u02DC.postfix: ", "\u02DC", "h", "postfix"],
+ ["\\u230B.postfix: ", "\u230B", "v", "postfix"],
+ ["\\u2A19.prefix: ", "\u2A19", "l", "prefix"],
+ ["\\u007C\u007C.postfix: ", "\u007C\u007C", "v", "postfix"],
+ ["\\u21CA.infix: ", "\u21CA", "v", "infix"],
+ ["\\u2231.prefix: ", "\u2231", "l", "prefix"],
+ ["\\u2A01.prefix: ", "\u2A01", "l", "prefix"],
+ ["\\u21E3.infix: ", "\u21E3", "v", "infix"],
+ ["\\u2192.infix: ", "\u2192", "h", "infix"],
+ ["\\u23E0.postfix: ", "\u23E0", "h", "postfix"],
+ ["\\u21A3.infix: ", "\u21A3", "h", "infix"],
+ ["\\u21D4.infix: ", "\u21D4", "h", "infix"],
+ ["\\u2957.infix: ", "\u2957", "h", "infix"],
+ ["\\u298F.prefix: ", "\u298F", "v", "prefix"],
+ ["\\u290A.infix: ", "\u290A", "v", "infix"],
+ ["\\u2989.prefix: ", "\u2989", "v", "prefix"],
+ ["\\u2297.prefix: ", "\u2297", "l", "prefix"],
+ ["\\u27EF.postfix: ", "\u27EF", "v", "postfix"],
+ ["\\u2991.prefix: ", "\u2991", "v", "prefix"],
+ ["\\u21B9.infix: ", "\u21B9", "h", "infix"],
+ ["\\u2295.prefix: ", "\u2295", "l", "prefix"],
+ ["\\u007E.postfix: ", "\u007E", "h", "postfix"],
+ ["\\u02C9.postfix: ", "\u02C9", "h", "postfix"],
+ ["\\u21C4.infix: ", "\u21C4", "h", "infix"],
+ ["\\u21BD.infix: ", "\u21BD", "h", "infix"],
+ ["\\u21D3.infix: ", "\u21D3", "v", "infix"],
+ ["\\u005F.infix: ", "\u005F", "h", "infix"],
+ ["\\u2A08.prefix: ", "\u2A08", "l", "prefix"],
+ ["\\u20D1.postfix: ", "\u20D1", "h", "postfix"],
+ ["\\u2196.infix: ", "\u2196", "v", "infix"],
+ ["\\u27E9.postfix: ", "\u27E9", "v", "postfix"],
+ ["\\u27F5.infix: ", "\u27F5", "h", "infix"],
+ ["\\u2980.prefix: ", "\u2980", "v", "prefix"],
+ ["\\u21B2.infix: ", "\u21B2", "v", "infix"],
+ ["\\u294F.infix: ", "\u294F", "v", "infix"],
+ ["\\u21C5.infix: ", "\u21C5", "v", "infix"],
+ ["\\u21DC.infix: ", "\u21DC", "h", "infix"],
+ ["\\u21E7.infix: ", "\u21E7", "v", "infix"],
+ ["\\u21ED.infix: ", "\u21ED", "v", "infix"],
+ ["\\u21C2.infix: ", "\u21C2", "v", "infix"],
+ ["\\u21E5.infix: ", "\u21E5", "h", "infix"],
+ ["\\u23B1.postfix: ", "\u23B1", "v", "postfix"],
+ ["\\u21C8.infix: ", "\u21C8", "v", "infix"],
+ ["\\u27FC.infix: ", "\u27FC", "h", "infix"],
+ ["\\u290E.infix: ", "\u290E", "h", "infix"],
+ ["\\u2955.infix: ", "\u2955", "v", "infix"],
+ ["\\u295B.infix: ", "\u295B", "h", "infix"],
+ ["\\u23DE.postfix: ", "\u23DE", "h", "postfix"],
+ ["\\u2997.prefix: ", "\u2997", "v", "prefix"],
+ ["\\u2983.prefix: ", "\u2983", "v", "prefix"],
+ ["\\u2309.postfix: ", "\u2309", "v", "postfix"],
+ ["\\u2A17.prefix: ", "\u2A17", "l", "prefix"],
+ ["\\u23B4.postfix: ", "\u23B4", "h", "postfix"],
+ ["\\u22C1.prefix: ", "\u22C1", "l", "prefix"],
+ ["\\u2190.infix: ", "\u2190", "h", "infix"],
+ ["\\u21F5.infix: ", "\u21F5", "v", "infix"],
+ ["\\u21BF.infix: ", "\u21BF", "v", "infix"],
+ ["\\u27F0.infix: ", "\u27F0", "v", "infix"],
+ ["\\uFE35.postfix: ", "\uFE35", "h", "postfix"],
+ ["\\u21A0.infix: ", "\u21A0", "h", "infix"],
+ ["\\u2211.prefix: ", "\u2211", "l", "prefix"],
+ ["\\u219D.infix: ", "\u219D", "h", "infix"],
+ ["\\u23B5.postfix: ", "\u23B5", "h", "postfix"],
+ ["\\u27F6.infix: ", "\u27F6", "h", "infix"],
+ ["\\u2299.prefix: ", "\u2299", "l", "prefix"],
+ ["\\u219C.infix: ", "\u219C", "h", "infix"],
+ ["\\u00AF.postfix: ", "\u00AF", "h", "postfix"],
+ ["\\u21EF.infix: ", "\u21EF", "v", "infix"],
+ ["\\u2191.infix: ", "\u2191", "v", "infix"],
+ ["\\u2A09.prefix: ", "\u2A09", "l", "prefix"],
+ ["\\u2A0A.prefix: ", "\u2A0A", "l", "prefix"],
+ ["\\u005F.postfix: ", "\u005F", "h", "postfix"],
+ ["\\u23B0.prefix: ", "\u23B0", "v", "prefix"],
+ ["\\u21C3.infix: ", "\u21C3", "v", "infix"],
+ ["\\u21A5.infix: ", "\u21A5", "v", "infix"],
+ ["\\u27EA.prefix: ", "\u27EA", "v", "prefix"],
+ ["\\u2773.postfix: ", "\u2773", "v", "postfix"],
+ ["\\u2016.infix: ", "\u2016", "v", "infix"],
+ ["\\u21CB.infix: ", "\u21CB", "h", "infix"],
+ ["\\u228E.prefix: ", "\u228E", "l", "prefix"],
+ ["\\u27F1.infix: ", "\u27F1", "v", "infix"],
+ ["\\u005E.postfix: ", "\u005E", "h", "postfix"],
+ ["\\u0302.postfix: ", "\u0302", "h", "postfix"],
+ ["\\u005D.postfix: ", "\u005D", "v", "postfix"],
+ ["\\u2952.infix: ", "\u2952", "h", "infix"],
+ ["\\u295F.infix: ", "\u295F", "h", "infix"],
+ ["\\u21AB.infix: ", "\u21AB", "h", "infix"],
+ ["\\u2992.postfix: ", "\u2992", "v", "postfix"],
+ ["\\u2016.postfix: ", "\u2016", "v", "postfix"],
+ ["\\u007C\u007C\u007C.infix: ", "\u007C\u007C\u007C", "v", "infix"],
+ ["\\u2A03.prefix: ", "\u2A03", "l", "prefix"],
+ ["\\u2193.infix: ", "\u2193", "v", "infix"],
+ ["\\u2956.infix: ", "\u2956", "h", "infix"],
+ ["\\u2984.postfix: ", "\u2984", "v", "postfix"],
+ ["\\u21AA.infix: ", "\u21AA", "h", "infix"],
+ ["\\u2A1B.prefix: ", "\u2A1B", "l", "prefix"],
+ ["\\u21E1.infix: ", "\u21E1", "v", "infix"],
+ ["\\u2198.infix: ", "\u2198", "h", "infix"],
+ ["\\u21AD.infix: ", "\u21AD", "h", "infix"],
+ ["\\u2A05.prefix: ", "\u2A05", "l", "prefix"],
+ ["\\u21DB.infix: ", "\u21DB", "h", "infix"],
+ ["\\u2993.prefix: ", "\u2993", "v", "prefix"],
+ ["\\u222B.prefix: ", "\u222B", "l", "prefix"],
+ ["\\u20D0.postfix: ", "\u20D0", "h", "postfix"],
+ ["\\u21FF.infix: ", "\u21FF", "h", "infix"],
+];
diff --git a/layout/mathml/tests/test_bug330964.html b/layout/mathml/tests/test_bug330964.html
new file mode 100644
index 0000000000..84da15194e
--- /dev/null
+++ b/layout/mathml/tests/test_bug330964.html
@@ -0,0 +1,98 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=330964
+-->
+<head>
+ <title>Test for Bug 706406</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=330964">Mozilla Bug 330964</a>
+<p id="display"></p>
+
+<math>
+ <mtable framespacing="7px 20px" frame="solid" rowspacing="11px 27px" columnspacing="5px 16px"
+ style="border-width: 2px;" id="mtable0">
+ <mtr>
+ <mtd id="mtd0">
+ <mn>X</mn>
+ </mtd>
+ <mtd id="mtd1">
+ <mn>X</mn>
+ </mtd>
+ <mtd id="mtd2">
+ <mn>X</mn>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd id="mtd3">
+ <mn>X</mn>
+ </mtd>
+ <mtd id="mtd4">
+ <mn>X</mn>
+ </mtd>
+ <mtd id="mtd5">
+ <mn>X</mn>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd id="mtd6">
+ <mn>X</mn>
+ </mtd>
+ <mtd id="mtd7">
+ <mn>X</mn>
+ </mtd>
+ <mtd id="mtd8">
+ <mn>X</mn>
+ </mtd>
+ </mtr>
+ </mtable>
+</math>
+
+<pre id="test">
+<script type="application/javascript">
+
+ var epsilon = 2;
+ function almostEqual(x, y) { return Math.abs(x - y) < epsilon; }
+
+ rectTable = $("mtable0").getBoundingClientRect();
+ rect0 = $("mtd0").getBoundingClientRect();
+ rect1 = $("mtd1").getBoundingClientRect();
+ rect2 = $("mtd2").getBoundingClientRect();
+ rect3 = $("mtd3").getBoundingClientRect();
+ rect4 = $("mtd4").getBoundingClientRect();
+ rect5 = $("mtd5").getBoundingClientRect();
+ rect6 = $("mtd6").getBoundingClientRect();
+ rect7 = $("mtd7").getBoundingClientRect();
+ rect8 = $("mtd8").getBoundingClientRect();
+ ok(almostEqual(rect1.left - rect0.right, 5), "columnspacing wonky");
+ ok(almostEqual(rect2.left - rect1.right, 16), "columnspacing wonky");
+ ok(almostEqual(rect4.left - rect3.right, 5), "columnspacing wonky");
+ ok(almostEqual(rect5.left - rect4.right, 16), "columnspacing wonky");
+ ok(almostEqual(rect7.left - rect6.right, 5), "columnspacing wonky");
+ ok(almostEqual(rect8.left - rect7.right, 16), "columnspacing wonky");
+ ok(almostEqual(rect3.top - rect0.bottom, 11), "rowspacing wonky");
+ ok(almostEqual(rect4.top - rect1.bottom, 11), "rowspacing wonky");
+ ok(almostEqual(rect5.top - rect2.bottom, 11), "rowspacing wonky");
+ ok(almostEqual(rect6.top - rect3.bottom, 27), "rowspacing wonky");
+ ok(almostEqual(rect7.top - rect4.bottom, 27), "rowspacing wonky");
+ ok(almostEqual(rect8.top - rect5.bottom, 27), "rowspacing wonky");
+ // Remember to subtract border
+ ok(almostEqual(rect0.left - rectTable.left - 2, 7), "framespacing left wonky");
+ ok(almostEqual(rect3.left - rectTable.left - 2, 7), "framespacing left wonky");
+ ok(almostEqual(rect6.left - rectTable.left - 2, 7), "framespacing left wonky");
+ ok(almostEqual(rect0.top - rectTable.top - 2, 20), "framespacing top wonky");
+ ok(almostEqual(rect1.top - rectTable.top - 2, 20), "framespacing top wonky");
+ ok(almostEqual(rect2.top - rectTable.top - 2, 20), "framespacing top wonky");
+ ok(almostEqual(rectTable.bottom - rect6.bottom - 2, 20), "framespacing bottom wonky");
+ ok(almostEqual(rectTable.bottom - rect7.bottom - 2, 20), "framespacing bottom wonky");
+ ok(almostEqual(rectTable.bottom - rect8.bottom - 2, 20), "framespacing bottom wonky");
+ ok(almostEqual(rectTable.right - rect2.right - 2, 7), "framespacing right wonky");
+ ok(almostEqual(rectTable.right - rect5.right - 2, 7), "framespacing right wonky");
+ ok(almostEqual(rectTable.right - rect8.right - 2, 7), "framespacing right wonky");
+</script>
+</pre>
+</body>
+</html>
diff --git a/layout/mathml/tests/test_bug553917.html b/layout/mathml/tests/test_bug553917.html
new file mode 100644
index 0000000000..ff996c96c7
--- /dev/null
+++ b/layout/mathml/tests/test_bug553917.html
@@ -0,0 +1,223 @@
+<!DOCTYPE HTML>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=553917
+-->
+<html>
+ <head>
+ <title>Test for Bug 553917</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+ <script type="application/javascript">
+ var stringBundleService =
+ SpecialPowers.Cc["@mozilla.org/intl/stringbundle;1"]
+ .getService(SpecialPowers.Ci.nsIStringBundleService);
+ var g_bundl =
+ stringBundleService.createBundle("chrome://global/locale/mathml/mathml.properties");
+
+ const allow_linethickness_names = !SpecialPowers.getBoolPref('mathml.mfrac_linethickness_names.disabled');
+ const allow_mathsize_names = !SpecialPowers.getBoolPref('mathml.mathsize_names.disabled');
+ const allow_mathspace_names = !SpecialPowers.getBoolPref('mathml.mathspace_names.disabled');
+ const allow_scriptsizemultiplier_attribute = !SpecialPowers.getBoolPref('mathml.scriptsizemultiplier_attribute.disabled');
+
+ var g_errorInfo = {
+ /*<math><mroot></mroot></math>
+ <math><msub></msub></math>
+ <math><msup></msup></math>
+ <math><mfrac></mfrac></math>
+ <math><msubsup></msubsup></math>
+ <math><munderover></munderover></math>*/
+ ChildCountIncorrect: {
+ status : [false, false, false, false, false, false],
+ args : [["mroot"], ["msub"], ["msup"], ["mfrac"], ["msubsup"], ["munderover"]] },
+ /*<math><mpadded width="BAD!"></mpadded></math>
+ <math><mpadded height="BAD!"></mpadded></math>
+ <math><mpadded voffset="BAD!"></mpadded></math>*/
+ AttributeParsingError: {
+ status: [false, false, false],
+ args: [["BAD!","width","mpadded"], ["BAD!","height","mpadded"], ["BAD!","voffset","mpadded"]]
+ },
+ /*<math scriptlevel="BAD!"></math>
+ <math scriptsizemultiplier="BAD!"></math>*/
+ AttributeParsingErrorNoTag: {
+ status: [false, !allow_scriptsizemultiplier_attribute],
+ args: [["BAD!","scriptlevel"], ["BAD!","scriptsizemultiplier"]]
+ },
+ /* <math><mo rspace="2..0px">+</mo></math>
+ <math><mo minsize="1.5notaunit">+</mo></math>
+ <math><mspace width="2"/></math>
+ <math><mo lspace="BADlspace">+</mo></math>
+ <math><mspace height="BADheight"/></math>
+ <math><mspace depth="BADdepth"/></math>
+ <math><mfrac linethickness="thin"><mn>1</mn><mn>2</mn></mfrac></math>
+ <math><mfrac linethickness="medium"><mn>1</mn><mn>2</mn></mfrac></math>
+ <math><mfrac linethickness="thick"><mn>1</mn><mn>2</mn></mfrac></math>
+ <math><mstyle mathsize="small"></mstyle></math>
+ <math><mstyle mathsize="normal"></mstyle></math>
+ <math><mstyle mathsize="big"></mstyle></math>
+ <math><mspace width="veryverythinmathspace"/></math>
+ <math><mspace width="verythinmathspace"/></math>
+ <math><mspace width="thinmathspace"/></math>
+ <math><mspace width="mediummathspace"/></math>
+ <math><mspace width="thickmathspace"/></math>
+ <math><mspace width="verythickmathspace"/></math>
+ <math><mspace width="veryverythickmathspace"/></math>
+ <math><mspace width="12345."/></math>
+ <math><mo minsize="17">+</mo></math>
+ */
+ LengthParsingError : {
+ status: [false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ allow_linethickness_names,
+ allow_linethickness_names,
+ allow_linethickness_names,
+ allow_mathsize_names,
+ allow_mathsize_names,
+ allow_mathsize_names,
+ allow_mathspace_names,
+ allow_mathspace_names,
+ allow_mathspace_names,
+ allow_mathspace_names,
+ allow_mathspace_names,
+ allow_mathspace_names,
+ allow_mathspace_names,
+ false,
+ false,
+ ],
+ args: [["2..0px"],
+ ["1.5notaunit"],
+ ["2"],
+ ["BADlspace"],
+ ["BADheight"],
+ ["BADdepth"],
+ ["thin"],
+ ["medium"],
+ ["thick"],
+ ["small"],
+ ["normal"],
+ ["big"],
+ ["veryverythinmathspace"],
+ ["verythinmathspace"],
+ ["thinmathspace"],
+ ["mediummathspace"],
+ ["thickmathspace"],
+ ["verythickmathspace"],
+ ["veryverythickmathspace"],
+ ["12345."],
+ ["17"]
+ ]
+ },
+ /*<math><mmultiscripts></mmultiscripts></math>
+ <math><mmultiscripts><mprescripts/><mprescripts/></mmultiscripts></math>
+ <math><mmultiscripts><mi>x</mi><mi>y</mi></mmultiscripts></math>*/
+ MMultiscriptsErrors: {
+ status: [false, false, false],
+ args: ["NoBase","DuplicateMprescripts", "SubSupMismatch"]
+ }};
+
+ var g_errorTypes = ["ChildCountIncorrect","AttributeParsingError",
+ "AttributeParsingErrorNoTag","LengthParsingError", "MMultiscriptsErrors"];
+
+ function getErrorMessage(name,idx)
+ {
+ if (name != "MMultiscriptsErrors") {
+ var formatParams = g_errorInfo[name].args[idx];
+ if (formatParams.length > 0) {
+ return g_bundl.formatStringFromName(name,formatParams);
+ }
+ return g_bundl.GetStringFromName(name);
+ }
+ return g_bundl.GetStringFromName(g_errorInfo[name].args[idx]);
+ }
+
+ /** Checks the roll call to see if all expected error messages were present. */
+ function processRollCall()
+ {
+ for (var i=0; i<g_errorTypes.length;i++) {
+ for (var j = 0; j < g_errorInfo[g_errorTypes[i]].status.length; j++) {
+ ok(g_errorInfo[g_errorTypes[i]].status[j],
+ "\"" + getErrorMessage(g_errorTypes[i], j)
+ + "\" was expected to be in the error console.");
+ }
+ }
+ }
+
+ /** Tests a candidate to see if it is one of the expected messages and updates the
+ g_errorInfo structure if it is. */
+ function doRollCall(msg)
+ {
+ for (var i = 0; i < g_errorTypes.length; i++) {
+ for (var j = 0; j < g_errorInfo[g_errorTypes[i]].status.length; j++) {
+ if (msg == getErrorMessage(g_errorTypes[i], j))
+ {
+ g_errorInfo[g_errorTypes[i]].status[j] = true;
+ }
+ }
+ }
+ }
+
+ SpecialPowers.registerConsoleListener(
+ function (msg) {
+ if (msg.message == "SENTINEL") {
+ processRollCall();
+ SimpleTest.finish();
+ } else if (msg.isScriptError) {
+ doRollCall(msg.errorMessage);
+ }
+ });
+
+ SimpleTest.waitForExplicitFinish();
+ </script>
+ </head>
+ <body onload="SpecialPowers.postConsoleSentinel();">
+ <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=553917">Mozilla Bug 553917</a>
+ <!-- ChildCountIncorrect -->
+ <math><mroot></mroot></math>
+ <math><msub></msub></math>
+ <math><msup></msup></math>
+ <math><mfrac></mfrac></math>
+ <math><msubsup></msubsup></math>
+ <math><munderover></munderover></math>
+
+ <!-- AttributeParsingError -->
+ <math><mpadded width="BAD!"></mpadded></math>
+ <math><mpadded height="BAD!"></mpadded></math>
+ <math><mpadded voffset="BAD!"></mpadded></math>
+
+ <!-- AttributeParsingErrorNoTag -->
+ <math scriptlevel="BAD!"></math>
+ <math scriptsizemultiplier="BAD!"></math>
+
+ <!-- LengthParsingError -->
+ <math><mo rspace="2..0px">+</mo></math>
+ <math><mo minsize="1.5notaunit">+</mo></math>
+ <math><mspace width="2"/></math>
+ <math><mo lspace="BADlspace">+</mo></math>
+ <math><mspace height="BADheight"/></math>
+ <math><mspace depth="BADdepth"/></math>
+ <math><mfrac linethickness="thin"><mn>1</mn><mn>2</mn></mfrac></math>
+ <math><mfrac linethickness="medium"><mn>1</mn><mn>2</mn></mfrac></math>
+ <math><mfrac linethickness="thick"><mn>1</mn><mn>2</mn></mfrac></math>
+ <math><mstyle mathsize="small"></mstyle></math>
+ <math><mstyle mathsize="normal"></mstyle></math>
+ <math><mstyle mathsize="big"></mstyle></math>
+ <math><mspace width="veryverythinmathspace"/></math>
+ <math><mspace width="verythinmathspace"/></math>
+ <math><mspace width="thinmathspace"/></math>
+ <math><mspace width="mediummathspace"/></math>
+ <math><mspace width="thickmathspace"/></math>
+ <math><mspace width="verythickmathspace"/></math>
+ <math><mspace width="veryverythickmathspace"/></math>
+ <math><mspace width="12345."/></math>
+ <math><mo minsize="17">+</mo></math>
+
+ <!-- MMultiscriptsErrors -->
+ <math><mmultiscripts></mmultiscripts></math>
+ <math><mmultiscripts><mprescripts/><mprescripts/></mmultiscripts></math>
+ <math><mmultiscripts><mi>x</mi><mi>y</mi></mmultiscripts></math>
+ </body>
+</html>
diff --git a/layout/mathml/tests/test_bug706406.html b/layout/mathml/tests/test_bug706406.html
new file mode 100644
index 0000000000..3bdd8e9fb4
--- /dev/null
+++ b/layout/mathml/tests/test_bug706406.html
@@ -0,0 +1,71 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=706406
+-->
+<head>
+ <title>Test for Bug 706406</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=706406">Mozilla Bug 706406</a>
+<p id="display"></p>
+<math xmlns="http://www.w3.org/1998/Math/MathML">
+ <maction actiontype="toggle" id="maction">
+ <mn>1</mn>
+ <mn>2</mn>
+ </maction>
+</math>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 706406 **/
+
+function doTest()
+{
+ function doStopPropagation(aEvent) {
+ aEvent.stopPropagation();
+ }
+
+ var maction = document.getElementById("maction");
+
+ synthesizeMouseAtCenter(maction, {});
+
+ is(maction.getAttribute("selection"), "2",
+ "maction's selection attribute isn't 2 by first click");
+
+ synthesizeMouseAtCenter(maction, {});
+
+ is(maction.getAttribute("selection"), "1",
+ "maction's selection attribute isn't 1 by second click");
+
+ window.addEventListener("mousedown", doStopPropagation, true);
+ window.addEventListener("mouseup", doStopPropagation, true);
+ window.addEventListener("click", doStopPropagation, true);
+
+ synthesizeMouseAtCenter(maction, {});
+
+ is(maction.getAttribute("selection"), "2",
+ "maction's selection attribute isn't 2 by first click called stopPropagation()");
+
+ synthesizeMouseAtCenter(maction, {});
+
+ is(maction.getAttribute("selection"), "1",
+ "maction's selection attribute isn't 1 by second click called stopPropagation()");
+
+ window.removeEventListener("mousedown", doStopPropagation, true);
+ window.removeEventListener("mouseup", doStopPropagation, true);
+ window.removeEventListener("click", doStopPropagation, true);
+
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.waitForFocus(doTest);
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/layout/mathml/tests/test_bug827713-2.html b/layout/mathml/tests/test_bug827713-2.html
new file mode 100644
index 0000000000..52666379dd
--- /dev/null
+++ b/layout/mathml/tests/test_bug827713-2.html
@@ -0,0 +1,149 @@
+<!DOCTYPE HTML>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=553917
+-->
+<html>
+ <head>
+ <title>Test for error handling aspect of Bug 827713</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+ <script type="application/javascript">
+
+ var stringBundleService =
+ SpecialPowers.Cc["@mozilla.org/intl/stringbundle;1"]
+ .getService(SpecialPowers.Ci.nsIStringBundleService);
+ var g_bundl =
+ stringBundleService.createBundle("chrome://global/locale/mathml/mathml.properties");
+
+ var g_errorInfo = {
+ InvalidChild: {
+ status : [false, false, false, false, false, false],
+ args : [["mprescripts", "msubsup"], ["mprescripts", "msubsup"],
+ ["mprescripts", "msub"], ["none", "msub"], ["none","msup"],
+ ["none","msubsup"]]
+ },
+
+ MMultiscriptsErrors: {
+ status: [false, false],
+ args: ["NoBase", "SubSupMismatch"]
+ }
+ };
+
+ var g_errorTypes = ["InvalidChild", "MMultiscriptsErrors"];
+
+ function getErrorMessage(name,idx)
+ {
+ if (name != "MMultiscriptsErrors") {
+ return g_bundl.formatStringFromName(name,g_errorInfo[name].args[idx]);
+ }
+ return g_bundl.GetStringFromName(g_errorInfo[name].args[idx]);
+ }
+
+ /** Checks the roll call to see if all expected error messages were present. */
+ function processRollCall()
+ {
+ for (var i=0; i<g_errorTypes.length;i++) {
+ for (var j = 0; j < g_errorInfo[g_errorTypes[i]].status.length; j++) {
+ ok(g_errorInfo[g_errorTypes[i]].status[j],
+ "\"" + getErrorMessage(g_errorTypes[i], j)
+ + "\" was expected to be in the error console.");
+ }
+ }
+ }
+
+ /** Tests a candidate to see if it is one of the expected messages and updates the
+ g_errorInfo structure if it is. */
+ function doRollCall(msg)
+ {
+ for (var i = 0; i < g_errorTypes.length; i++) {
+ for (var j = 0; j < g_errorInfo[g_errorTypes[i]].status.length; j++) {
+ if (msg == getErrorMessage(g_errorTypes[i], j))
+ {
+ g_errorInfo[g_errorTypes[i]].status[j] = true;
+ }
+ }
+ }
+ }
+
+ SpecialPowers.registerConsoleListener(
+ function (msg) {
+ if (msg.message == "SENTINEL") {
+ processRollCall();
+ SimpleTest.finish();
+ } else if (msg.isScriptError) {
+ doRollCall(msg.errorMessage);
+ }
+ });
+
+ SimpleTest.waitForExplicitFinish();
+ </script>
+ </head>
+ <body onload="SpecialPowers.postConsoleSentinel();">
+ <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=827713">Mozilla Bug 827713</a>
+
+ <!-- InvalidChild -->
+ <math>
+ <msubsup>
+ <mprescripts/>
+ </msubsup>
+ </math>
+
+ <math>
+ <msubsup>
+ <mprescripts/>
+ <mprescripts/>
+ </msubsup>
+ </math>
+
+ <math>
+ <msub>
+ <mtext>a</mtext>
+ <mprescripts/>
+ <mtext>a</mtext>
+ <mprescripts/>
+ </msub>
+ </math>
+
+ <math>
+ <msub>
+ <mtext>a</mtext>
+ <none/>
+ </msub>
+ </math>
+
+ <math>
+ <msup>
+ <mtext>a</mtext>
+ <none/>
+ </msup>
+ </math>
+
+ <math>
+ <msubsup>
+ <mtext>a</mtext>
+ <mtext>b</mtext>
+ <none/>
+ </msubsup>
+ </math>
+
+ <!-- NoBase -->
+ <math>
+ <mmultiscripts>
+ <none/>
+ <mtext>b</mtext>
+ <mtext>c</mtext>
+ </mmultiscripts>
+ </math>
+
+ <!-- SubSupMismatch -->
+ <math>
+ <mmultiscripts>
+ <mtext>b</mtext>
+ <mtext>c</mtext>
+ <mprescripts/>
+ <mtext>a</mtext>
+ </mmultiscripts>
+ </math>
+ </body>
+</html>
diff --git a/layout/mathml/tests/test_bug827713.html b/layout/mathml/tests/test_bug827713.html
new file mode 100644
index 0000000000..e7bf6b5d2e
--- /dev/null
+++ b/layout/mathml/tests/test_bug827713.html
@@ -0,0 +1,63 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=706406
+-->
+<head>
+ <title>Test for Bug 706406</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=827713">Mozilla Bug 827713</a>
+<p id="display"></p>
+ <p><math>
+ <msub subscriptshift="50px">
+ <mspace width="50px" height="25px" depth="25px" mathbackground="blue" id ="subbase"></mspace>
+ <mspace width="50px" height="25px" depth="25px" mathbackground="red" id="subsub"></mspace>
+ </msub>
+ </math></p>
+
+ <p><math>
+ <msup superscriptshift="50px">
+ <mspace width="50px" height="25px" depth="25px" mathbackground="blue" id="supbase"></mspace>
+ <mspace width="50px" height="25px" depth="25px" mathbackground="green" id="supsup"></mspace>
+ </msup>
+ </math></p>
+
+ <p><math>
+ <msubsup subscriptshift="50px" superscriptshift="50px">
+ <mspace width="50px" height="25px" depth="25px" mathbackground="blue" id="ssbase"></mspace>
+ <mspace width="50px" height="25px" depth="25px" mathbackground="red" id="sssub"></mspace>
+ <mspace width="50px" height="25px" depth="25px" mathbackground="green" id="sssup"></mspace>
+ </msubsup>
+ </math></p>
+<pre id="test">
+<script type="application/javascript">
+ /** Test for the scriptshift aspect of bug 827713 **/
+ SimpleTest.waitForExplicitFinish();
+
+ if (SpecialPowers.getBoolPref('mathml.script_shift_attributes.disabled')) {
+ ok(true, "Script shifts disabled");
+ } else {
+ subBaseRect = $("subbase").getBoundingClientRect();
+ subSubRect = $("subsub").getBoundingClientRect();
+ is(subBaseRect.bottom, subSubRect.top, "Bad subscript shift for msub");
+
+ supBaseRect = $("supbase").getBoundingClientRect();
+ supSupRect = $("supsup").getBoundingClientRect();
+ is(supBaseRect.top, supSupRect.bottom, "Bad superscript shift for msup");
+
+ ssBaseRect = $("ssbase").getBoundingClientRect();
+ ssSubRect = $("sssub").getBoundingClientRect();
+ ssSupRect = $("sssup").getBoundingClientRect();
+ is(ssBaseRect.bottom, ssSubRect.top, "Bad subscript shift for msubusp");
+ is(ssBaseRect.top, ssSupRect.bottom, "Bad superscript shift for msubusp");
+ }
+
+ SimpleTest.finish();
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/layout/mathml/tests/test_bug975681.html b/layout/mathml/tests/test_bug975681.html
new file mode 100644
index 0000000000..093f9ab387
--- /dev/null
+++ b/layout/mathml/tests/test_bug975681.html
@@ -0,0 +1,123 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=975681
+-->
+ <head>
+ <meta charset="utf-8">
+ <title> Test for Bug 975681 </title>
+ <script src="/tests/SimpleTest/SimpleTest.js"> </script>
+ <script src="/tests/SimpleTest/EventUtils.js"> </script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ </head>
+ <body>
+ <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=975681"> Mozilla Bug 975681 </a>
+ <p id="display"></p>
+
+ <p>
+ <math>
+ <mfrac id="test_mfrac">
+ <mspace width="100px" height="20px" mathbackground="red"></mspace>
+ <mspace width="100px" height="20px" mathbackground="red"></mspace>
+ </mfrac>
+ </math>
+ </p>
+
+ <p>
+ <math>
+ <mfrac linethickness="30px" id="mfrac_linethickness">
+ <mspace width="100px" height="20px" mathbackground="red"></mspace>
+ <mspace width="100px" height="20px" mathbackground="red"></mspace>
+ </mfrac>
+ </math>
+ </p>
+
+ <p>
+ <math>
+ <mfrac numalign="left" id="mfrac_numalign">
+ <mspace width="50px" height="20px" mathbackground="red"></mspace>
+ <mspace width="100px" height="20px" mathbackground="red"></mspace>
+ </mfrac>
+ </math>
+ </p>
+
+ <p>
+ <math>
+ <mfrac denomalign="right" id="mfrac_denomalign">
+ <mspace width="100px" height="20px" mathbackground="red"></mspace>
+ <mspace width="50px" height="20px" mathbackground="red"></mspace>
+ </mfrac>
+ </math>
+ </p>
+
+ <p>
+ <math>
+ <mfrac bevelled="true" id="mfrac_bevelled">
+ <mspace width="100px" height="20px" mathbackground="red"></mspace>
+ <mspace width="100px" height="20px" mathbackground="red"></mspace>
+ </mfrac>
+ </math>
+ </p>
+
+ <pre id="test">
+ <script type="application/javascript">
+ /** Test for Bug 975681 **/
+ SimpleTest.waitForExplicitFinish();
+ if (SpecialPowers.getBoolPref('mathml.mfrac_bevelled_attribute.disabled')) {
+ ok(true, "bevelled attribute disabled.")
+ } else {
+
+ var epsilon = 1; // allow a small relative error
+ var delta = .25; // used to indicate a small shift
+
+ function almostEqualAbs(x, y) {
+ var e = Math.abs(x - y);
+ return (e <= epsilon);
+ }
+
+ function almostLessThanAbs(x, y) {
+ var e = x - y;
+ return (e <= epsilon);
+ }
+
+ // test: mfrac
+ var mfracNum = document.getElementById("test_mfrac").firstElementChild.getBoundingClientRect();
+ var mfracDenom = document.getElementById("test_mfrac").lastElementChild.getBoundingClientRect();
+
+ ok(almostEqualAbs(mfracNum.left, mfracDenom.left) &&
+ almostEqualAbs(mfracNum.right, mfracDenom.right), "Numerator and denominator should be vertical aligned");
+
+ ok(almostLessThanAbs(mfracNum.bottom, mfracDenom.top), "Numerator should be above denominator");
+
+ // test: mfrac attributes
+ var mfrac = document.getElementById("mfrac_linethickness").getBoundingClientRect();
+ var num = document.getElementById("mfrac_linethickness").firstElementChild.getBoundingClientRect();
+ var denom = document.getElementById("mfrac_linethickness").lastElementChild.getBoundingClientRect();
+
+ ok(almostLessThanAbs(num.height + 30 + denom.height, mfrac.height) &&
+ almostLessThanAbs(num.bottom + 30, denom.top), "numerator and denominator should be separated by linethickness");
+
+ if (!SpecialPowers.getBoolPref('mathml.deprecated_alignment_attributes.disabled')) {
+ num = document.getElementById("mfrac_numalign").firstElementChild.getBoundingClientRect();
+ mfrac = document.getElementById("mfrac_numalign").getBoundingClientRect();
+
+ ok(almostEqualAbs(num.left, mfrac.left), "numerator should be aligned left");
+
+ mfrac = document.getElementById("mfrac_denomalign").getBoundingClientRect();
+ denom = document.getElementById("mfrac_denomalign").lastElementChild.getBoundingClientRect();
+
+ ok(almostEqualAbs(mfrac.right, denom.right), "denominator should be aligned right");
+ }
+
+ num = document.getElementById("mfrac_bevelled").firstElementChild.getBoundingClientRect();
+ denom = document.getElementById("mfrac_bevelled").lastElementChild.getBoundingClientRect();
+
+ ok(almostLessThanAbs(num.right, denom.left) &&
+ almostLessThanAbs(num.top*(1-delta)+num.bottom*delta, denom.top), "incorrect position of mfrac children");
+ }
+
+ SimpleTest.finish();
+
+ </script>
+ </body>
+</html>
diff --git a/layout/mathml/tests/test_disabled.html b/layout/mathml/tests/test_disabled.html
new file mode 100644
index 0000000000..f0c62ec994
--- /dev/null
+++ b/layout/mathml/tests/test_disabled.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+Copied from https://bugzilla.mozilla.org/show_bug.cgi?id=744830
+-->
+<head>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" href="/tests/SimpleTest/test.css">
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=166235">Mozilla Bug 166235</a>
+<iframe></iframe>
+<pre id="test">
+<script type="application/javascript">
+ SimpleTest.waitForExplicitFinish();
+ SpecialPowers.pushPrefEnv({"set": [["mathml.disabled", true]]}, function() {
+ document.querySelector('iframe').src = "file_disabled_iframe.html";
+ });
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/layout/mathml/tests/test_disabled_chrome.html b/layout/mathml/tests/test_disabled_chrome.html
new file mode 100644
index 0000000000..af97f2d430
--- /dev/null
+++ b/layout/mathml/tests/test_disabled_chrome.html
@@ -0,0 +1,51 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=744830
+-->
+<head>
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+<!--
+ <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
+-->
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=166235">Mozilla Bug 166235</a>
+<div id="testnodes"><span>hi</span> there <!-- mon ami --></div>
+<pre id="test">
+<script type="application/javascript">
+ add_task(async function() {
+ const initialPrefValue = SpecialPowers.getBoolPref("mathml.disabled");
+ SpecialPowers.setBoolPref("mathml.disabled", true);
+ const Cu = SpecialPowers.Components.utils;
+ const { ContentTaskUtils } = ChromeUtils.import("resource://testing-common/ContentTaskUtils.jsm");
+ let t = document.getElementById('testnodes');
+
+ let url = 'chrome://mochitests/content/chrome/layout/mathml/tests/mathml_example_test.html'
+ const chromeIframeEl = document.createElement('iframe');
+ let chromeLoadPromise = ContentTaskUtils.waitForEvent(chromeIframeEl, 'load', false);
+ chromeIframeEl.src = url;
+ t.appendChild(chromeIframeEl);
+
+ await chromeLoadPromise;
+ const chromeBR = chromeIframeEl.contentDocument.body.getBoundingClientRect();
+
+ url = "http://mochi.test:8888/chrome/layout/mathml/tests/mathml_example_test.html";
+ const iframeEl = document.createElement('iframe');
+ iframeEl.src = url;
+ let loadPromise = ContentTaskUtils.waitForEvent(iframeEl, 'load', false);
+ t.appendChild(iframeEl);
+ await loadPromise;
+
+ const contentBR = iframeEl.contentDocument.body.getBoundingClientRect();
+
+ ok(chromeBR.height > contentBR.height, "Chrome content height should be bigger than content due to layout");
+
+ SpecialPowers.setBoolPref("mathml.disabled", initialPrefValue);
+ });
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/layout/mathml/tests/test_opentype-axis-height.html b/layout/mathml/tests/test_opentype-axis-height.html
new file mode 100644
index 0000000000..f65e276253
--- /dev/null
+++ b/layout/mathml/tests/test_opentype-axis-height.html
@@ -0,0 +1,58 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Open Type MATH - axis-height</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <meta charset="utf-8"/>
+ <style type="text/css">
+ math {
+ font-size: 10px;
+ }
+ @font-face {
+ font-family: axis-height-1;
+ src: url(/tests/fonts/math/axis-height-1.otf);
+ }
+ @font-face {
+ font-family: axis-height-2;
+ src: url(/tests/fonts/math/axis-height-2.otf);
+ }
+ </style>
+ <script type="application/javascript">
+ SimpleTest.waitForExplicitFinish();
+
+ var epsilon = 5;
+ function almostEqual(x, y) { return Math.abs(x - y) < epsilon; }
+
+ function getBox(aId) {
+ return document.getElementById(aId).getBoundingClientRect();
+ }
+
+ function doTest() {
+ ok(almostEqual(getBox("plus1").top - getBox("plus2").top, 10 * 20),
+ "Bad AxisHeight");
+
+ SimpleTest.finish();
+ }
+ </script>
+ </head>
+ <body onload="doTest()">
+ <a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=961365">
+ Mozilla Bug 961365
+ </a>
+
+ <p id="display"></p>
+
+ <p>
+ <math style="font-family: axis-height-1;">
+ <mo id="plus1">+</mo>
+ </math>
+ <math style="font-family: axis-height-2;">
+ <mo id="plus2">+</mo>
+ </math>
+ </p>
+
+ </body>
+</html>
diff --git a/layout/mathml/tests/test_opentype-limits.html b/layout/mathml/tests/test_opentype-limits.html
new file mode 100644
index 0000000000..56d30fd738
--- /dev/null
+++ b/layout/mathml/tests/test_opentype-limits.html
@@ -0,0 +1,68 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Open Type MATH - limits</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <meta charset="utf-8"/>
+ <style type="text/css">
+ math {
+ font-size: 10px;
+ }
+ @font-face {
+ font-family: limits-5;
+ src: url(/tests/fonts/math/limits-5.otf);
+ }
+ </style>
+ <script type="text/javascript">
+ SimpleTest.waitForExplicitFinish();
+
+ var epsilon = 5;
+ function almostEqual(x, y) { return Math.abs(x - y) < epsilon; }
+
+ function getBox(aId) {
+ return document.getElementById(aId).getBoundingClientRect();
+ }
+
+ function doTest() {
+ ok(almostEqual(getBox("base9").top - getBox("over9").bottom,
+ (6 - 2) * 10) &&
+ almostEqual(getBox("base10").top - getBox("over10").bottom,
+ (6 - 2) * 10),
+ "Bad AccentBaseHeight");
+
+ SimpleTest.finish();
+ }
+ </script>
+ </head>
+ <body onload="doTest()">
+
+ <a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=961365">
+ Mozilla Bug 961365
+ </a>
+
+ <p id="display"></p>
+
+ <p>
+ <math style="font-family: limits-5;" displaystyle="true">
+ <mspace id="ref5" height="1em" width="1em" mathbackground="green"/>
+ </math>
+ <math style="font-family: limits-5;" displaystyle="true">
+ <mover>
+ <mspace id="base9" height="2em" width="2em" mathbackground="blue"/>
+ <mo id="over9" stretchy="false">~</mo>
+ </mover>
+ </math>
+ <math style="font-family: limits-5;" displaystyle="true">
+ <munderover>
+ <mspace id="base10" height="2em" width="2em" mathbackground="blue"/>
+ <mspace id="under10" height="1em" width="1em" mathbackground="red"/>
+ <mo id="over10" stretchy="false">~</mo>
+ </munderover>
+ </math>
+ </p>
+
+ </body>
+</html>