Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/mathml/presentation-markup/scripts/subsup-5.html

Issue 2425083003: Import wpt@4114c724042b41e257caab98f3eb23c143b50de4 (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <title>Subscripts and Superscripts metrics</title>
6 <link rel="help" href="http://www.mathml-association.org/MathMLinHTML5/S3.html#S S4">
7 <meta name="assert" content="Verify metrics of scripted elements with tall scrip ts.">
8 <script src="/resources/testharness.js"></script>
9 <script src="/resources/testharnessreport.js"></script>
10 <style>
11 math, mspace {
12 font-size: 10px;
13 }
14 </style>
15 <script>
16 /* This test does not use any specific fonts and so the exact rules are not
17 specified precisely. We assume reasonable values for script shifts and
18 spacing. */
19
20 function getBox(aId) {
21 var box = document.getElementById(aId).getBoundingClientRect();
22 box.middle = (box.bottom + box.top) / 2;
23 return box;
24 }
25
26 setup({ explicit_done: true });
27 window.addEventListener("load", runTests);
28
29 var sizeArray = [50, 75, 100];
30
31 function runTests() {
32 test(function() {
33 var e = 1;
34 assert_approx_equals(getBox("msubbase").middle, getBox("baseline").bottom , e, "msub base is placed on the baseline");
35 assert_approx_equals(getBox("msupbase").middle, getBox("baseline").bottom , e, "msup base is placed on the baseline");
36 assert_approx_equals(getBox("msubsupbase").middle, getBox("baseline").bot tom, e, "msubsup base is placed on the baseline");
37 assert_approx_equals(getBox("multibase").middle, getBox("baseline").botto m, e, "mmultiscripts baseis placed on the baseline");
38 }, "Alignment on the baseline with different and large script heights");
39
40 test(function() {
41 assert_greater_than(getBox("msubsub").top, getBox("msubbase").top, "msub: subscript is below the top of the base");
42 assert_less_than(getBox("msupsup").bottom, getBox("msupbase").bottom, "msu p: supscript is above the bottom of the base");
43 assert_greater_than(getBox("msubsupsub").top, getBox("msubsupbase").top, " msubsup: subscript is below the top of the base");
44 assert_less_than(getBox("msubsupsup").bottom, getBox("msubsupbase").bottom , "msubsup: supscript is above the bottom of the base");
45 assert_greater_than(getBox("multipostsub").top, getBox("multibase").top, " mmultiscripts: postsubscript is below the top of the base");
46 assert_less_than(getBox("multipostsup").bottom, getBox("multibase").bottom , "mmultiscripts: postsupscript is above the bottom of the base");
47 assert_greater_than(getBox("multipresub").top, getBox("multibase").top, "m multiscripts: presubscript is below the top of the base");
48 assert_less_than(getBox("multipresup").bottom, getBox("multibase").bottom, "mmultiscripts: presupscript is above the bottom of the base");
49 }, "Tall subscripts/superscripts are not placed too high/low");
50
51 test(function() {
52 assert_greater_than(getBox("msubsupsub").top, getBox("msubsupsup").bottom, "msubsup: subscript is below the superscript");
53 assert_greater_than(getBox("multipresub").top, getBox("multipresup").botto m, "mmultiscripts: presubscript is below the presuperscript");
54 assert_greater_than(getBox("multipostsub").top, getBox("multipostsup").bot tom, "mmultiscripts: postsubscript is below the postsuperscript");
55 }, "No collisions for tall subscripts and superscripts");
56
57 done();
58 }
59 </script>
60 </head>
61 <body>
62 <p>
63 <math>
64 <mspace id="baseline" width="30px" height="2px" depth="0px" mathbackground ="blue"/>
65 <msub id="msub">
66 <mspace id="msubbase" width="30px" height="15px" depth="15px" mathbackgr ound="black"/>
67 <mspace id="msubsub" width="10px" height="50px" depth="50px" mathbackgro und="black"/>
68 </msub>
69 <msup id="msup">
70 <mspace id="msupbase" width="30px" height="15px" depth="15px" mathbackgr ound="black"/>
71 <mspace id="msupsup" width="10px" height="75px" depth="75px" mathbackgro und="black"/>
72 </msup>
73 <msubsup id="msubsup">
74 <mspace id="msubsupbase" width="30px" height="15px" depth="15px" mathbac kground="black"/>
75 <mspace id="msubsupsub" width="10px" height="50px" depth="50px" mathback ground="black"/>
76 <mspace id="msubsupsup" width="10px" height="75px" depth="75px" mathback ground="black"/>
77 </msubsup>
78 <mmultiscripts id="multi">
79 <mspace id="multibase" width="30px" height="15px" depth="15px" mathbackg round="black"/>
80 <mspace id="multipostsub" width="10px" height="50px" depth="50px" mathba ckground="black"/>
81 <mspace id="multipostsup" width="10px" height="75px" depth="75px" mathba ckground="black"/>
82 <mprescripts/>
83 <mspace id="multipresub" width="10px" height="50px" depth="50px" mathbac kground="black"/>
84 <mspace id="multipresup" width="10px" height="75px" depth="75px" mathbac kground="black"/>
85 </mmultiscripts>
86 </math>
87 </p>
88 <hr/>
89 </body>
90 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698