| Index: third_party/WebKit/LayoutTests/imported/wpt/mathml/presentation-markup/scripts/subsup-2.html
|
| diff --git a/third_party/WebKit/LayoutTests/imported/wpt/mathml/presentation-markup/scripts/subsup-2.html b/third_party/WebKit/LayoutTests/imported/wpt/mathml/presentation-markup/scripts/subsup-2.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..abef28d12df64ffac355fd627fe2493ae7b43ff9
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/imported/wpt/mathml/presentation-markup/scripts/subsup-2.html
|
| @@ -0,0 +1,163 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<head>
|
| +<meta charset="utf-8">
|
| +<title>Subscripts and Superscripts metrics</title>
|
| +<link rel="help" href="http://www.mathml-association.org/MathMLinHTML5/S3.html#SS4">
|
| +<meta name="assert" content="Basic metrics for the mmultiscript element.">
|
| +<script src="/resources/testharness.js"></script>
|
| +<script src="/resources/testharnessreport.js"></script>
|
| +<style>
|
| + math, mspace {
|
| + font-size: 10px;
|
| + }
|
| +</style>
|
| +<script>
|
| + /* This test does not use any specific fonts and so the exact rules are not
|
| + specified precisely. We assume reasonable values for script shifts and
|
| + spacing. */
|
| +
|
| + function getBox(aId) {
|
| + var box = document.getElementById(aId).getBoundingClientRect();
|
| + box.middle = (box.bottom + box.top) / 2;
|
| + return box;
|
| + }
|
| +
|
| + setup({ explicit_done: true });
|
| + window.addEventListener("load", runTests);
|
| +
|
| + function runTests() {
|
| + test(function() {
|
| + var e = 1;
|
| + assert_less_than_equal(getBox("msubBase").right, getBox("msubSub").left, e, "subscript is after base");
|
| + assert_less_than_equal(getBox("msupBase").right, getBox("msupSup").left, e, "superscript is after base");
|
| + assert_less_than_equal(getBox("msubsupBase").right, getBox("msubsupSub").left, e, "subscript is after base");
|
| + assert_less_than_equal(getBox("msubsupBase").right, getBox("msubsupSup").left, e, "superscript is after base");
|
| +
|
| + assert_greater_than_equal(getBox("premsubBase").right, getBox("premsubSub").left, e, "subscript is before base");
|
| + assert_greater_than_equal(getBox("premsupBase").right, getBox("premsupSup").left, e, "superscript is before base");
|
| + assert_greater_than_equal(getBox("premsubsupBase").right, getBox("premsubsupSub").left, e, "subscript is before base");
|
| + assert_greater_than_equal(getBox("premsubsupBase").right, getBox("premsubsupSup").left, e, "superscript is before base");
|
| +
|
| + e = 3;
|
| + assert_approx_equals(getBox("msubBase").right, getBox("msubSub").left, e, "msub: space between base and subscript is small");
|
| + assert_approx_equals(getBox("msubBase").right, getBox("msubSub").left, e, "msub: subscript is after base");
|
| + assert_approx_equals(getBox("msupBase").right, getBox("msupSup").left, e, "msup: superscript is after base");
|
| + assert_approx_equals(getBox("msubsupBase").right, getBox("msubsupSub").left, e, "msubsup: subscript is after base");
|
| + assert_approx_equals(getBox("msubsupBase").right, getBox("msubsupSup").left, e, "msubsup: superscript is after base");
|
| +
|
| + assert_approx_equals(getBox("premsubBase").left, getBox("premsubSub").right, e, "msub: space between base and subscript is small");
|
| + assert_approx_equals(getBox("premsubBase").left, getBox("premsubSub").right, e, "msub: subscript is after base");
|
| + assert_approx_equals(getBox("premsupBase").left, getBox("premsupSup").right, e, "msup: superscript is after base");
|
| + assert_approx_equals(getBox("premsubsupBase").left, getBox("premsubsupSub").right, e, "msubsup: subscript is after base");
|
| + assert_approx_equals(getBox("premsubsupBase").left, getBox("premsubsupSup").right, e, "msubsup: superscript is after base");
|
| + }, "Respective horizontal positions");
|
| +
|
| + test(function() {
|
| + var e = 1;
|
| + assert_approx_equals(getBox("msubBase").middle, getBox("baseline").bottom, e, "base is placed on the baseline");
|
| + assert_approx_equals(getBox("msupBase").middle, getBox("baseline").bottom, e, "base is placed on the baseline");
|
| + assert_approx_equals(getBox("msubsupBase").middle, getBox("baseline").bottom, e, "base is placed on the baseline");
|
| + assert_approx_equals(getBox("premsubBase").middle, getBox("baseline").bottom, e, "base is placed on the baseline");
|
| + assert_approx_equals(getBox("premsupBase").middle, getBox("baseline").bottom, e, "base is placed on the baseline");
|
| + assert_approx_equals(getBox("premsubsupBase").middle, getBox("baseline").bottom, e, "base is placed on the baseline");
|
| + }, "Alignment of the base on the baseline");
|
| +
|
| + test(function() {
|
| + var e = 3;
|
| + assert_approx_equals(getBox("msubSub").middle, getBox("msubBase").bottom, e, "script is placed at the bottom of the base");
|
| + assert_approx_equals(getBox("msupSup").middle, getBox("msupBase").top, e, "script is placed at the top of the base");
|
| + assert_approx_equals(getBox("msubsupSub").middle, getBox("msubsupBase").bottom, e, "script is placed at the bottom of the base");
|
| + assert_approx_equals(getBox("msubsupSup").middle, getBox("msubsupBase").top, e, "script is placed at the top of the base");
|
| +
|
| + assert_approx_equals(getBox("premsubSub").middle, getBox("premsubBase").bottom, e, "script is placed at the bottom of the base");
|
| + assert_approx_equals(getBox("premsupSup").middle, getBox("premsupBase").top, e, "script is placed at the top of the base");
|
| + assert_approx_equals(getBox("premsubsupSub").middle, getBox("premsubsupBase").bottom, e, "script is placed at the bottom of the base");
|
| + assert_approx_equals(getBox("premsubsupSup").middle, getBox("premsubsupBase").top, e, "script is placed at the top of the base");
|
| + }, "Vertical position of scripts");
|
| +
|
| + test(function() {
|
| + var e = 3;
|
| + assert_approx_equals(getBox("msub").width, getBox("msubSub").right - getBox("msubBase").left, e, "width is determined by the left/right sides of base/script (+ some space after script)");
|
| + assert_approx_equals(getBox("msup").width, getBox("msupSup").right - getBox("msupBase").left, e, "width is determined by the left/right sides of base/script (+ some space after script)");
|
| + assert_approx_equals(getBox("msubsup").width, Math.max(getBox("msubsupSub").right, getBox("msubsupSup").right) - getBox("msubsupBase").left, e, "width is determined by the left/right sides of base/scripts (+ some space after script)");
|
| +
|
| + assert_approx_equals(getBox("premsub").width, getBox("premsubBase").right - getBox("premsubSub").left, e, "width is determined by the right/left sides of base/script (+ some space after script)");
|
| + assert_approx_equals(getBox("premsup").width, getBox("premsupBase").right - getBox("premsupSup").left, e, "width is determined by the right/left sides of base/script (+ some space after script)");
|
| + assert_approx_equals(getBox("premsubsup").width, getBox("premsubsupBase").right - Math.min(getBox("premsubsupSub").left, getBox("premsubsupSup").left), e, "width is determined by the right/left sides of base/scripts (+ some space after script)");
|
| + }, "Width of scripted elements");
|
| +
|
| + test(function() {
|
| + var e = 1;
|
| + assert_greater_than_equal(getBox("msub").height, getBox("msubBase").height, e, "height is at least the one of the base");
|
| + assert_greater_than_equal(getBox("msup").height, getBox("msupBase").height, e, "height is at least the one of the base");
|
| + assert_greater_than_equal(getBox("msubsup").height, getBox("msubsupBase").height, e, "height is at least the one of the base");
|
| + assert_greater_than_equal(getBox("premsub").height, getBox("premsubBase").height, e, "height is at least the one of the base");
|
| + assert_greater_than_equal(getBox("premsup").height, getBox("premsupBase").height, e, "height is at least the one of the base");
|
| + assert_greater_than_equal(getBox("premsubsup").height, getBox("premsubsupBase").height, e, "height is at least the one of the base");
|
| +
|
| + e = 3;
|
| + assert_approx_equals(getBox("msub").height, Math.max(getBox("msubSub").bottom, getBox("msubBase").bottom) - getBox("msubBase").top, e, "msub height is determined by the top/bottom sides of base/scripts");
|
| + assert_approx_equals(getBox("msup").height, getBox("msupBase").bottom - Math.min(getBox("msupSup").top, getBox("msupBase").top), e, "msup height is determined by the top/bottom sides of base/scripts");
|
| + assert_approx_equals(getBox("msubsup").height, Math.max(getBox("msubSub").bottom, getBox("msubBase").bottom) - Math.min(getBox("msupSup").top, getBox("msupBase").top), e, "msubsup height is determined by the top/bottom sides of base/scripts");
|
| + assert_approx_equals(getBox("premsub").height, Math.max(getBox("premsubSub").bottom, getBox("premsubBase").bottom) - getBox("premsubBase").top, e, "msub height is determined by the top/bottom sides of base/scripts");
|
| + assert_approx_equals(getBox("premsup").height, getBox("premsupBase").bottom - Math.min(getBox("premsupSup").top, getBox("premsupBase").top), e, "msup height is determined by the top/bottom sides of base/scripts");
|
| + assert_approx_equals(getBox("premsubsup").height, Math.max(getBox("premsubSub").bottom, getBox("premsubBase").bottom) - Math.min(getBox("premsupSup").top, getBox("premsupBase").top), e, "msubsup height is determined by the top/bottom sides of base/scripts");
|
| + }, "Height of scripted elements");
|
| +
|
| + test(function() {
|
| + ["none", "mprescripts"].forEach(function(name) {
|
| + var elements = document.getElementsByTagName(name);
|
| + for (var i = 0; i < elements.length; i++) {
|
| + var box = elements[i].getBoundingClientRect();
|
| + assert_equals(box.height * box.width, 0, "<" + name + "> " + i + " has zero is empty");
|
| + }
|
| + });
|
| + }, "Size of empty elements");
|
| +
|
| + done();
|
| + }
|
| +</script>
|
| +</head>
|
| +<body>
|
| + <p>
|
| + <math>
|
| + <mspace id="baseline" width="30px" height="2px" depth="0px" mathbackground="blue"/>
|
| + <mmultiscripts id="msub" mathbackground="green">
|
| + <mspace id="msubBase" width="30px" height="15px" depth="15px" mathbackground="black"/>
|
| + <mspace id="msubSub" width="10px" height="5px" depth="5px" mathbackground="black"/>
|
| + <none/>
|
| + </mmultiscripts>
|
| + <mmultiscripts id="msup" mathbackground="green">
|
| + <mspace id="msupBase" width="30px" height="15px" depth="15px" mathbackground="black"/>
|
| + <none/>
|
| + <mspace id="msupSup" width="10px" height="5px" depth="5px" mathbackground="black"/>
|
| + </mmultiscripts>
|
| + <mmultiscripts id="msubsup" mathbackground="green">
|
| + <mspace id="msubsupBase" width="30px" height="15px" depth="15px" mathbackground="black"/>
|
| + <mspace id="msubsupSub" width="10px" height="5px" depth="5px" mathbackground="black"/>
|
| + <mspace id="msubsupSup" width="10px" height="5px" depth="5px" mathbackground="black"/>
|
| + </mmultiscripts>
|
| + <mmultiscripts id="premsub" mathbackground="green">
|
| + <mspace id="premsubBase" width="30px" height="15px" depth="15px" mathbackground="black"/>
|
| + <mprescripts/>
|
| + <mspace id="premsubSub" width="10px" height="5px" depth="5px" mathbackground="black"/>
|
| + <none/>
|
| + </mmultiscripts>
|
| + <mmultiscripts id="premsup" mathbackground="green">
|
| + <mspace id="premsupBase" width="30px" height="15px" depth="15px" mathbackground="black"/>
|
| + <mprescripts/>
|
| + <none/>
|
| + <mspace id="premsupSup" width="10px" height="5px" depth="5px" mathbackground="black"/>
|
| + </mmultiscripts>
|
| + <mmultiscripts id="premsubsup" mathbackground="green">
|
| + <mspace id="premsubsupBase" width="30px" height="15px" depth="15px" mathbackground="black"/>
|
| + <mprescripts/>
|
| + <mspace id="premsubsupSub" width="10px" height="5px" depth="5px" mathbackground="black"/>
|
| + <mspace id="premsubsupSup" width="10px" height="5px" depth="5px" mathbackground="black"/>
|
| + </mmultiscripts>
|
| + </math>
|
| + </p>
|
| + <hr/>
|
| +</body>
|
| +</html>
|
|
|