LayoutTests/ChangeLog

 12013-09-14 Frédéric Wang <fred.wang@free.fr>
 2
 3 Implement the mmultiscripts tag
 4 https://bugs.webkit.org/show_bug.cgi?id=99618
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Add many tests for script msub/msup/msubsup/mmultiscripts:
 9 - invalid markup
 10 - equivalence between mmultiscripts without scripts and mrow
 11 - equivalence between mmultiscripts and msub/msup/msubsup
 12 - position of scripts in mmultiscripts
 13 - baseline alignment of msub/msup/msubsup elements
 14 - horizontal/vertical alignment of scripts
 15 - adding/removing children with the DOM
 16
 17 * TestExpectations: Some remaining MathML pixel tests are broken by this patch.
 18 * mathml/invalid-scripts-crash-expected.txt: Added.
 19 * mathml/invalid-scripts-crash.html: Added.
 20 * mathml/presentation/multiscripts-equivalence-expected.html: Added.
 21 * mathml/presentation/multiscripts-equivalence.html: Added.
 22 * mathml/presentation/multiscripts-noscripts-expected.html: Added.
 23 * mathml/presentation/multiscripts-noscripts.html: Added.
 24 * mathml/presentation/multiscripts-positions-expected.html: Added.
 25 * mathml/presentation/multiscripts-positions.html: Added.
 26 * mathml/presentation/scripts-base-alignment-expected.html: Added.
 27 * mathml/presentation/scripts-base-alignment.html: Added.
 28 * mathml/presentation/scripts-horizontal-alignment-expected.html: Added.
 29 * mathml/presentation/scripts-horizontal-alignment.html: Added.
 30 * mathml/presentation/scripts-vertical-alignment-expected.html: Added.
 31 * mathml/presentation/scripts-vertical-alignment.html: Added.
 32 * mathml/scripts-addChild-expected.html: Added.
 33 * mathml/scripts-addChild.html: Added.
 34 * mathml/scripts-removeChild-expected.html: Added.
 35 * mathml/scripts-removeChild.html: Added.
 36 * platform/mac/accessibility/mathml-multiscript-expected.txt: Reference updated.
 37
 38
1392013-09-13 Alexey Proskuryakov <ap@apple.com>
240
341 svg/dom/SVGScriptElement/script-load-and-error-events.svg is flakey

LayoutTests/TestExpectations

@@webkit.org/b/116473 editing/selection/user-drag-element-and-user-select-none.htm
1616# media/W3C/video/networkState/networkState_during_progress.html is flaky
1717webkit.org/b/76280 media/W3C/video/networkState/networkState_during_progress.html [ Pass Failure ]
1818
 19# MathML pixel tests
 20webkit.org/b/99618 mathml/presentation/roots.xhtml [ Failure ]
 21webkit.org/b/99618 mathml/presentation/mo-stretch.html [ Failure ]
 22
1923# These conformace tests are no longer in sync with the latest specification
2024# and expect compareDocumentPosition() to return:
2125# DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | DOCUMENT_POSITION_DISCONNECTED

LayoutTests/mathml/invalid-scripts-crash-expected.txt

 1This test passes if it does not crash.
 2
 3
 4
 5
 6

LayoutTests/mathml/invalid-scripts-crash.html

 1<!doctype html>
 2<html>
 3<head>
 4<script>
 5 if (window.testRunner)
 6 testRunner.dumpAsText();
 7</script>
 8</head>
 9<body>
 10
 11<!-- This test contains various invalid msub/msup/msubsup/mmultiscripts elements. -->
 12
 13<p>This test passes if it does not crash.</p>
 14
 15<math>
 16 <msub></msub>
 17 <msub><mn></mn></msub>
 18 <msub><mn></mn><mn></mn><mn></mn></msub>
 19 <msub><mprescripts/></msub>
 20 <msub><mn></mn><mprescripts/></msub>
 21 <msub><mprescripts/><mn></mn></msub>
 22 <msub><mn></mn><mn></mn><mn></mn><mprescripts/><mn></mn><mn></mn></msub>
 23</math>
 24
 25<math>
 26 <msup></msup>
 27 <msup><mn></mn></msup>
 28 <msup><mn></mn><mn></mn><mn></mn></msup>
 29 <msup><mprescripts/></msup>
 30 <msup><mn></mn><mprescripts/></msup>
 31 <msup><mprescripts/><mn></mn></msup>
 32 <msup><mn></mn><mn></mn><mn></mn><mprescripts/><mn></mn><mn></mn></msup>
 33</math>
 34
 35<math>
 36 <msubsup></msubsup>
 37 <msubsup><mn></mn></msubsup>
 38 <msubsup><mn></mn><mn></mn></msubsup>
 39 <msubsup><mn></mn><mn></mn><mn></mn><mn></mn></msubsup>
 40 <msubsup><mprescripts/></msubsup>
 41 <msup><mn></mn><mprescripts/></msup>
 42 <msup><mprescripts/><mn></mn></msup>
 43 <msubsup><mn></mn><mn></mn><mprescripts/></msubsup>
 44 <msubsup><mprescripts/><mn></mn><mn></mn></msubsup>
 45 <msubsup><mn></mn><mn></mn><mn></mn><mprescripts/><mn></mn><mn></mn></msubsup>
 46</math>
 47
 48<math>
 49 <mmultiscripts></mmultiscripts>
 50 <mmultiscripts><mn></mn><mn></mn></mmultiscripts>
 51 <mmultiscripts><mn></mn><mn></mn><mn></mn><mn></mn></mmultiscripts>
 52 <mmultiscripts><mprescripts/></mmultiscripts>
 53 <mmultiscripts><mprescripts/><mn></mn><mn></mn></mmultiscripts>
 54 <mmultiscripts><mprescripts/><mn></mn><mn></mn><mn></mn><mn></mn></mmultiscripts>
 55 <mmultiscripts><mn></mn><mprescripts/><mn></mn></mmultiscripts>
 56 <mmultiscripts><mn></mn><mprescripts/><mn></mn><mn></mn><mn></mn></mmultiscripts>
 57 <mmultiscripts><mn></mn><mprescripts/><mn></mn><mn></mn><mprescripts/></mmultiscripts>
 58 <mmultiscripts><mn></mn><mprescripts/><mn></mn><mn></mn><mprescripts/><mn></mn><mn></mn></mmultiscripts>
 59 <mmultiscripts><mn></mn><mprescripts/><mn></mn><mn></mn><mprescripts/><mn></mn><mn></mn><mn></mn><mn></mn></mmultiscripts>
 60</math>
 61
 62</body>
 63</html>

LayoutTests/mathml/presentation/multiscripts-equivalence-expected.html

 1<!doctype html>
 2<html>
 3 <head>
 4 <title>mmultiscripts vs msub/msup/msubsup</title>
 5 <meta charset="utf-8"/>
 6 </head>
 7 <body>
 8
 9 <p>
 10 <math>
 11 <msub>
 12 <mn>0</mn>
 13 <mn>1</mn>
 14 </msub>
 15 </math>
 16
 17 <math>
 18 <msup>
 19 <mn>0</mn>
 20 <mn>1</mn>
 21 </msup>
 22 </math>
 23
 24 <math>
 25 <msubsup>
 26 <mn>0</mn>
 27 <mn>1</mn>
 28 <mn>2</mn>
 29 </msubsup>
 30 </math>
 31 </p>
 32
 33 </body>
 34</html>

LayoutTests/mathml/presentation/multiscripts-equivalence.html

 1<!doctype html>
 2<html>
 3 <head>
 4 <title>mmultiscripts vs msub/msup/msubsup</title>
 5 <meta charset="utf-8"/>
 6 </head>
 7 <body>
 8
 9 <!-- This test compares the rendering of some <mmultiscripts> elements with equivalent msub/msup/msubsup constructions. -->
 10
 11 <p>
 12 <math>
 13 <mmultiscripts>
 14 <mn>0</mn>
 15 <mn>1</mn>
 16 <none/>
 17 </mmultiscripts>
 18 </math>
 19
 20 <math>
 21 <mmultiscripts>
 22 <mn>0</mn>
 23 <none/>
 24 <mn>1</mn>
 25 </mmultiscripts>
 26 </math>
 27
 28 <math>
 29 <mmultiscripts>
 30 <mn>0</mn>
 31 <mn>1</mn>
 32 <mn>2</mn>
 33 </mmultiscripts>
 34 </math>
 35 </p>
 36
 37 </body>
 38</html>

LayoutTests/mathml/presentation/multiscripts-noscripts-expected.html

 1<!doctype html>
 2<html>
 3 <head>
 4 <title>No scripts</title>
 5 <meta charset="utf-8"/>
 6 </head>
 7 <body>
 8
 9 <p>
 10 <math>
 11 <mrow>
 12 <mn>1</mn>
 13 </mrow>
 14 </math>
 15 </p>
 16
 17 <p>
 18 <math>
 19 <mrow>
 20 <mn>2</mn>
 21 </mrow>
 22 </math>
 23 </p>
 24
 25 </body>
 26</html>

LayoutTests/mathml/presentation/multiscripts-noscripts.html

 1<!doctype html>
 2<html>
 3 <head>
 4 <title>No scripts</title>
 5 <meta charset="utf-8"/>
 6 </head>
 7 <body>
 8
 9 <!-- These are valid <mmultiscripts> elements without scripts. They should render the same as an <mrow> element containing the base. -->
 10 <p>
 11 <math>
 12 <mmultiscripts>
 13 <mn>1</mn>
 14 <mprescripts/>
 15 </mmultiscripts>
 16 </math>
 17 </p>
 18
 19 <p>
 20 <math>
 21 <mmultiscripts>
 22 <mn>2</mn>
 23 </mmultiscripts>
 24 </math>
 25 </p>
 26
 27 </body>
 28</html>

LayoutTests/mathml/presentation/multiscripts-positions-expected.html

 1<!doctype html>
 2<html>
 3 <head>
 4 <title>positions of scripts</title>
 5 <meta charset="utf-8"/>
 6 </head>
 7 <body>
 8
 9 <!-- Testing post subscript -->
 10 <p style="position: absolute; left: 0; top: 0;">
 11 <math>
 12 <mspace height="50px" depth="50px"/>
 13 <mmultiscripts>
 14 <mspace width="20px" height="10px" depth="10px" mathbackground="blue"/>
 15 <mspace width="10px" height="10px" mathbackground="magenta"/>
 16 <none/>
 17 </mmultiscripts>
 18 </math>
 19 </p>
 20 <p style="position: absolute; left: 15px; top: 10px;">
 21 <math>
 22 <mspace height="50px" depth="50px"/>
 23 <mrow>
 24 <mspace width="20px" height="10px" depth="10px" mathbackground="black"/>
 25 </mrow>
 26 </math>
 27 </p>
 28
 29 <!-- Testing post superscript -->
 30 <p style="position: absolute; left: 100px; top: 0;">
 31 <math>
 32 <mspace height="50px" depth="50px"/>
 33 <mmultiscripts>
 34 <mspace width="20px" height="10px" depth="10px" mathbackground="blue"/>
 35 <none/>
 36 <mspace width="10px" height="10px" mathbackground="magenta"/>
 37 </mmultiscripts>
 38 </math>
 39 </p>
 40 <p style="position: absolute; left: 115px; top: -10px;">
 41 <math>
 42 <mspace height="50px" depth="50px"/>
 43 <mrow>
 44 <mspace width="20px" height="10px" depth="10px" mathbackground="black"/>
 45 </mrow>
 46 </math>
 47 </p>
 48
 49 <!-- Testing pre subscript -->
 50 <p style="position: absolute; left: 200px; top: 0;">
 51 <math>
 52 <mspace height="50px" depth="50px"/>
 53 <mmultiscripts>
 54 <mspace width="20px" height="10px" depth="10px" mathbackground="blue"/>
 55 <mprescripts/>
 56 <mspace width="10px" height="10px" mathbackground="magenta"/>
 57 <none/>
 58 </mmultiscripts>
 59 </math>
 60 </p>
 61 <p style="position: absolute; left: 195px; top: +10px;">
 62 <math>
 63 <mspace height="50px" depth="50px"/>
 64 <mrow>
 65 <mspace width="20px" height="10px" depth="10px" mathbackground="black"/>
 66 </mrow>
 67 </math>
 68 </p>
 69
 70 <!-- Testing pre postscript -->
 71 <p style="position: absolute; left: 300px; top: 0;">
 72 <math>
 73 <mspace height="50px" depth="50px"/>
 74 <mmultiscripts>
 75 <mspace width="20px" height="10px" depth="10px" mathbackground="blue"/>
 76 <mprescripts/>
 77 <none/>
 78 <mspace width="10px" height="10px" mathbackground="magenta"/>
 79 </mmultiscripts>
 80 </math>
 81 </p>
 82 <p style="position: absolute; left: 295px; top: -10px;">
 83 <math>
 84 <mspace height="50px" depth="50px"/>
 85 <mrow>
 86 <mspace width="20px" height="10px" depth="10px" mathbackground="black"/>
 87 </mrow>
 88 </math>
 89 </p>
 90
 91 <!-- Testing the leftmost pre subscript and rightmost post superscript -->
 92 <p style="position: absolute; left: 0; top: 100px;">
 93 <math>
 94 <mspace height="50px" depth="50px"/>
 95 <mmultiscripts>
 96 <mspace width="20px" height="10px" depth="10px" mathbackground="blue"/>
 97 <mspace width="10px" depth="10px" mathbackground="orange"/>
 98 <mspace width="10px" height="10px" mathbackground="green"/>
 99 <mspace width="10px" depth="10px" mathbackground="green"/>
 100 <mspace width="10px" height="10px" mathbackground="magenta"/>
 101 <mprescripts/>
 102 <mspace width="10px" depth="10px" mathbackground="magenta"/>
 103 <mspace width="10px" height="10px" mathbackground="green"/>
 104 <mspace width="10px" depth="10px" mathbackground="green"/>
 105 <mspace width="10px" height="10px" mathbackground="orange"/>
 106 </mmultiscripts>
 107 </math>
 108 </p>
 109 <p style="position: absolute; left: -5px; top: 110px;">
 110 <math>
 111 <mspace height="50px" depth="50px"/>
 112 <mrow>
 113 <mspace width="20px" height="10px" depth="10px" mathbackground="black"/>
 114 </mrow>
 115 </math>
 116 </p>
 117 <p style="position: absolute; left: 45px; top: 90px;">
 118 <math>
 119 <mspace height="50px" depth="50px"/>
 120 <mrow>
 121 <mspace width="20px" height="10px" depth="10px" mathbackground="black"/>
 122 </mrow>
 123 </math>
 124 </p>
 125
 126 <!-- Testing the leftmost pre superscript and rightmost post subscript -->
 127 <p style="position: absolute; left: 100px; top: 100px;">
 128 <math>
 129 <mspace height="50px" depth="50px"/>
 130 <mmultiscripts>
 131 <mspace width="20px" height="10px" depth="10px" mathbackground="blue"/>
 132 <mspace width="10px" depth="10px" mathbackground="green"/>
 133 <mspace width="10px" height="10px" mathbackground="orange"/>
 134 <mspace width="10px" depth="10px" mathbackground="magenta"/>
 135 <mspace width="10px" height="10px" mathbackground="green"/>
 136 <mprescripts/>
 137 <mspace width="10px" depth="10px" mathbackground="green"/>
 138 <mspace width="10px" height="10px" mathbackground="magenta"/>
 139 <mspace width="10px" depth="10px" mathbackground="orange"/>
 140 <mspace width="10px" height="10px" mathbackground="green"/>
 141 </mmultiscripts>
 142 </math>
 143 </p>
 144 <p style="position: absolute; left: 95px; top: 90px;">
 145 <math>
 146 <mspace height="50px" depth="50px"/>
 147 <mrow>
 148 <mspace width="20px" height="10px" depth="10px" mathbackground="black"/>
 149 </mrow>
 150 </math>
 151 </p>
 152 <p style="position: absolute; left: 145px; top: 110px;">
 153 <math>
 154 <mspace height="50px" depth="50px"/>
 155 <mrow>
 156 <mspace width="20px" height="10px" depth="10px" mathbackground="black"/>
 157 </mrow>
 158 </math>
 159 </p>
 160
 161 </body>
 162</html>

LayoutTests/mathml/presentation/multiscripts-positions.html

 1<!doctype html>
 2<html>
 3 <head>
 4 <title>positions of scripts</title>
 5 <meta charset="utf-8"/>
 6 </head>
 7 <body>
 8
 9 <!-- This page contains several <mmultiscripts> elements. We place black squares at the position where we expect some red scripts to be. The reference page is the same with only the colors of these scripts changed. If the scripts are correctly placed, they will be covered by the black squares and thus the color difference is not perceptible. -->
 10
 11 <!-- Testing post subscript -->
 12 <p style="position: absolute; left: 0; top: 0;">
 13 <math>
 14 <mspace height="50px" depth="50px"/>
 15 <mmultiscripts>
 16 <mspace width="20px" height="10px" depth="10px" mathbackground="blue"/>
 17 <mspace width="10px" height="10px" mathbackground="red"/>
 18 <none/>
 19 </mmultiscripts>
 20 </math>
 21 </p>
 22 <p style="position: absolute; left: 15px; top: 10px;">
 23 <math>
 24 <mspace height="50px" depth="50px"/>
 25 <mrow>
 26 <mspace width="20px" height="10px" depth="10px" mathbackground="black"/>
 27 </mrow>
 28 </math>
 29 </p>
 30
 31 <!-- Testing post superscript -->
 32 <p style="position: absolute; left: 100px; top: 0;">
 33 <math>
 34 <mspace height="50px" depth="50px"/>
 35 <mmultiscripts>
 36 <mspace width="20px" height="10px" depth="10px" mathbackground="blue"/>
 37 <none/>
 38 <mspace width="10px" height="10px" mathbackground="red"/>
 39 </mmultiscripts>
 40 </math>
 41 </p>
 42 <p style="position: absolute; left: 115px; top: -10px;">
 43 <math>
 44 <mspace height="50px" depth="50px"/>
 45 <mrow>
 46 <mspace width="20px" height="10px" depth="10px" mathbackground="black"/>
 47 </mrow>
 48 </math>
 49 </p>
 50
 51 <!-- Testing pre subscript -->
 52 <p style="position: absolute; left: 200px; top: 0;">
 53 <math>
 54 <mspace height="50px" depth="50px"/>
 55 <mmultiscripts>
 56 <mspace width="20px" height="10px" depth="10px" mathbackground="blue"/>
 57 <mprescripts/>
 58 <mspace width="10px" height="10px" mathbackground="red"/>
 59 <none/>
 60 </mmultiscripts>
 61 </math>
 62 </p>
 63 <p style="position: absolute; left: 195px; top: +10px;">
 64 <math>
 65 <mspace height="50px" depth="50px"/>
 66 <mrow>
 67 <mspace width="20px" height="10px" depth="10px" mathbackground="black"/>
 68 </mrow>
 69 </math>
 70 </p>
 71
 72 <!-- Testing pre postscript -->
 73 <p style="position: absolute; left: 300px; top: 0;">
 74 <math>
 75 <mspace height="50px" depth="50px"/>
 76 <mmultiscripts>
 77 <mspace width="20px" height="10px" depth="10px" mathbackground="blue"/>
 78 <mprescripts/>
 79 <none/>
 80 <mspace width="10px" height="10px" mathbackground="red"/>
 81 </mmultiscripts>
 82 </math>
 83 </p>
 84 <p style="position: absolute; left: 295px; top: -10px;">
 85 <math>
 86 <mspace height="50px" depth="50px"/>
 87 <mrow>
 88 <mspace width="20px" height="10px" depth="10px" mathbackground="black"/>
 89 </mrow>
 90 </math>
 91 </p>
 92
 93 <!-- Testing the leftmost pre subscript and rightmost post superscript -->
 94 <p style="position: absolute; left: 0; top: 100px;">
 95 <math>
 96 <mspace height="50px" depth="50px"/>
 97 <mmultiscripts>
 98 <mspace width="20px" height="10px" depth="10px" mathbackground="blue"/>
 99 <mspace width="10px" depth="10px" mathbackground="orange"/>
 100 <mspace width="10px" height="10px" mathbackground="green"/>
 101 <mspace width="10px" depth="10px" mathbackground="green"/>
 102 <mspace width="10px" height="10px" mathbackground="red"/>
 103 <mprescripts/>
 104 <mspace width="10px" depth="10px" mathbackground="red"/>
 105 <mspace width="10px" height="10px" mathbackground="green"/>
 106 <mspace width="10px" depth="10px" mathbackground="green"/>
 107 <mspace width="10px" height="10px" mathbackground="orange"/>
 108 </mmultiscripts>
 109 </math>
 110 </p>
 111 <p style="position: absolute; left: -5px; top: 110px;">
 112 <math>
 113 <mspace height="50px" depth="50px"/>
 114 <mrow>
 115 <mspace width="20px" height="10px" depth="10px" mathbackground="black"/>
 116 </mrow>
 117 </math>
 118 </p>
 119 <p style="position: absolute; left: 45px; top: 90px;">
 120 <math>
 121 <mspace height="50px" depth="50px"/>
 122 <mrow>
 123 <mspace width="20px" height="10px" depth="10px" mathbackground="black"/>
 124 </mrow>
 125 </math>
 126 </p>
 127
 128 <!-- Testing the leftmost pre superscript and rightmost post subscript -->
 129 <p style="position: absolute; left: 100px; top: 100px;">
 130 <math>
 131 <mspace height="50px" depth="50px"/>
 132 <mmultiscripts>
 133 <mspace width="20px" height="10px" depth="10px" mathbackground="blue"/>
 134 <mspace width="10px" depth="10px" mathbackground="green"/>
 135 <mspace width="10px" height="10px" mathbackground="orange"/>
 136 <mspace width="10px" depth="10px" mathbackground="red"/>
 137 <mspace width="10px" height="10px" mathbackground="green"/>
 138 <mprescripts/>
 139 <mspace width="10px" depth="10px" mathbackground="green"/>
 140 <mspace width="10px" height="10px" mathbackground="red"/>
 141 <mspace width="10px" depth="10px" mathbackground="orange"/>
 142 <mspace width="10px" height="10px" mathbackground="green"/>
 143 </mmultiscripts>
 144 </math>
 145 </p>
 146 <p style="position: absolute; left: 95px; top: 90px;">
 147 <math>
 148 <mspace height="50px" depth="50px"/>
 149 <mrow>
 150 <mspace width="20px" height="10px" depth="10px" mathbackground="black"/>
 151 </mrow>
 152 </math>
 153 </p>
 154 <p style="position: absolute; left: 145px; top: 110px;">
 155 <math>
 156 <mspace height="50px" depth="50px"/>
 157 <mrow>
 158 <mspace width="20px" height="10px" depth="10px" mathbackground="black"/>
 159 </mrow>
 160 </math>
 161 </p>
 162
 163 </body>
 164</html>

LayoutTests/mathml/presentation/scripts-base-alignment-expected.html

 1<!doctype html>
 2<html>
 3 <head>
 4 <title>base alignment</title>
 5 <meta charset="utf-8"/>
 6 </head>
 7 <body>
 8
 9 <p style="position: absolute;">
 10 <math>
 11 <mspace height="10em" depth="10em"/>
 12 <mn mathcolor="red">0</mn>
 13 <msup><mn mathcolor="red">0</mn><mn>1</mn></msup>
 14 <msub><mn mathcolor="red">0</mn><mn>1</mn></msub>
 15 <msubsup><mn mathcolor="red">0</mn><mn>1</mn><mn>2</mn></msubsup>
 16 <mmultiscripts><mn mathcolor="red">0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn></mmultiscripts>
 17
 18 <mmultiscripts>
 19 <mn mathcolor="red">0</mn>
 20 <mmultiscripts><mn>1</mn><mn>2</mn><none/></mmultiscripts>
 21 <none/>
 22 </mmultiscripts>
 23 <mmultiscripts>
 24 <mn mathcolor="red">0</mn>
 25 <none/>
 26 <mmultiscripts><mn>1</mn><none/><mn>2</mn></mmultiscripts>
 27 </mmultiscripts>
 28 <mmultiscripts>
 29 <mn mathcolor="red">0</mn>
 30 <mprescripts/>
 31 <mmultiscripts><mn>1</mn><mprescripts/><mn>2</mn><none/></mmultiscripts>
 32 <none/>
 33 </mmultiscripts>
 34 <mmultiscripts>
 35 <mn mathcolor="red">0</mn>
 36 <mprescripts/>
 37 <none/>
 38 <mmultiscripts><mn>1</mn><mprescripts/><none/><mn>2</mn></mmultiscripts>
 39 </mmultiscripts>
 40
 41 <mmultiscripts>
 42 <mn mathcolor="red">0</mn>
 43 <mmultiscripts>
 44 <mn>0</mn>
 45 <mn>1</mn><mn>2</mn>
 46 <mn>3</mn><mn>4</mn>
 47 <mprescripts/>
 48 <mn>5</mn><mn>6</mn>
 49 <mn>7</mn><mn>8</mn>
 50 </mmultiscripts>
 51 <mmultiscripts>
 52 <mn>0</mn>
 53 <mn>1</mn><mn>2</mn>
 54 <mn>3</mn><mn>4</mn>
 55 <mprescripts/>
 56 <mn>5</mn><mn>6</mn>
 57 <mn>7</mn><mn>8</mn>
 58 </mmultiscripts>
 59 <mprescripts/>
 60 <mmultiscripts>
 61 <mn>0</mn>
 62 <mn>1</mn><mn>2</mn>
 63 <mn>3</mn><mn>4</mn>
 64 <mprescripts/>
 65 <mn>5</mn><mn>6</mn>
 66 <mn>7</mn><mn>8</mn>
 67 </mmultiscripts>
 68 <mmultiscripts>
 69 <mn>0</mn>
 70 <mn>1</mn><mn>2</mn>
 71 <mn>3</mn><mn>4</mn>
 72 <mprescripts/>
 73 <mn>5</mn><mn>6</mn>
 74 <mn>7</mn><mn>8</mn>
 75 </mmultiscripts>
 76 </mmultiscripts>
 77 </math>
 78 </p>
 79
 80 <p style="position: absolute;">
 81 <math>
 82 <mspace height="10em" depth="10em"/>
 83 <mrow mathbackground="blue" style="border-top: blue solid 1px; border-bottom: blue solid 1px;">
 84 <mphantom>
 85 <mn>0000000000000000000000000000000000000000000</mn>
 86 </mphantom>
 87 </mrow>
 88 </math>
 89 </p>
 90
 91 </body>
 92</html>

LayoutTests/mathml/presentation/scripts-base-alignment.html

 1<!doctype html>
 2<html>
 3 <head>
 4 <title>base alignment</title>
 5 <meta charset="utf-8"/>
 6 </head>
 7 <body>
 8
 9 <!-- The bases of the outermost <mmultiscripts> elements should all be aligned and so covered by the blue rectangle. -->
 10 <p style="position: absolute;">
 11 <math>
 12 <mspace height="10em" depth="10em"/>
 13 <mn>0</mn>
 14 <msup><mn>0</mn><mn>1</mn></msup>
 15 <msub><mn>0</mn><mn>1</mn></msub>
 16 <msubsup><mn>0</mn><mn>1</mn><mn>2</mn></msubsup>
 17 <mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn></mmultiscripts>
 18
 19 <mmultiscripts>
 20 <mn>0</mn>
 21 <mmultiscripts><mn>1</mn><mn>2</mn><none/></mmultiscripts>
 22 <none/>
 23 </mmultiscripts>
 24 <mmultiscripts>
 25 <mn>0</mn>
 26 <none/>
 27 <mmultiscripts><mn>1</mn><none/><mn>2</mn></mmultiscripts>
 28 </mmultiscripts>
 29 <mmultiscripts>
 30 <mn>0</mn>
 31 <mprescripts/>
 32 <mmultiscripts><mn>1</mn><mprescripts/><mn>2</mn><none/></mmultiscripts>
 33 <none/>
 34 </mmultiscripts>
 35 <mmultiscripts>
 36 <mn>0</mn>
 37 <mprescripts/>
 38 <none/>
 39 <mmultiscripts><mn>1</mn><mprescripts/><none/><mn>2</mn></mmultiscripts>
 40 </mmultiscripts>
 41
 42 <mmultiscripts>
 43 <mn>0</mn>
 44 <mmultiscripts>
 45 <mn>0</mn>
 46 <mn>1</mn><mn>2</mn>
 47 <mn>3</mn><mn>4</mn>
 48 <mprescripts/>
 49 <mn>5</mn><mn>6</mn>
 50 <mn>7</mn><mn>8</mn>
 51 </mmultiscripts>
 52 <mmultiscripts>
 53 <mn>0</mn>
 54 <mn>1</mn><mn>2</mn>
 55 <mn>3</mn><mn>4</mn>
 56 <mprescripts/>
 57 <mn>5</mn><mn>6</mn>
 58 <mn>7</mn><mn>8</mn>
 59 </mmultiscripts>
 60 <mprescripts/>
 61 <mmultiscripts>
 62 <mn>0</mn>
 63 <mn>1</mn><mn>2</mn>
 64 <mn>3</mn><mn>4</mn>
 65 <mprescripts/>
 66 <mn>5</mn><mn>6</mn>
 67 <mn>7</mn><mn>8</mn>
 68 </mmultiscripts>
 69 <mmultiscripts>
 70 <mn>0</mn>
 71 <mn>1</mn><mn>2</mn>
 72 <mn>3</mn><mn>4</mn>
 73 <mprescripts/>
 74 <mn>5</mn><mn>6</mn>
 75 <mn>7</mn><mn>8</mn>
 76 </mmultiscripts>
 77 </mmultiscripts>
 78 </math>
 79 </p>
 80
 81 <p style="position: absolute;">
 82 <math>
 83 <mspace height="10em" depth="10em"/>
 84 <mrow mathbackground="blue" style="border-top: blue solid 1px; border-bottom: blue solid 1px;">
 85 <mphantom>
 86 <mn>0000000000000000000000000000000000000000000</mn>
 87 </mphantom>
 88 </mrow>
 89 </math>
 90 </p>
 91
 92 </body>
 93</html>

LayoutTests/mathml/presentation/scripts-horizontal-alignment-expected.html

 1<!doctype html>
 2<html>
 3 <head>
 4 <title>horizontal alignment</title>
 5 <meta charset="utf-8"/>
 6 </head>
 7 <body>
 8
 9 <math style="position: absolute;">
 10 <mspace height="100px" depth="100px"/>
 11 <mmultiscripts>
 12 <mn>0</mn>
 13 <mspace width="10px" height="50px" mathbackground="green"/>
 14 <mspace width="10px" height="10px"/>
 15 <mspace width="10px" height="10px"/>
 16 <none/>
 17 <mprescripts/>
 18 <none/>
 19 <mspace width="10px" height="10px"/>
 20 <mspace width="10px" height="10px"/>
 21 <mspace width="10px" height="50px" mathbackground="green"/>
 22 </mmultiscripts>
 23 </math>
 24
 25 <math style="position: absolute; top: -40px;">
 26 <mspace height="100px" depth="100px"/>
 27 <mspace width="200px" height="40px" depth="20px" mathbackground="black"/>
 28 </math>
 29 <math style="position: absolute; top: +40px;">
 30 <mspace height="100px" depth="100px"/>
 31 <mspace width="200px" height="20px" depth="40px" mathbackground="black"/>
 32 </math>
 33
 34 </body>
 35</html>

LayoutTests/mathml/presentation/scripts-horizontal-alignment.html

 1<!doctype html>
 2<html>
 3 <head>
 4 <title>horizontal alignment</title>
 5 <meta charset="utf-8"/>
 6 </head>
 7 <body>
 8
 9 <!-- The MathML recommendation does not specify horizontal alignment of scripts. We align the bottom (respectively top) edge of the subscript (respectively superscript) with the bottom (respectively top) edge of the flex container. -->
 10 <math style="position: absolute;">
 11 <mspace height="100px" depth="100px"/>
 12 <mmultiscripts>
 13 <mn>0</mn>
 14 <mspace width="10px" height="50px" mathbackground="green"/>
 15 <mspace width="10px" height="10px" mathbackground="red"/>
 16 <mspace width="10px" height="10px" mathbackground="blue"/>
 17 <none/>
 18 <mprescripts/>
 19 <none/>
 20 <mspace width="10px" height="10px" mathbackground="blue"/>
 21 <mspace width="10px" height="10px" mathbackground="red"/>
 22 <mspace width="10px" height="50px" mathbackground="green"/>
 23 </mmultiscripts>
 24 </math>
 25
 26 <!-- These black rectangles should hide the top/bottom of the <mmultiscripts> element. So the green and red scripts should not be visible -->
 27 <math style="position: absolute; top: -40px;">
 28 <mspace height="100px" depth="100px"/>
 29 <mspace width="200px" height="40px" depth="20px" mathbackground="black"/>
 30 </math>
 31 <math style="position: absolute; top: +40px;">
 32 <mspace height="100px" depth="100px"/>
 33 <mspace width="200px" height="20px" depth="40px" mathbackground="black"/>
 34 </math>
 35
 36 </body>
 37</html>

LayoutTests/mathml/presentation/scripts-vertical-alignment-expected.html

 1<!doctype html>
 2<html>
 3 <head>
 4 <title>vertical alignment</title>
 5 <meta charset="utf-8"/>
 6 </head>
 7 <body>
 8
 9 <math>
 10 <msubsup>
 11 <mn>0</mn>
 12 <mrow><mspace width="10px" height="10px" mathbackground="red"/><mspace width="10px" height="10px"/></mrow>
 13 <mspace width="20px" height="10px" mathbackground="blue"/>
 14 </msubsup>
 15 <msubsup>
 16 <mn>0</mn>
 17 <mspace width="20px" height="10px" mathbackground="blue"/>
 18 <mrow><mspace width="10px" height="10px" mathbackground="red"/><mspace width="10px" height="10px"/></mrow>
 19 </msubsup>
 20 <mmultiscripts>
 21 <mn>0</mn>
 22 <mrow><mspace width="10px" height="10px" mathbackground="red"/><mspace width="10px" height="10px"/></mrow>
 23 <mspace width="20px" height="10px" mathbackground="blue"/>
 24 <mspace width="20px" height="10px" mathbackground="blue"/>
 25 <mrow><mspace width="10px" height="10px" mathbackground="red"/><mspace width="10px" height="10px"/></mrow>
 26 <mprescripts/>
 27 <mrow><mspace width="10px" height="10px"/><mspace width="10px" height="10px" mathbackground="red"/></mrow>
 28 <mspace width="20px" height="10px" mathbackground="blue"/>
 29 <mspace width="20px" height="10px" mathbackground="blue"/>
 30 <mrow><mspace width="10px" height="10px"/><mspace width="10px" height="10px" mathbackground="red"/></mrow>$
 31 </mmultiscripts>
 32 </math>
 33
 34 </body>
 35</html>

LayoutTests/mathml/presentation/scripts-vertical-alignment.html

 1<!doctype html>
 2<html>
 3 <head>
 4 <title>vertical alignment</title>
 5 <meta charset="utf-8"/>
 6 </head>
 7 <body>
 8
 9 <!-- The MathML recommendation does not specify vertical alignment of scripts. We right align prescripts and left align postscripts. See http://lists.w3.org/Archives/Public/www-math/2012Aug/0006.html -->
 10 <math>
 11 <msubsup>
 12 <mn>0</mn>
 13 <mspace width="10px" height="10px" mathbackground="red"/>
 14 <mspace width="20px" height="10px" mathbackground="blue"/>
 15 </msubsup>
 16 <msubsup>
 17 <mn>0</mn>
 18 <mspace width="20px" height="10px" mathbackground="blue"/>
 19 <mspace width="10px" height="10px" mathbackground="red"/>
 20 </msubsup>
 21 <mmultiscripts>
 22 <mn>0</mn>
 23 <mspace width="10px" height="10px" mathbackground="red"/>
 24 <mspace width="20px" height="10px" mathbackground="blue"/>
 25 <mspace width="20px" height="10px" mathbackground="blue"/>
 26 <mspace width="10px" height="10px" mathbackground="red"/>
 27 <mprescripts/>
 28 <mspace width="10px" height="10px" mathbackground="red"/>
 29 <mspace width="20px" height="10px" mathbackground="blue"/>
 30 <mspace width="20px" height="10px" mathbackground="blue"/>
 31 <mspace width="10px" height="10px" mathbackground="red"/>
 32 </mmultiscripts>
 33 </math>
 34
 35 </body>
 36</html>

LayoutTests/mathml/scripts-addChild-expected.html

 1<!doctype html>
 2<html>
 3 <head>
 4 <title>MathML script elements: adding children</title>
 5 <style type="text/css">
 6 div { border: 1px solid; margin: .5em; }
 7 </style>
 8 </head>
 9
 10 <body>
 11
 12 <div id="test1">Test 1:
 13 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn></mmultiscripts></math>
 14 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn></mmultiscripts></math>
 15 </div>
 16
 17 <div id="test2">Test 2:
 18 <math><mmultiscripts><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 19 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 20 <math><mmultiscripts><mn>0</mn><mn>1</mn><mprescripts/><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 21 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 22 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 23 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mprescripts/><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 24 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 25 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 26 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mprescripts/><mn>6</mn></mmultiscripts></math>
 27 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mprescripts/></mmultiscripts></math>
 28 </div>
 29
 30 <div id="test3">Test 3:
 31 <math><mmultiscripts><mn>10</mn><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 32 <math><mmultiscripts><mn>0</mn><mn>11</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 33 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>12</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 34 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mn>13</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 35 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>14</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 36 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>15</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 37 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mn>16</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 38 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>17</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 39 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>18</mn><mn>6</mn></mmultiscripts></math>
 40 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>19</mn></mmultiscripts></math>
 41 </div>
 42
 43 <div id="test4">Test 4:
 44 <math><mmultiscripts><mprescripts/><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 45 <math><mmultiscripts><mn>0</mn><mprescripts/><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 46 <math><mmultiscripts><mn>0</mn><mprescripts/><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 47 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 48 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 49 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mprescripts/><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 50 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 51 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 52 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 53 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mprescripts/><mn>6</mn></mmultiscripts></math>
 54 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/></mmultiscripts></math>
 55 </div>
 56
 57 <div id="test5">Test 5:
 58 <math><mmultiscripts><mn>10</mn><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 59 <math><mmultiscripts><mn>0</mn><mn>11</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 60 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>12</mn><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 61 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mn>13</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 62 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>14</mn><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 63 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>15</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 64 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mn>16</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 65 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>17</mn><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 66 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>18</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 67 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>19</mn><mn>6</mn></mmultiscripts></math>
 68 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn><mn>20</mn></mmultiscripts></math>
 69 </div>
 70
 71
 72 </body>
 73</html>

LayoutTests/mathml/scripts-addChild.html

 1<!doctype html>
 2<html>
 3 <head>
 4 <title>MathML script elements: adding children</title>
 5
 6 <!-- This test verifies insertion of children into an <mmultiscripts> element using DOM operations. It should not crash and should render the same as the equivalent static page. -->
 7
 8 <style type="text/css">
 9 div { border: 1px solid; margin: .5em; }
 10 </style>
 11 <script type="text/javascript">
 12 var mathmlNS = "http://www.w3.org/1998/Math/MathML";
 13
 14 function newMn(n)
 15 {
 16 var t = document.createTextNode(n.toString());
 17 var mn = document.createElementNS(mathmlNS, "mn");
 18 mn.appendChild(t);
 19 return mn;
 20 }
 21
 22 function newPrescripts()
 23 {
 24 var mprescripts = document.createElementNS(mathmlNS, "mprescripts");
 25 return mprescripts;
 26 }
 27
 28 function test1()
 29 {
 30 var test1content = document.getElementById("test1content");
 31 var mmultiscripts = document.getElementById("test1").getElementsByTagNameNS(mathmlNS, "mmultiscripts");
 32
 33 // Insert in normal order
 34 for (var child = test1content.firstChild; child; child = child.nextSibling) {
 35 mmultiscripts[0].appendChild(child.cloneNode(true));
 36 }
 37
 38 // Insert in reverse order
 39 for (var child = test1content.lastChild; child; child = child.previousSibling) {
 40 mmultiscripts[1].insertBefore(child.cloneNode(true), mmultiscripts[1].firstChild);
 41 }
 42 }
 43
 44 function test2()
 45 {
 46 var mmultiscripts = document.getElementById("test2").getElementsByTagNameNS(mathmlNS, "mmultiscripts");
 47 for (var i = 0; i < mmultiscripts.length; i++) {
 48 var childRef = mmultiscripts[i].firstChild;
 49 for (var j = 0; j < i; j++) childRef = childRef.nextSibling;
 50 mmultiscripts[i].insertBefore(newPrescripts(), childRef);
 51 }
 52 }
 53
 54 function test3()
 55 {
 56 var mmultiscripts = document.getElementById("test3").getElementsByTagNameNS(mathmlNS, "mmultiscripts");
 57 for (var i = 0; i < mmultiscripts.length; i++) {
 58 var childRef = mmultiscripts[i].firstChild;
 59 for (var j = 0; j < i; j++) childRef = childRef.nextSibling;
 60 mmultiscripts[i].insertBefore(newMn(10+i), childRef);
 61 }
 62 }
 63
 64 function test4()
 65 {
 66 var mmultiscripts = document.getElementById("test4").getElementsByTagNameNS(mathmlNS, "mmultiscripts");
 67 for (var i = 0; i < mmultiscripts.length; i++) {
 68 var childRef = mmultiscripts[i].firstChild;
 69 for (var j = 0; j < i; j++) childRef = childRef.nextSibling;
 70 mmultiscripts[i].insertBefore(newPrescripts(), childRef);
 71 }
 72 }
 73
 74 function test5()
 75 {
 76 var mmultiscripts = document.getElementById("test5").getElementsByTagNameNS(mathmlNS, "mmultiscripts");
 77 for (var i = 0; i < mmultiscripts.length; i++) {
 78 var childRef = mmultiscripts[i].firstChild;
 79 for (var j = 0; j < i; j++) childRef = childRef.nextSibling;
 80 mmultiscripts[i].insertBefore(newMn(10+i), childRef);
 81 }
 82 }
 83
 84 function run()
 85 {
 86 test1();
 87 test2();
 88 test3();
 89 test4();
 90 test5();
 91 }
 92 </script>
 93 </head>
 94
 95 <body onload="run()">
 96
 97 <!-- Test 1: insert in normal and reverse order. -->
 98 <div style="display: none">
 99 <math id="test1content"><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn></math>
 100 </div>
 101
 102 <div id="test1">Test 1:
 103 <math><mmultiscripts></mmultiscripts></math>
 104 <math><mmultiscripts></mmultiscripts></math>
 105 </div>
 106
 107 <!-- Test 2: insert an <mprescripts/> element. -->
 108 <div id="test2">Test 2:
 109 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 110 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 111 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 112 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 113 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 114 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 115 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 116 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 117 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 118 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 119 </div>
 120
 121 <!-- Test 3: insert an <mn> element. -->
 122 <div id="test3">Test 3:
 123 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 124 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 125 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 126 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 127 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 128 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 129 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 130 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 131 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 132 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 133 </div>
 134
 135 <!-- Test 4: insert an <mprescripts> element (different number of consecutive scripts) . -->
 136 <div id="test4">Test 4:
 137 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 138 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 139 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 140 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 141 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 142 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 143 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 144 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 145 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 146 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 147 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 148 </div>
 149
 150 <!-- Test 5: insert an <mn> element (different number of consecutive scripts) . -->
 151 <div id="test5">Test 5:
 152 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 153 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 154 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 155 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 156 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 157 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 158 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 159 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 160 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 161 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 162 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>1</mn><mprescripts/><mn>2</mn><mn>3</mn><mprescripts/><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 163 </div>
 164
 165 </body>
 166</html>

LayoutTests/mathml/scripts-removeChild-expected.html

 1<!doctype html>
 2<html>
 3 <head>
 4 <title>MathML script elements: removing children</title>
 5 <style type="text/css">
 6 div { border: 1px solid; margin: .5em; }
 7 </style>
 8 </head>
 9
 10 <body>
 11
 12 <div id="test1">Test 1:
 13 <math><mmultiscripts></mmultiscripts></math>
 14 <math><mmultiscripts><mn>0</mn></mmultiscripts></math>
 15 <math><mmultiscripts><mn>0</mn><mn>1</mn></mmultiscripts></math>
 16 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn></mmultiscripts></math>
 17 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn></mmultiscripts></math>
 18 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn></mmultiscripts></math>
 19 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/></mmultiscripts></math>
 20 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn></mmultiscripts></math>
 21 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 22 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn></mmultiscripts></math>
 23 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/></mmultiscripts></math>
 24 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/><mn>9</mn></mmultiscripts></math>
 25 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/><mn>9</mn><mn>10</mn></mmultiscripts></math>
 26 </div>
 27
 28 <div id="test2">Test 2:
 29 <math><mmultiscripts><mn>20</mn></mmultiscripts></math>
 30 <math><mmultiscripts><mn>20</mn><mn>0</mn></mmultiscripts></math>
 31 <math><mmultiscripts><mn>20</mn><mn>0</mn><mn>1</mn></mmultiscripts></math>
 32 <math><mmultiscripts><mn>20</mn><mn>0</mn><mn>1</mn><mn>2</mn></mmultiscripts></math>
 33 <math><mmultiscripts><mn>20</mn><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn></mmultiscripts></math>
 34 <math><mmultiscripts><mn>20</mn><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn></mmultiscripts></math>
 35 <math><mmultiscripts><mn>20</mn><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/></mmultiscripts></math>
 36 <math><mmultiscripts><mn>20</mn><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn></mmultiscripts></math>
 37 <math><mmultiscripts><mn>20</mn><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 38 <math><mmultiscripts><mn>20</mn><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn></mmultiscripts></math>
 39 <math><mmultiscripts><mn>20</mn><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/></mmultiscripts></math>
 40 <math><mmultiscripts><mn>20</mn><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/><mn>9</mn></mmultiscripts></math>
 41 <math><mmultiscripts><mn>20</mn><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/><mn>9</mn><mn>10</mn></mmultiscripts></math>
 42 </div>
 43
 44 <div id="test3">Test 3:
 45 <math><mmultiscripts><mn>20</mn><mn>30</mn></mmultiscripts></math>
 46 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>0</mn></mmultiscripts></math>
 47 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>0</mn><mn>1</mn></mmultiscripts></math>
 48 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>0</mn><mn>1</mn><mn>2</mn></mmultiscripts></math>
 49 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn></mmultiscripts></math>
 50 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn></mmultiscripts></math>
 51 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/></mmultiscripts></math>
 52 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn></mmultiscripts></math>
 53 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 54 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn></mmultiscripts></math>
 55 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/></mmultiscripts></math>
 56 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/><mn>9</mn></mmultiscripts></math>
 57 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/><mn>9</mn><mn>10</mn></mmultiscripts></math>
 58 </div>
 59
 60 <div id="test4">Test 4:
 61 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn></mmultiscripts></math>
 62 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mn>0</mn></mmultiscripts></math>
 63 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mn>0</mn><mn>1</mn></mmultiscripts></math>
 64 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mn>0</mn><mn>1</mn><mn>2</mn></mmultiscripts></math>
 65 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn></mmultiscripts></math>
 66 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn></mmultiscripts></math>
 67 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/></mmultiscripts></math>
 68 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn></mmultiscripts></math>
 69 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 70 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn></mmultiscripts></math>
 71 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/></mmultiscripts></math>
 72 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/><mn>9</mn></mmultiscripts></math>
 73 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/><mn>9</mn><mn>10</mn></mmultiscripts></math>
 74 </div>
 75
 76 <div id="test5">Test 5:
 77 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn></mmultiscripts></math>
 78 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mn>5</mn></mmultiscripts></math>
 79 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn></mmultiscripts></math>
 80 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/></mmultiscripts></math>
 81 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn></mmultiscripts></math>
 82 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn></mmultiscripts></math>
 83 </div>
 84
 85 <div id="test6">Test 6:
 86 <math><mmultiscripts><mn>0</mn><mprescripts/><mprescripts/><mn>2</mn><mn>3</mn></mmultiscripts></math>
 87 <math><mmultiscripts><mn>0</mn><mprescripts/><mprescripts/><mn>1</mn><mn>3</mn></mmultiscripts></math>
 88 <math><mmultiscripts><mn>0</mn><mprescripts/><mprescripts/><mn>1</mn><mn>2</mn></mmultiscripts></math>
 89 </div>
 90
 91 <div id="test7">Test 7:
 92 <math><mmultiscripts></mmultiscripts></math>
 93 <math><mmultiscripts><mn>1</mn></mmultiscripts></math>
 94 <math><mmultiscripts><mn>1</mn><mn>2</mn></mmultiscripts></math>
 95 <math><mmultiscripts><mn>1</mn><mn>2</mn><mn>3</mn></mmultiscripts></math>
 96 <math><mmultiscripts><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn></mmultiscripts></math>
 97 <math><mmultiscripts><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/></mmultiscripts></math>
 98 <math><mmultiscripts><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn></mmultiscripts></math>
 99 <math><mmultiscripts><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 100 <math><mmultiscripts><mprescripts/></mmultiscripts></math>
 101 <math><mmultiscripts><mprescripts/><mn>5</mn></mmultiscripts></math>
 102 <math><mmultiscripts><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 103 </div>
 104
 105 <div id="test8">Test 8:
 106 <math><mmultiscripts><mtext>BASE</mtext><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math>
 107 <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math>
 108 <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math>
 109 <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math>
 110 <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math>
 111 <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math>
 112 <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math>
 113 <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math>
 114 <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math>
 115 <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>11</mn><mn>12</mn></mmultiscripts></math>
 116 <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>12</mn></mmultiscripts></math>
 117 <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn></mmultiscripts></math>
 118 </div>
 119
 120</body>
 121</html>

LayoutTests/mathml/scripts-removeChild.html

 1<!doctype html>
 2<html>
 3 <head>
 4 <title>MathML script elements: removing children</title>
 5
 6 <!-- This test verifies removal of children from an <mmultiscripts> element using DOM operations. It should not crash and should render the same as the equivalent static page. -->
 7
 8 <style type="text/css">
 9 div { border: 1px solid; margin: .5em; }
 10 </style>
 11 <script type="text/javascript">
 12 var mathmlNS = "http://www.w3.org/1998/Math/MathML";
 13
 14 function testRemoveMPrescript(n)
 15 {
 16 // Test 1, 2, 3, 4: removing the <mprescripts/> element.
 17 var mmultiscripts = document.getElementById("test" + n).getElementsByTagNameNS(mathmlNS, "mmultiscripts");
 18 for (var i = 0; i < mmultiscripts.length; i++)
 19 mmultiscripts[i].removeChild(mmultiscripts[i].getElementsByTagNameNS(mathmlNS, "mprescripts")[0]);
 20 }
 21
 22 function test5()
 23 {
 24 // Test 5: removing the first duplicate <mprescripts/> element.
 25 var mmultiscripts = document.getElementById("test5").getElementsByTagNameNS(mathmlNS, "mmultiscripts");
 26 for (var i = 0; i < mmultiscripts.length; i++)
 27 mmultiscripts[i].removeChild(mmultiscripts[i].getElementsByTagNameNS(mathmlNS, "mprescripts")[1]);
 28 }
 29
 30 function test6()
 31 {
 32 // Test 6: removing an extra child.
 33 var mmultiscripts = document.getElementById("test6").getElementsByTagNameNS(mathmlNS, "mmultiscripts");
 34 for (var i = 0; i < mmultiscripts.length; i++) {
 35 var extra = mmultiscripts[i].getElementsByTagNameNS(mathmlNS, "mprescripts")[1].nextSibling;
 36 for (var j = 0; j < i; j++) extra = extra.nextSibling;
 37 mmultiscripts[i].removeChild(extra);
 38 }
 39 }
 40
 41 function test7()
 42 {
 43 // Test 7: removing the base.
 44 var mmultiscripts = document.getElementById("test7").getElementsByTagNameNS(mathmlNS, "mmultiscripts");
 45 for (var i = 0; i < mmultiscripts.length; i++) {
 46 var base = mmultiscripts[i].firstChild;
 47 mmultiscripts[i].removeChild(base);
 48 }
 49 }
 50
 51 function test8()
 52 {
 53 // Test 8: removing a postscript/prescript
 54 var mmultiscripts = document.getElementById("test8").getElementsByTagNameNS(mathmlNS, "mmultiscripts");
 55 for (var i = 0; i < mmultiscripts.length; i++) {
 56 var script = mmultiscripts[i].getElementsByTagNameNS(mathmlNS, "mn")[i];
 57 mmultiscripts[i].removeChild(script);
 58 }
 59 }
 60
 61 function update()
 62 {
 63 testRemoveMPrescript(1);
 64 testRemoveMPrescript(2);
 65 testRemoveMPrescript(3);
 66 testRemoveMPrescript(4);
 67 test5();
 68 test6();
 69 test7();
 70 test8();
 71 }
 72 </script>
 73 </head>
 74
 75 <body onload="update()">
 76
 77 <!-- Test 1: removing the <mprescripts/> element.
 78 (starting with no bases or postscripts) -->
 79 <div id="test1">Test 1:
 80 <math><mmultiscripts><mprescripts/></mmultiscripts></math>
 81 <math><mmultiscripts><mprescripts/><mn>0</mn></mmultiscripts></math>
 82 <math><mmultiscripts><mprescripts/><mn>0</mn><mn>1</mn></mmultiscripts></math>
 83 <math><mmultiscripts><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn></mmultiscripts></math>
 84 <math><mmultiscripts><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn></mmultiscripts></math>
 85 <math><mmultiscripts><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn></mmultiscripts></math>
 86 <math><mmultiscripts><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/></mmultiscripts></math>
 87 <math><mmultiscripts><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn></mmultiscripts></math>
 88 <math><mmultiscripts><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 89 <math><mmultiscripts><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn></mmultiscripts></math>
 90 <math><mmultiscripts><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/></mmultiscripts></math>
 91 <math><mmultiscripts><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/><mn>9</mn></mmultiscripts></math>
 92 <math><mmultiscripts><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/><mn>9</mn><mn>10</mn></mmultiscripts></math>
 93 </div>
 94
 95 <!-- Test 2: removing the <mprescripts/> element.
 96 (starting with one base but no postscripts -->
 97 <div id="test2">Test 2:
 98 <math><mmultiscripts><mn>20</mn><mprescripts/></mmultiscripts></math>
 99 <math><mmultiscripts><mn>20</mn><mprescripts/><mn>0</mn></mmultiscripts></math>
 100 <math><mmultiscripts><mn>20</mn><mprescripts/><mn>0</mn><mn>1</mn></mmultiscripts></math>
 101 <math><mmultiscripts><mn>20</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn></mmultiscripts></math>
 102 <math><mmultiscripts><mn>20</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn></mmultiscripts></math>
 103 <math><mmultiscripts><mn>20</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn></mmultiscripts></math>
 104 <math><mmultiscripts><mn>20</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/></mmultiscripts></math>
 105 <math><mmultiscripts><mn>20</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn></mmultiscripts></math>
 106 <math><mmultiscripts><mn>20</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 107 <math><mmultiscripts><mn>20</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn></mmultiscripts></math>
 108 <math><mmultiscripts><mn>20</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/></mmultiscripts></math>
 109 <math><mmultiscripts><mn>20</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/><mn>9</mn></mmultiscripts></math>
 110 <math><mmultiscripts><mn>20</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/><mn>9</mn><mn>10</mn></mmultiscripts></math>
 111 </div>
 112
 113 <!-- Test 3: removing the <mprescripts/> element.
 114 (starting with one base but one postscript -->
 115 <div id="test3">Test 3:
 116 <math><mmultiscripts><mn>20</mn><mn>30</mn><mprescripts/></mmultiscripts></math>
 117 <math><mmultiscripts><mn>20</mn><mn>30</mn><mprescripts/><mn>0</mn></mmultiscripts></math>
 118 <math><mmultiscripts><mn>20</mn><mn>30</mn><mprescripts/><mn>0</mn><mn>1</mn></mmultiscripts></math>
 119 <math><mmultiscripts><mn>20</mn><mn>30</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn></mmultiscripts></math>
 120 <math><mmultiscripts><mn>20</mn><mn>30</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn></mmultiscripts></math>
 121 <math><mmultiscripts><mn>20</mn><mn>30</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn></mmultiscripts></math>
 122 <math><mmultiscripts><mn>20</mn><mn>30</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/></mmultiscripts></math>
 123 <math><mmultiscripts><mn>20</mn><mn>30</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn></mmultiscripts></math>
 124 <math><mmultiscripts><mn>20</mn><mn>30</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 125 <math><mmultiscripts><mn>20</mn><mn>30</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn></mmultiscripts></math>
 126 <math><mmultiscripts><mn>20</mn><mn>30</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/></mmultiscripts></math>
 127 <math><mmultiscripts><mn>20</mn><mn>30</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/><mn>9</mn></mmultiscripts></math>
 128 <math><mmultiscripts><mn>20</mn><mn>30</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/><mn>9</mn><mn>10</mn></mmultiscripts></math>
 129 </div>
 130
 131 <!-- Test 4: removing the <mprescripts/> element.
 132 (starting with one base and two postscripts) -->
 133 <div id="test4">Test 4:
 134 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mprescripts/></mmultiscripts></math>
 135 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mprescripts/><mn>0</mn></mmultiscripts></math>
 136 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mprescripts/><mn>0</mn><mn>1</mn></mmultiscripts></math>
 137 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn></mmultiscripts></math>
 138 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn></mmultiscripts></math>
 139 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn></mmultiscripts></math>
 140 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/></mmultiscripts></math>
 141 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn></mmultiscripts></math>
 142 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 143 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn></mmultiscripts></math>
 144 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/></mmultiscripts></math>
 145 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/><mn>9</mn></mmultiscripts></math>
 146 <math><mmultiscripts><mn>20</mn><mn>30</mn><mn>40</mn><mprescripts/><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mn>7</mn><mn>8</mn><mprescripts/><mn>9</mn><mn>10</mn></mmultiscripts></math>
 147 </div>
 148
 149 <!-- Test 5: removing the first extra <mprescripts/> element. -->
 150 <div id="test5">Test 5:
 151 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/></mmultiscripts></math>
 152 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn></mmultiscripts></math>
 153 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 154 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mprescripts/></mmultiscripts></math>
 155 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn></mmultiscripts></math>
 156 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mprescripts/><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn></mmultiscripts></math>
 157 </div>
 158
 159 <!-- Test 6: removing an extra child. -->
 160 <div id="test6">Test 6:
 161 <math><mmultiscripts><mn>0</mn><mprescripts/><mprescripts/><mn>1</mn><mn>2</mn><mn>3</mn></mmultiscripts></math>
 162 <math><mmultiscripts><mn>0</mn><mprescripts/><mprescripts/><mn>1</mn><mn>2</mn><mn>3</mn></mmultiscripts></math>
 163 <math><mmultiscripts><mn>0</mn><mprescripts/><mprescripts/><mn>1</mn><mn>2</mn><mn>3</mn></mmultiscripts></math>
 164 </div>
 165
 166 <!-- Test 7: removing the base. -->
 167 <div id="test7">Test 7:
 168 <math><mmultiscripts><mn>0</mn></mmultiscripts></math>
 169 <math><mmultiscripts><mn>0</mn><mn>1</mn></mmultiscripts></math>
 170 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn></mmultiscripts></math>
 171 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn></mmultiscripts></math>
 172 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn></mmultiscripts></math>
 173 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/></mmultiscripts></math>
 174 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn></mmultiscripts></math>
 175 <math><mmultiscripts><mn>0</mn><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 176 <math><mmultiscripts><mn>0</mn><mprescripts/></mmultiscripts></math>
 177 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>5</mn></mmultiscripts></math>
 178 <math><mmultiscripts><mn>0</mn><mprescripts/><mn>5</mn><mn>6</mn></mmultiscripts></math>
 179 </div>
 180
 181 <!-- Test 8: removing a postscript/prescript. -->
 182 <div id="test8">Test 8:
 183 <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math>
 184 <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math>
 185 <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math>
 186 <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math>
 187 <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math>
 188 <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math>
 189 <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math>
 190 <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math>
 191 <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math>
 192 <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math>
 193 <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math>
 194 <math><mmultiscripts><mtext>BASE</mtext><mn>1</mn><mn>2</mn><mn>3</mn><mn>4</mn><mn>5</mn><mn>6</mn><mprescripts/><mn>7</mn><mn>8</mn><mn>9</mn><mn>10</mn><mn>11</mn><mn>12</mn></mmultiscripts></math>
 195 </div>
 196
 197 </body>
 198</html>

LayoutTests/platform/mac/accessibility/mathml-multiscript-expected.txt

1 A 1 2
2 A 1 2 3
3 A 4 5
4 A 4 5 6
5 A 1 2 3 4 5 6
6 A
7 A 1 3 5 6
 1A
 21
 32
 4
 5A
 61
 72
 83
 9
 10A
 114
 125
 13
 14A
 154
 165
 176
 18
 19A
 201
 212
 223
 234
 245
 256
 26
 27A
 28
 29A
 301
 313
 325
 336
834This tests checks that mmultiscript tags will create the correct accessibility math hierarchy.
935
1036On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".

Source/WebCore/CMakeLists.txt

@@set(WebCore_SOURCES
22062206 rendering/mathml/RenderMathMLRow.cpp
22072207 rendering/mathml/RenderMathMLSpace.cpp
22082208 rendering/mathml/RenderMathMLSquareRoot.cpp
2209  rendering/mathml/RenderMathMLSubSup.cpp
 2209 rendering/mathml/RenderMathMLScripts.cpp
22102210 rendering/mathml/RenderMathMLUnderOver.cpp
22112211
22122212 rendering/shapes/PolygonShape.cpp

Source/WebCore/ChangeLog

 12013-09-14 Frédéric Wang <fred.wang@free.fr>
 2
 3 Implement the mmultiscripts tag
 4 https://bugs.webkit.org/show_bug.cgi?id=99618
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Tests: mathml/invalid-scripts-crash.html
 9 mathml/presentation/multiscripts-equivalence.html
 10 mathml/presentation/multiscripts-noscripts.html
 11 mathml/presentation/multiscripts-positions.html
 12 mathml/presentation/scripts-base-alignment.html
 13 mathml/presentation/scripts-horizontal-alignment.html
 14 mathml/presentation/scripts-vertical-alignment.html
 15 mathml/scripts-addChild.html
 16 mathml/scripts-removeChild.html
 17
 18 This relies on the existing msub/msup/msubsup code to implement the mmultiscripts tag. This also improves dynamic addition/removal of children for these MathML elements and adds a specific style for invalid children, so that they render like an merror tag. Finally, this fixes a bad memory access in the Accessibility render object of msubsup.
 19
 20 * CMakeLists.txt:
 21 * GNUmakefile.list.am:
 22 * Target.pri:
 23 * WebCore.vcxproj/WebCore.vcxproj:
 24 * WebCore.vcxproj/WebCore.vcxproj.filters:
 25 * WebCore.xcodeproj/project.pbxproj:
 26 * accessibility/AccessibilityRenderObject.cpp:
 27 (WebCore::AccessibilityRenderObject::isMathSubscriptSuperscript):
 28 (WebCore::AccessibilityRenderObject::mathSuperscriptObject):
 29 * css/mathml.css:
 30 (mo, mrow, mfenced, mfrac, msub, msup, msubsup, mmultiscripts, mprescripts, none, munder, mover, munderover, msqrt, mroot):
 31 (mover > :last-child, munderover > :last-child):
 32 (msub > * + *, msup > * + *, msubsup > * + *, mmultiscripts > * + *, munder > * + *, mover > * + *, munderover > * + *):
 33 (merror, msub > * + * + *, msup > * + * + *, msubsup > * + * + * + *, msub > mprescripts, msup > mprescripts, msubsup > mprescripts, msub > none, msup > none, msubsup > none, mmultiscripts > mprescripts ~ mprescripts, mmultiscripts > mprescripts ~ mprescripts ~ *):
 34 * mathml/MathMLInlineContainerElement.cpp:
 35 (WebCore::MathMLInlineContainerElement::createRenderer):
 36 * mathml/mathtags.in:
 37 * rendering/mathml/RenderMathMLBlock.h:
 38 (WebCore::RenderMathMLBlock::isRenderMathMLScripts):
 39 (WebCore::RenderMathMLBlock::isRenderMathMLScriptsWrapper):
 40 * rendering/mathml/RenderMathMLScripts.cpp: Added.
 41 (WebCore::isMPrescripts):
 42 (WebCore::RenderMathMLScripts::RenderMathMLScripts):
 43 (WebCore::RenderMathMLScripts::base):
 44 (WebCore::RenderMathMLScripts::fixAnonymousStyleForSubSupPair):
 45 (WebCore::RenderMathMLScripts::fixAnonymousStyles):
 46 (WebCore::RenderMathMLScripts::addChildInternal):
 47 (WebCore::RenderMathMLScripts::removeChildInternal):
 48 (WebCore::RenderMathMLScripts::addChild):
 49 (WebCore::RenderMathMLScripts::removeChild):
 50 (WebCore::RenderMathMLScripts::styleDidChange):
 51 (WebCore::RenderMathMLScripts::unembellishedOperator):
 52 (WebCore::RenderMathMLScripts::layout):
 53 (WebCore::RenderMathMLScripts::firstLineBoxBaseline):
 54 (WebCore::RenderMathMLScriptsWrapper::createAnonymousWrapper):
 55 (WebCore::RenderMathMLScriptsWrapper::addChildInternal):
 56 (WebCore::RenderMathMLScriptsWrapper::addChild):
 57 (WebCore::RenderMathMLScriptsWrapper::removeChildInternal):
 58 (WebCore::RenderMathMLScriptsWrapper::removeChild):
 59 * rendering/mathml/RenderMathMLScripts.h: Added.
 60 (WebCore::RenderMathMLScriptsWrapper::RenderMathMLScriptsWrapper):
 61 (WebCore::RenderMathMLScriptsWrapper::renderName):
 62 (WebCore::RenderMathMLScriptsWrapper::isRenderMathMLScriptsWrapper):
 63 (WebCore::toRenderMathMLScriptsWrapper):
 64 (WebCore::RenderMathMLScripts::isRenderMathMLScripts):
 65 (WebCore::RenderMathMLScripts::renderName):
 66 (WebCore::toRenderMathMLScripts):
 67 * rendering/mathml/RenderMathMLSubSup.cpp: Removed.
 68 * rendering/mathml/RenderMathMLSubSup.h: Removed.
 69
1702013-09-13 Commit Queue <commit-queue@webkit.org>
271
372 Unreviewed, rolling out r155738.

Source/WebCore/GNUmakefile.list.am

@@webcore_sources += \
45674567 Source/WebCore/rendering/mathml/RenderMathMLSpace.h \
45684568 Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.cpp \
45694569 Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.h \
4570  Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp \
4571  Source/WebCore/rendering/mathml/RenderMathMLSubSup.h \
 4570 Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp \
 4571 Source/WebCore/rendering/mathml/RenderMathMLScripts.h \
45724572 Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp \
45734573 Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h \
45744574 Source/WebCore/rendering/shapes/PolygonShape.cpp \

Source/WebCore/Target.pri

@@HEADERS += \
24152415 rendering/mathml/RenderMathMLRow.h \
24162416 rendering/mathml/RenderMathMLSpace.h \
24172417 rendering/mathml/RenderMathMLSquareRoot.h \
2418  rendering/mathml/RenderMathMLSubSup.h \
 2418 rendering/mathml/RenderMathMLScripts.h \
24192419 rendering/mathml/RenderMathMLUnderOver.h \
24202420 rendering/Pagination.h \
24212421 rendering/PaintInfo.h \

@@enable?(MATHML) {
36353635 rendering/mathml/RenderMathMLRow.cpp \
36363636 rendering/mathml/RenderMathMLSpace.cpp \
36373637 rendering/mathml/RenderMathMLSquareRoot.cpp \
3638  rendering/mathml/RenderMathMLSubSup.cpp \
 3638 rendering/mathml/RenderMathMLScripts.cpp \
36393639 rendering/mathml/RenderMathMLUnderOver.cpp
36403640
36413641 ALL_IN_ONE_SOURCES +=

Source/WebCore/WebCore.vcxproj/WebCore.vcxproj

1113811138 <ClCompile Include="..\rendering\mathml\RenderMathMLRow.cpp" />
1113911139 <ClCompile Include="..\rendering\mathml\RenderMathMLSpace.cpp" />
1114011140 <ClCompile Include="..\rendering\mathml\RenderMathMLSquareRoot.cpp" />
11141  <ClCompile Include="..\rendering\mathml\RenderMathMLSubSup.cpp" />
 11141 <ClCompile Include="..\rendering\mathml\RenderMathMLScripts.cpp" />
1114211142 <ClCompile Include="..\rendering\mathml\RenderMathMLUnderOver.cpp" />
1114311143 <ClCompile Include="..\rendering\style\BasicShapes.cpp" />
1114411144 <ClCompile Include="..\rendering\style\ContentData.cpp">

2011420114 <ClInclude Include="..\rendering\mathml\RenderMathMLRow.h" />
2011520115 <ClInclude Include="..\rendering\mathml\RenderMathMLSpace.h" />
2011620116 <ClInclude Include="..\rendering\mathml\RenderMathMLSquareRoot.h" />
20117  <ClInclude Include="..\rendering\mathml\RenderMathMLSubSup.h" />
 20117 <ClInclude Include="..\rendering\mathml\RenderMathMLScripts.h" />
2011820118 <ClInclude Include="..\rendering\mathml\RenderMathMLUnderOver.h" />
2011920119 <ClInclude Include="..\rendering\style\BasicShapes.h" />
2012020120 <ClInclude Include="..\rendering\style\BorderData.h" />

Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters

28622862 <ClCompile Include="..\rendering\mathml\RenderMathMLSquareRoot.cpp">
28632863 <Filter>rendering\mathml</Filter>
28642864 </ClCompile>
2865  <ClCompile Include="..\rendering\mathml\RenderMathMLSubSup.cpp">
 2865 <ClCompile Include="..\rendering\mathml\RenderMathMLScripts.cpp">
28662866 <Filter>rendering\mathml</Filter>
28672867 </ClCompile>
28682868 <ClCompile Include="..\rendering\mathml\RenderMathMLUnderOver.cpp">

98439843 <ClInclude Include="..\rendering\mathml\RenderMathMLSquareRoot.h">
98449844 <Filter>rendering\mathml</Filter>
98459845 </ClInclude>
9846  <ClInclude Include="..\rendering\mathml\RenderMathMLSubSup.h">
 9846 <ClInclude Include="..\rendering\mathml\RenderMathMLScripts.h">
98479847 <Filter>rendering\mathml</Filter>
98489848 </ClInclude>
98499849 <ClInclude Include="..\rendering\mathml\RenderMathMLUnderOver.h">

Source/WebCore/WebCore.xcodeproj/project.pbxproj

12901290 439046E412DA25E800AF80A2 /* RenderMathMLRow.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046D012DA25E800AF80A2 /* RenderMathMLRow.h */; };
12911291 439046E512DA25E800AF80A2 /* RenderMathMLSquareRoot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046D112DA25E800AF80A2 /* RenderMathMLSquareRoot.cpp */; };
12921292 439046E612DA25E800AF80A2 /* RenderMathMLSquareRoot.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046D212DA25E800AF80A2 /* RenderMathMLSquareRoot.h */; };
1293  439046E712DA25E800AF80A2 /* RenderMathMLSubSup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046D312DA25E800AF80A2 /* RenderMathMLSubSup.cpp */; };
1294  439046E812DA25E800AF80A2 /* RenderMathMLSubSup.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046D412DA25E800AF80A2 /* RenderMathMLSubSup.h */; };
 1293 439046E712DA25E800AF80A2 /* RenderMathMLScripts.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046D312DA25E800AF80A2 /* RenderMathMLScripts.cpp */; };
 1294 439046E812DA25E800AF80A2 /* RenderMathMLScripts.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046D412DA25E800AF80A2 /* RenderMathMLScripts.h */; };
12951295 439046E912DA25E800AF80A2 /* RenderMathMLUnderOver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046D512DA25E800AF80A2 /* RenderMathMLUnderOver.cpp */; };
12961296 439046EA12DA25E800AF80A2 /* RenderMathMLUnderOver.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046D612DA25E800AF80A2 /* RenderMathMLUnderOver.h */; };
12971297 439D334313A6911C00C20F4F /* SVGAnimatedType.h in Headers */ = {isa = PBXBuildFile; fileRef = 439D334013A6911C00C20F4F /* SVGAnimatedType.h */; };

77817781 439046D012DA25E800AF80A2 /* RenderMathMLRow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLRow.h; path = mathml/RenderMathMLRow.h; sourceTree = "<group>"; };
77827782 439046D112DA25E800AF80A2 /* RenderMathMLSquareRoot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderMathMLSquareRoot.cpp; path = mathml/RenderMathMLSquareRoot.cpp; sourceTree = "<group>"; };
77837783 439046D212DA25E800AF80A2 /* RenderMathMLSquareRoot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLSquareRoot.h; path = mathml/RenderMathMLSquareRoot.h; sourceTree = "<group>"; };
7784  439046D312DA25E800AF80A2 /* RenderMathMLSubSup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderMathMLSubSup.cpp; path = mathml/RenderMathMLSubSup.cpp; sourceTree = "<group>"; };
7785  439046D412DA25E800AF80A2 /* RenderMathMLSubSup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLSubSup.h; path = mathml/RenderMathMLSubSup.h; sourceTree = "<group>"; };
 7784 439046D312DA25E800AF80A2 /* RenderMathMLScripts.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderMathMLScripts.cpp; path = mathml/RenderMathMLScripts.cpp; sourceTree = "<group>"; };
 7785 439046D412DA25E800AF80A2 /* RenderMathMLScripts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLScripts.h; path = mathml/RenderMathMLScripts.h; sourceTree = "<group>"; };
77867786 439046D512DA25E800AF80A2 /* RenderMathMLUnderOver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderMathMLUnderOver.cpp; path = mathml/RenderMathMLUnderOver.cpp; sourceTree = "<group>"; };
77877787 439046D612DA25E800AF80A2 /* RenderMathMLUnderOver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLUnderOver.h; path = mathml/RenderMathMLUnderOver.h; sourceTree = "<group>"; };
77887788 439D334013A6911C00C20F4F /* SVGAnimatedType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedType.h; sourceTree = "<group>"; };

1441714417 331FF67DE197B57393C46AA7 /* RenderMathMLSpace.h */,
1441814418 439046D112DA25E800AF80A2 /* RenderMathMLSquareRoot.cpp */,
1441914419 439046D212DA25E800AF80A2 /* RenderMathMLSquareRoot.h */,
14420  439046D312DA25E800AF80A2 /* RenderMathMLSubSup.cpp */,
14421  439046D412DA25E800AF80A2 /* RenderMathMLSubSup.h */,
 14420 439046D312DA25E800AF80A2 /* RenderMathMLScripts.cpp */,
 14421 439046D412DA25E800AF80A2 /* RenderMathMLScripts.h */,
1442214422 439046D512DA25E800AF80A2 /* RenderMathMLUnderOver.cpp */,
1442314423 439046D612DA25E800AF80A2 /* RenderMathMLUnderOver.h */,
1442414424 );

2360523605 439046E212DA25E800AF80A2 /* RenderMathMLRoot.h in Headers */,
2360623606 439046E412DA25E800AF80A2 /* RenderMathMLRow.h in Headers */,
2360723607 439046E612DA25E800AF80A2 /* RenderMathMLSquareRoot.h in Headers */,
23608  439046E812DA25E800AF80A2 /* RenderMathMLSubSup.h in Headers */,
 23608 439046E812DA25E800AF80A2 /* RenderMathMLScripts.h in Headers */,
2360923609 439046EA12DA25E800AF80A2 /* RenderMathMLUnderOver.h in Headers */,
2361023610 E4C279590CF9741900E97B98 /* RenderMedia.h in Headers */,
2361123611 DEBCCDD216646E8200A452E1 /* RenderMediaControlElements.h in Headers */,

2680226802 439046E312DA25E800AF80A2 /* RenderMathMLRow.cpp in Sources */,
2680326803 5B7A208D2E12979B4AE19DE6 /* RenderMathMLSpace.cpp in Sources */,
2680426804 439046E512DA25E800AF80A2 /* RenderMathMLSquareRoot.cpp in Sources */,
26805  439046E712DA25E800AF80A2 /* RenderMathMLSubSup.cpp in Sources */,
 26805 439046E712DA25E800AF80A2 /* RenderMathMLScripts.cpp in Sources */,
2680626806 439046E912DA25E800AF80A2 /* RenderMathMLUnderOver.cpp in Sources */,
2680726807 E4C279580CF9741900E97B98 /* RenderMedia.cpp in Sources */,
2680826808 DE49B309165F2FE10010338D /* RenderMediaControlElements.cpp in Sources */,

Source/WebCore/accessibility/AccessibilityRenderObject.cpp

@@bool AccessibilityRenderObject::isMathSubscriptSuperscript() const
34343434 if (!m_renderer || !m_renderer->isRenderMathMLBlock())
34353435 return false;
34363436
3437  return toRenderMathMLBlock(m_renderer)->isRenderMathMLSubSup();
 3437 return toRenderMathMLBlock(m_renderer)->isRenderMathMLScripts() && !isMathMultiscript();
34383438}
34393439
34403440bool AccessibilityRenderObject::isMathRow() const

@@AccessibilityObject* AccessibilityRenderObject::mathSuperscriptObject()
36903690 return 0;
36913691
36923692 AccessibilityChildrenVector children = this->children();
3693  if (children.size() < 2)
3694  return 0;
3695 
3696  if (node()->hasTagName(MathMLNames::msupTag))
 3693 unsigned count = children.size();
 3694
 3695 if (count >= 2 && node()->hasTagName(MathMLNames::msupTag))
36973696 return children[1].get();
3698  if (node()->hasTagName(MathMLNames::msubsupTag))
 3697
 3698 if (count >= 3 && node()->hasTagName(MathMLNames::msubsupTag))
36993699 return children[2].get();
37003700
37013701 return 0;

Source/WebCore/css/mathml.css

@@math[display="block"] {
3232 -webkit-margin-after: 1em;
3333}
3434
35 mo, mrow, mfenced, mfrac, msub, msup, msubsup, munder, mover, munderover, msqrt, mroot {
 35mo, mrow, mfenced, mfrac, msub, msup, msubsup, mmultiscripts, mprescripts, none, munder, mover, munderover, msqrt, mroot {
3636 display: -webkit-inline-flex !important;
3737}
3838
39 msup {
40  -webkit-align-items: flex-start;
41 }
42 
43 msub {
44  -webkit-align-items: flex-end;
45 }
46 
4739math, mrow, mfenced, msqrt, mroot {
4840 -webkit-align-items: baseline;
4941}

@@mfrac {
8577 -webkit-margin-end: 1px;
8678}
8779
88 msubsup > :last-child, mover > :last-child, munderover > :last-child {
 80mover > :last-child, munderover > :last-child {
8981 -webkit-order: -1;
9082}
9183
92 msub > * + *, msup > * + *, msubsup > * + *, munder > * + *, mover > * + *, munderover > * + * {
 84msub > * + *, msup > * + *, msubsup > * + *, mmultiscripts > * + *, munder > * + *, mover > * + *, munderover > * + * {
9385 font-size: 0.75em; /* FIXME: MathML standard is 0.71em */
9486}
9587

@@mphantom {
169161 visibility: hidden;
170162}
171163
172 merror {
 164/* This is a special style for erroneous markup:
 165 - <merror> element.
 166 - extra children in script elements.
 167 - <mprescripts/> and <none/> elements in msub/msup/msubsup.
 168 */
 169merror, msub > * + * + *, msup > * + * + *, msubsup > * + * + * + *, msub > mprescripts, msup > mprescripts, msubsup > mprescripts, msub > none, msup > none, msubsup > none, mmultiscripts > mprescripts ~ mprescripts, mmultiscripts > mprescripts ~ mprescripts ~ * {
173170 outline: solid thin red;
174171 font-weight: bold;
175172 font-family: sans-serif;

Source/WebCore/mathml/MathMLInlineContainerElement.cpp

3636#include "RenderMathMLFraction.h"
3737#include "RenderMathMLRoot.h"
3838#include "RenderMathMLRow.h"
 39#include "RenderMathMLScripts.h"
3940#include "RenderMathMLSquareRoot.h"
40 #include "RenderMathMLSubSup.h"
4141#include "RenderMathMLUnderOver.h"
4242
4343namespace WebCore {

@@RenderObject* MathMLInlineContainerElement::createRenderer(RenderArena* arena, R
5959 if (hasLocalName(mrowTag))
6060 return new (arena) RenderMathMLRow(this);
6161 if (hasLocalName(msubTag))
62  return new (arena) RenderMathMLSubSup(this);
 62 return new (arena) RenderMathMLScripts(this);
6363 if (hasLocalName(msupTag))
64  return new (arena) RenderMathMLSubSup(this);
 64 return new (arena) RenderMathMLScripts(this);
6565 if (hasLocalName(msubsupTag))
66  return new (arena) RenderMathMLSubSup(this);
 66 return new (arena) RenderMathMLScripts(this);
 67 if (hasLocalName(mmultiscriptsTag))
 68 return new (arena) RenderMathMLScripts(this);
6769 if (hasLocalName(moverTag))
6870 return new (arena) RenderMathMLUnderOver(this);
6971 if (hasLocalName(munderTag))

Source/WebCore/mathml/mathtags.in

@@mtable interfaceName=MathMLInlineContainerElement
2424mtr interfaceName=MathMLElement
2525mtd interfaceName=MathMLElement
2626mmultiscripts interfaceName=MathMLInlineContainerElement
27 mprescripts interfaceName=MathMLElement
28 none interfaceName=MathMLElement
 27mprescripts interfaceName=MathMLInlineContainerElement
 28none interfaceName=MathMLInlineContainerElement
2929
3030#if 0 // Curently only for MathMLNames used by HTMLTreeBuilder.
3131ms

Source/WebCore/rendering/mathml/RenderMathMLBlock.h

@@public:
5454 virtual bool isRenderMathMLRoot() const { return false; }
5555 virtual bool isRenderMathMLSpace() const { return false; }
5656 virtual bool isRenderMathMLSquareRoot() const { return false; }
57  virtual bool isRenderMathMLSubSup() const { return false; }
 57 virtual bool isRenderMathMLScripts() const { return false; }
 58 virtual bool isRenderMathMLScriptsWrapper() const { return false; }
5859 virtual bool isRenderMathMLUnderOver() const { return false; }
5960
6061 // MathML defines an "embellished operator" as roughly an <mo> that may have subscripts,

Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp

 1/*
 2 * Copyright (C) 2010 Alex Milowski (alex@milowski.com). All rights reserved.
 3 * Copyright (C) 2013 The MathJax Consortium.
 4 *
 5 * Redistribution and use in source and binary forms, with or without
 6 * modification, are permitted provided that the following conditions
 7 * are met:
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 *
 14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 15 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 16 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 17 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 18 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 19 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 20 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 25 */
 26
 27#include "config.h"
 28
 29#if ENABLE(MATHML)
 30
 31#include "RenderMathMLScripts.h"
 32
 33#include "MathMLNames.h"
 34
 35namespace WebCore {
 36
 37using namespace MathMLNames;
 38
 39// RenderMathMLScripts implements various MathML elements drawing scripts attached to a base. For valid MathML elements, the structure of the render tree should be:
 40//
 41// - msub, msup, msubsup: BaseWrapper SubSupPairWrapper
 42// - mmultiscripts: BaseWrapper SubSupPairWrapper* (mprescripts SubSupPairWrapper*)*
 43//
 44// where BaseWrapper and SubSupPairWrapper do not contain any <mprescripts/> children. In addition, BaseWrapper must have one child and SubSupPairWrapper must have either one child (msub, msup) or two children (msubsup, mmultiscripts).
 45//
 46// In order to accept invalid markup and to handle the script elements consistently and uniformly, we will use a more general structure that encompasses both valid and invalid elements:
 47//
 48// BaseWrapper SubSupPairWrapper* (mprescripts SubSupPairWrapper*)*
 49//
 50// where BaseWrapper can now be empty and SubSupPairWrapper can now have one or two elements.
 51//
 52
 53static bool isPrescript(RenderObject* renderObject)
 54{
 55 ASSERT(renderObject);
 56 return renderObject->node() && renderObject->node()->hasTagName(MathMLNames::mprescriptsTag);
 57}
 58
 59RenderMathMLScripts::RenderMathMLScripts(Element* element)
 60 : RenderMathMLBlock(element)
 61 , m_baseWrapper(0)
 62{
 63 // Determine what kind of sub/sup expression we have by element name
 64 if (element->hasLocalName(MathMLNames::msubTag))
 65 m_kind = Sub;
 66 else if (element->hasLocalName(MathMLNames::msupTag))
 67 m_kind = Super;
 68 else if (element->hasLocalName(MathMLNames::msubsupTag))
 69 m_kind = SubSup;
 70 else {
 71 ASSERT(element->hasLocalName(MathMLNames::mmultiscriptsTag));
 72 m_kind = Multiscripts;
 73 }
 74}
 75
 76RenderBoxModelObject* RenderMathMLScripts::base() const
 77{
 78 if (!m_baseWrapper)
 79 return 0;
 80 RenderObject* base = m_baseWrapper->firstChild();
 81 if (!base || !base->isBoxModelObject())
 82 return 0;
 83 return toRenderBoxModelObject(base);
 84}
 85
 86void RenderMathMLScripts::fixAnonymousStyleForSubSupPair(RenderObject* subSupPair, bool isPostScript)
 87{
 88 ASSERT(subSupPair && subSupPair->style()->refCount() == 1);
 89 RenderStyle* scriptsStyle = subSupPair->style();
 90
 91 // subSup pairs are drawn in column from bottom (subscript) to top (superscript).
 92 scriptsStyle->setFlexDirection(FlowColumnReverse);
 93
 94 // The MathML specification does not specify horizontal alignment of
 95 // scripts. We align the bottom (respectively top) edge of the subscript
 96 // (respectively superscript) with the bottom (respectively top) edge of
 97 // the flex container. Note that for valid <msub> and <msup> elements, the
 98 // subSupPair should actually have only one script.
 99 scriptsStyle->setJustifyContent(m_kind == Sub ? JustifyFlexStart : m_kind == Super ? JustifyFlexEnd : JustifySpaceBetween);
 100
 101 // The MathML specification does not specify vertical alignment of scripts.
 102 // Let's right align prescripts and left align postscripts.
 103 // See http://lists.w3.org/Archives/Public/www-math/2012Aug/0006.html
 104 scriptsStyle->setAlignItems(isPostScript ? AlignFlexStart : AlignFlexEnd);
 105
 106 // We set the order property so that the prescripts are drawn before the base.
 107 scriptsStyle->setOrder(isPostScript ? 0 : -1);
 108
 109 // We set this wrapper's font-size for its line-height.
 110 LayoutUnit scriptSize = static_cast<int>(0.75 * style()->fontSize());
 111 scriptsStyle->setFontSize(scriptSize);
 112}
 113
 114void RenderMathMLScripts::fixAnonymousStyles()
 115{
 116 // We set the base wrapper's style so that baseHeight in layout() will be an unstretched height.
 117 ASSERT(m_baseWrapper && m_baseWrapper->style()->hasOneRef());
 118 m_baseWrapper->style()->setAlignSelf(AlignFlexStart);
 119
 120 // This sets the style for postscript pairs.
 121 RenderObject* subSupPair = m_baseWrapper;
 122 for (subSupPair = subSupPair->nextSibling(); subSupPair && !isPrescript(subSupPair); subSupPair = subSupPair->nextSibling())
 123 fixAnonymousStyleForSubSupPair(subSupPair, true);
 124
 125 if (subSupPair && m_kind == Multiscripts) {
 126 // This sets the style for prescript pairs.
 127 for (subSupPair = subSupPair->nextSibling(); subSupPair && !isPrescript(subSupPair); subSupPair = subSupPair->nextSibling())
 128 fixAnonymousStyleForSubSupPair(subSupPair, false);
 129 }
 130
 131 // This resets style for extra subSup pairs.
 132 for (; subSupPair; subSupPair = subSupPair->nextSibling()) {
 133 if (!isPrescript(subSupPair)) {
 134 ASSERT(subSupPair && subSupPair->style()->refCount() == 1);
 135 RenderStyle* scriptsStyle = subSupPair->style();
 136 scriptsStyle->setFlexDirection(FlowRow);
 137 scriptsStyle->setJustifyContent(JustifyFlexStart);
 138 scriptsStyle->setAlignItems(AlignCenter);
 139 scriptsStyle->setOrder(0);
 140 scriptsStyle->setFontSize(style()->fontSize());
 141 }
 142 }
 143}
 144
 145void RenderMathMLScripts::addChildInternal(bool doNotRestructure, RenderObject* child, RenderObject* beforeChild)
 146{
 147 if (doNotRestructure) {
 148 RenderMathMLBlock::addChild(child, beforeChild);
 149 return;
 150 }
 151
 152 if (beforeChild) {
 153 // beforeChild may be a grandchild, so we call the addChild function of the corresponding wrapper instead.
 154 RenderObject* parent = beforeChild->parent();
 155 if (parent != this) {
 156 RenderMathMLScriptsWrapper* wrapper = toRenderMathMLScriptsWrapper(parent);
 157 wrapper->addChildInternal(false, child, beforeChild);
 158 return;
 159 }
 160 }
 161
 162 if (beforeChild == m_baseWrapper) {
 163 // This is like inserting the child at the beginning of the base wrapper.
 164 m_baseWrapper->addChildInternal(false, child, m_baseWrapper->firstChild());
 165 return;
 166 }
 167
 168 if (isPrescript(child)) {
 169 // The new child becomes an <mprescripts/> separator.
 170 RenderMathMLBlock::addChild(child, beforeChild);
 171 return;
 172 }
 173
 174 if (!beforeChild || isPrescript(beforeChild)) {
 175 // We are at the end of a sequence of subSup pairs.
 176 RenderMathMLBlock* previousSibling = toRenderMathMLBlock(beforeChild ? beforeChild->previousSibling() : lastChild());
 177 if (previousSibling && previousSibling->isRenderMathMLScriptsWrapper()) {
 178 RenderMathMLScriptsWrapper* wrapper = toRenderMathMLScriptsWrapper(previousSibling);
 179 if ((wrapper->m_kind == RenderMathMLScriptsWrapper::Base && wrapper->isEmpty()) || (wrapper->m_kind == RenderMathMLScriptsWrapper::SubSupPair && !wrapper->firstChild()->nextSibling())) {
 180 // The previous sibling is either an empty base or a SubSup pair with a single child so we can insert the new child into that wrapper.
 181 wrapper->addChildInternal(true, child);
 182 return;
 183 }
 184 }
 185 // Otherwise we create a new subSupPair to store the new child.
 186 RenderMathMLScriptsWrapper* subSupPair = RenderMathMLScriptsWrapper::createAnonymousWrapper(this, RenderMathMLScriptsWrapper::SubSupPair);
 187 subSupPair->addChildInternal(true, child);
 188 RenderMathMLBlock::addChild(subSupPair, beforeChild);
 189 return;
 190 }
 191
 192 // beforeChild is a subSup pair. This is like inserting the new child at the beginning of the subSup wrapper.
 193 RenderMathMLScriptsWrapper* wrapper = toRenderMathMLScriptsWrapper(beforeChild);
 194 ASSERT(wrapper->m_kind == RenderMathMLScriptsWrapper::SubSupPair);
 195 ASSERT(!(m_baseWrapper->isEmpty() && m_baseWrapper->nextSibling() == beforeChild));
 196 wrapper->addChildInternal(false, child, wrapper->firstChild());
 197}
 198
 199void RenderMathMLScripts::removeChildInternal(bool doNotRestructure, RenderObject* child)
 200{
 201 if (doNotRestructure) {
 202 RenderMathMLBlock::removeChild(child);
 203 return;
 204 }
 205
 206 ASSERT(isPrescript(child));
 207
 208 RenderObject* previousSibling = child->previousSibling();
 209 RenderObject* nextSibling = child->nextSibling();
 210 ASSERT(previousSibling);
 211
 212 if (nextSibling && !isPrescript(previousSibling) && !isPrescript(nextSibling)) {
 213 RenderMathMLScriptsWrapper* previousWrapper = toRenderMathMLScriptsWrapper(previousSibling);
 214 RenderMathMLScriptsWrapper* nextWrapper = toRenderMathMLScriptsWrapper(nextSibling);
 215 ASSERT(nextWrapper->m_kind == RenderMathMLScriptsWrapper::SubSupPair && !nextWrapper->isEmpty());
 216 if ((previousWrapper->m_kind == RenderMathMLScriptsWrapper::Base && previousWrapper->isEmpty()) || (previousWrapper->m_kind == RenderMathMLScriptsWrapper::SubSupPair && !previousWrapper->firstChild()->nextSibling())) {
 217 RenderObject* script = nextWrapper->firstChild();
 218 nextWrapper->removeChildInternal(false, script);
 219 previousWrapper->addChildInternal(true, script);
 220 }
 221 }
 222
 223 RenderMathMLBlock::removeChild(child);
 224}
 225
 226void RenderMathMLScripts::addChild(RenderObject* child, RenderObject* beforeChild)
 227{
 228 if (isEmpty()) {
 229 m_baseWrapper = RenderMathMLScriptsWrapper::createAnonymousWrapper(this, RenderMathMLScriptsWrapper::Base);
 230 RenderMathMLBlock::addChild(m_baseWrapper);
 231 }
 232
 233 addChildInternal(false, child, beforeChild);
 234
 235 fixAnonymousStyles();
 236}
 237
 238void RenderMathMLScripts::removeChild(RenderObject* child)
 239{
 240 if (beingDestroyed() || documentBeingDestroyed()) {
 241 // The renderer is being destroyed so we remove the child normally.
 242 RenderMathMLBlock::removeChild(child);
 243 return;
 244 }
 245
 246 removeChildInternal(false, child);
 247
 248 fixAnonymousStyles();
 249}
 250
 251void RenderMathMLScripts::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
 252{
 253 RenderMathMLBlock::styleDidChange(diff, oldStyle);
 254
 255 if (!isEmpty())
 256 fixAnonymousStyles();
 257}
 258
 259RenderMathMLOperator* RenderMathMLScripts::unembellishedOperator()
 260{
 261 RenderBoxModelObject* base = this->base();
 262 if (!base || !base->isRenderMathMLBlock())
 263 return 0;
 264 return toRenderMathMLBlock(base)->unembellishedOperator();
 265}
 266
 267void RenderMathMLScripts::layout()
 268{
 269 RenderMathMLBlock::layout();
 270
 271 if (!m_baseWrapper)
 272 return;
 273 RenderBox* base = m_baseWrapper->firstChildBox();
 274 if (!base)
 275 return;
 276
 277 // Our layout rules include: Don't let the superscript go below the "axis" (half x-height above the
 278 // baseline), or the subscript above the axis. Also, don't let the superscript's top edge be
 279 // below the base's top edge, or the subscript's bottom edge above the base's bottom edge.
 280 //
 281 // FIXME: Check any subscriptshift or superscriptshift attributes, and maybe use more sophisticated
 282 // heuristics from TeX or elsewhere. See https://bugs.webkit.org/show_bug.cgi?id=79274#c5.
 283
 284 LayoutUnit baseHeight = base->logicalHeight();
 285 LayoutUnit baseBaseline = base->firstLineBoxBaseline();
 286 if (baseBaseline == -1)
 287 baseBaseline = baseHeight;
 288 LayoutUnit axis = style()->fontMetrics().xHeight() / 2;
 289 int fontSize = style()->fontSize();
 290
 291 ASSERT(m_baseWrapper->style()->hasOneRef());
 292 bool needsSecondLayout = false;
 293
 294 LayoutUnit topPadding = 0;
 295 LayoutUnit bottomPadding = 0;
 296
 297 bool isPostScript = true;
 298 RenderMathMLBlock* subSupPair = toRenderMathMLBlock(m_baseWrapper->nextSibling());
 299 for (; subSupPair; subSupPair = toRenderMathMLBlock(subSupPair->nextSibling())) {
 300
 301 // We skip the base and <mprescripts/> elements.
 302 if (isPrescript(subSupPair)) {
 303 if (!isPostScript)
 304 break;
 305 isPostScript = false;
 306 continue;
 307 }
 308
 309 if (RenderBox* superscript = m_kind == Sub ? 0 : subSupPair->lastChildBox()) {
 310 LayoutUnit superscriptHeight = superscript->logicalHeight();
 311 LayoutUnit superscriptBaseline = superscript->firstLineBoxBaseline();
 312 if (superscriptBaseline == -1)
 313 superscriptBaseline = superscriptHeight;
 314 LayoutUnit minBaseline = max<LayoutUnit>(fontSize / 3 + 1 + superscriptBaseline, superscriptHeight + axis);
 315
 316 topPadding = max<LayoutUnit>(topPadding, minBaseline - baseBaseline);
 317 }
 318
 319 if (RenderBox* subscript = m_kind == Super ? 0 : subSupPair->firstChildBox()) {
 320 LayoutUnit subscriptHeight = subscript->logicalHeight();
 321 LayoutUnit subscriptBaseline = subscript->firstLineBoxBaseline();
 322 if (subscriptBaseline == -1)
 323 subscriptBaseline = subscriptHeight;
 324 LayoutUnit baseExtendUnderBaseline = baseHeight - baseBaseline;
 325 LayoutUnit subscriptUnderItsBaseline = subscriptHeight - subscriptBaseline;
 326 LayoutUnit minExtendUnderBaseline = max<LayoutUnit>(fontSize / 5 + 1 + subscriptUnderItsBaseline, subscriptHeight - axis);
 327
 328 bottomPadding = max<LayoutUnit>(bottomPadding, minExtendUnderBaseline - baseExtendUnderBaseline);
 329 }
 330 }
 331
 332 Length newPadding(topPadding, Fixed);
 333 if (newPadding != m_baseWrapper->style()->paddingTop()) {
 334 m_baseWrapper->style()->setPaddingTop(newPadding);
 335 needsSecondLayout = true;
 336 }
 337
 338 newPadding = Length(bottomPadding, Fixed);
 339 if (newPadding != m_baseWrapper->style()->paddingBottom()) {
 340 m_baseWrapper->style()->setPaddingBottom(newPadding);
 341 needsSecondLayout = true;
 342 }
 343
 344 if (!needsSecondLayout)
 345 return;
 346
 347 setNeedsLayout(true, MarkOnlyThis);
 348 m_baseWrapper->setChildNeedsLayout(true, MarkOnlyThis);
 349
 350 RenderMathMLBlock::layout();
 351}
 352
 353int RenderMathMLScripts::firstLineBoxBaseline() const
 354{
 355 if (m_baseWrapper) {
 356 LayoutUnit baseline = m_baseWrapper->firstLineBoxBaseline();
 357 if (baseline != -1)
 358 return baseline;
 359 }
 360 return RenderMathMLBlock::firstLineBoxBaseline();
 361}
 362
 363RenderMathMLScriptsWrapper* RenderMathMLScriptsWrapper::createAnonymousWrapper(RenderMathMLScripts* renderObject, WrapperType type)
 364{
 365 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(renderObject->style(), FLEX);
 366 RenderMathMLScriptsWrapper* newBlock = new (renderObject->renderArena()) RenderMathMLScriptsWrapper(0, type);
 367 newBlock->setDocumentForAnonymous(&renderObject->document());
 368 newBlock->setStyle(newStyle.release());
 369 return newBlock;
 370}
 371
 372void RenderMathMLScriptsWrapper::addChildInternal(bool doNotRestructure, RenderObject* child, RenderObject* beforeChild)
 373{
 374 if (doNotRestructure) {
 375 RenderMathMLBlock::addChild(child, beforeChild);
 376 return;
 377 }
 378
 379 RenderMathMLScripts* parentNode = toRenderMathMLScripts(parent());
 380
 381 if (m_kind == Base) {
 382 RenderObject* sibling = nextSibling();
 383
 384 if (!isEmpty() && !beforeChild) {
 385 // This is like inserting the child after the base wrapper.
 386 parentNode->addChildInternal(false, sibling);
 387 return;
 388 }
 389
 390 // The old base (if any) becomes a script ; the new child becomes either the base or an <mprescripts> separator.
 391 RenderObject* oldBase = firstChild();
 392 if (oldBase)
 393 RenderMathMLBlock::removeChild(oldBase);
 394 if (isPrescript(child))
 395 parentNode->addChildInternal(true, child, sibling);
 396 else
 397 RenderMathMLBlock::addChild(child);
 398 if (oldBase)
 399 parentNode->addChildInternal(false, oldBase, sibling);
 400 return;
 401 }
 402
 403 if (isPrescript(child)) {
 404 // We insert an <mprescripts> element.
 405 if (!beforeChild)
 406 parentNode->addChildInternal(true, child, nextSibling());
 407 else if (beforeChild == firstChild())
 408 parentNode->addChildInternal(true, child, this);
 409 else {
 410 // We insert the <mprescripts> in the middle of a subSup pair so we must split that pair.
 411 RenderObject* sibling = nextSibling();
 412 parentNode->removeChildInternal(true, this);
 413 parentNode->addChildInternal(true, child, sibling);
 414
 415 RenderObject* script = firstChild();
 416 RenderMathMLBlock::removeChild(script);
 417 parentNode->addChildInternal(false, script, child);
 418
 419 script = beforeChild;
 420 RenderMathMLBlock::removeChild(script);
 421 parentNode->addChildInternal(false, script, sibling);
 422 destroy();
 423 }
 424 return;
 425 }
 426
 427 // We first move to the last subSup pair in the curent sequence of scripts.
 428 RenderMathMLScriptsWrapper* subSupPair = this;
 429 while (subSupPair->nextSibling() && !isPrescript(subSupPair->nextSibling()))
 430 subSupPair = toRenderMathMLScriptsWrapper(subSupPair->nextSibling());
 431 if (subSupPair->firstChild()->nextSibling()) {
 432 // The last pair has two children so we need to create a new pair to leave room for the new child.
 433 RenderMathMLScriptsWrapper* newPair = createAnonymousWrapper(parentNode, RenderMathMLScriptsWrapper::SubSupPair);
 434 parentNode->addChildInternal(true, newPair, subSupPair->nextSibling());
 435 subSupPair = newPair;
 436 }
 437
 438 // We shift the successors in the current sequence of scripts.
 439 for (RenderObject* previousSibling = subSupPair->previousSibling(); subSupPair != this; previousSibling = previousSibling->previousSibling()) {
 440 RenderMathMLScriptsWrapper* previousSubSupPair = toRenderMathMLScriptsWrapper(previousSibling);
 441 RenderObject* script = previousSubSupPair->lastChild();
 442 previousSubSupPair->removeChildInternal(true, script);
 443 subSupPair->addChildInternal(true, script, subSupPair->firstChild());
 444 subSupPair = toRenderMathMLScriptsWrapper(previousSibling);
 445 }
 446
 447 // This subSup pair now contain one element which is either beforeChild or the script that was before. Hence we can insert the new child before of after that element.
 448 RenderMathMLBlock::addChild(child, firstChild() == beforeChild ? beforeChild : 0);
 449}
 450
 451void RenderMathMLScriptsWrapper::addChild(RenderObject* child, RenderObject* beforeChild)
 452{
 453 RenderMathMLScripts* parentNode = toRenderMathMLScripts(parent());
 454
 455 addChildInternal(false, child, beforeChild);
 456
 457 parentNode->fixAnonymousStyles();
 458}
 459
 460void RenderMathMLScriptsWrapper::removeChildInternal(bool doNotRestructure, RenderObject* child)
 461{
 462 if (doNotRestructure) {
 463 RenderMathMLBlock::removeChild(child);
 464 return;
 465 }
 466
 467 RenderMathMLScripts* parentNode = toRenderMathMLScripts(parent());
 468
 469 if (m_kind == Base) {
 470 // We remove the child from the base wrapper.
 471 RenderObject* sibling = nextSibling();
 472 RenderMathMLBlock::removeChild(child);
 473 if (sibling && !isPrescript(sibling)) {
 474 // If there are postscripts, the first one becomes the base.
 475 RenderMathMLScriptsWrapper* wrapper = toRenderMathMLScriptsWrapper(sibling);
 476 RenderObject* script = wrapper->firstChild();
 477 wrapper->removeChildInternal(false, script);
 478 RenderMathMLBlock::addChild(script);
 479 }
 480 return;
 481 }
 482
 483 // We remove the child and shift the successors in the current sequence of scripts.
 484 RenderMathMLBlock::removeChild(child);
 485 RenderMathMLScriptsWrapper* subSupPair = this;
 486 for (RenderObject* nextSibling = subSupPair->nextSibling(); nextSibling && !isPrescript(nextSibling); nextSibling = nextSibling->nextSibling()) {
 487 RenderMathMLScriptsWrapper* nextSubSupPair = toRenderMathMLScriptsWrapper(nextSibling);
 488 RenderObject* script = nextSubSupPair->firstChild();
 489 nextSubSupPair->removeChildInternal(true, script);
 490 subSupPair->addChildInternal(true, script);
 491 subSupPair = toRenderMathMLScriptsWrapper(nextSibling);
 492 }
 493
 494 // We remove the last subSup pair if it became empty.
 495 if (subSupPair->isEmpty()) {
 496 parentNode->removeChildInternal(true, subSupPair);
 497 subSupPair->destroy();
 498 }
 499}
 500
 501void RenderMathMLScriptsWrapper::removeChild(RenderObject* child)
 502{
 503 if (beingDestroyed() || documentBeingDestroyed()) {
 504 // The renderer is being destroyed so we remove the child normally.
 505 RenderMathMLBlock::removeChild(child);
 506 return;
 507 }
 508
 509 RenderMathMLScripts* parentNode = toRenderMathMLScripts(parent());
 510
 511 removeChildInternal(false, child);
 512
 513 parentNode->fixAnonymousStyles();
 514}
 515
 516}
 517
 518#endif // ENABLE(MATHML)

Source/WebCore/rendering/mathml/RenderMathMLScripts.h

 1/*
 2 * Copyright (C) 2010 Alex Milowski (alex@milowski.com). All rights reserved.
 3 * Copyright (C) 2013 The MathJax Consortium.
 4 *
 5 * Redistribution and use in source and binary forms, with or without
 6 * modification, are permitted provided that the following conditions
 7 * are met:
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 *
 14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 15 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 16 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 17 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 18 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 19 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 20 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 25 */
 26
 27#ifndef RenderMathMLScripts_h
 28#define RenderMathMLScripts_h
 29
 30#if ENABLE(MATHML)
 31
 32#include "RenderMathMLBlock.h"
 33
 34namespace WebCore {
 35
 36class RenderMathMLScripts;
 37
 38class RenderMathMLScriptsWrapper : public RenderMathMLBlock {
 39
 40friend class RenderMathMLScripts;
 41
 42public:
 43 enum WrapperType { Base, SubSupPair };
 44
 45 RenderMathMLScriptsWrapper(Element* element, WrapperType kind) :
 46 RenderMathMLBlock(element), m_kind(kind) { };
 47
 48 virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0) OVERRIDE;
 49 virtual void removeChild(RenderObject*) OVERRIDE;
 50
 51private:
 52 static RenderMathMLScriptsWrapper* createAnonymousWrapper(RenderMathMLScripts* renderObject, WrapperType);
 53
 54 void addChildInternal(bool normalInsertion, RenderObject* child, RenderObject* beforeChild = 0);
 55 void removeChildInternal(bool normalRemoval, RenderObject* child);
 56
 57 virtual const char* renderName() const { return (m_kind == Base ? "Base Wrapper" : "SubSupPair Wrapper"); }
 58
 59 virtual bool isRenderMathMLScriptsWrapper() const OVERRIDE FINAL { return true; }
 60
 61 RenderMathMLScripts* parentMathMLScripts();
 62
 63 WrapperType m_kind;
 64};
 65
 66inline RenderMathMLScriptsWrapper* toRenderMathMLScriptsWrapper(RenderMathMLBlock* block)
 67{
 68 ASSERT_WITH_SECURITY_IMPLICATION(!block || block->isRenderMathMLScriptsWrapper());
 69 return static_cast<RenderMathMLScriptsWrapper*>(block);
 70}
 71
 72inline const RenderMathMLScriptsWrapper* toRenderMathMLScriptsWrapper(const RenderMathMLBlock* block)
 73{
 74 ASSERT_WITH_SECURITY_IMPLICATION(!block || block->isRenderMathMLScriptsWrapper());
 75 return static_cast<const RenderMathMLScriptsWrapper*>(block);
 76}
 77
 78inline RenderMathMLScriptsWrapper* toRenderMathMLScriptsWrapper(RenderObject* object)
 79{
 80 return toRenderMathMLScriptsWrapper(toRenderMathMLBlock(object));
 81}
 82
 83inline const RenderMathMLScriptsWrapper* toRenderMathMLScriptsWrapper(const RenderObject* object)
 84{
 85 return toRenderMathMLScriptsWrapper(toRenderMathMLBlock(object));
 86}
 87
 88// This will catch anyone doing an unnecessary cast.
 89void toRenderMathMLScriptsWrapper(const RenderMathMLScriptsWrapper*);
 90
 91// Render a base with scripts.
 92class RenderMathMLScripts : public RenderMathMLBlock {
 93
 94friend class RenderMathMLScriptsWrapper;
 95
 96public:
 97 RenderMathMLScripts(Element*);
 98 virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0) OVERRIDE;
 99 virtual void removeChild(RenderObject*) OVERRIDE;
 100
 101 virtual RenderMathMLOperator* unembellishedOperator();
 102 virtual int firstLineBoxBaseline() const OVERRIDE;
 103
 104protected:
 105 virtual void layout();
 106
 107private:
 108 void addChildInternal(bool normalInsertion, RenderObject* child, RenderObject* beforeChild = 0);
 109 void removeChildInternal(bool normalRemoval, RenderObject* child);
 110
 111 virtual bool isRenderMathMLScripts() const OVERRIDE { return true; }
 112 void fixAnonymousStyleForSubSupPair(RenderObject* subSupPair, bool isPostScript);
 113 void fixAnonymousStyles();
 114
 115 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OVERRIDE;
 116
 117 virtual const char* renderName() const { return "RenderMathMLScripts"; }
 118
 119 // Omit our subscript and/or superscript. This may return 0 for a non-MathML base (which
 120 // won't occur in valid MathML).
 121 RenderBoxModelObject* base() const;
 122
 123 enum ScriptsType { Sub, Super, SubSup, Multiscripts };
 124
 125 ScriptsType m_kind;
 126 RenderMathMLScriptsWrapper* m_baseWrapper;
 127};
 128
 129inline RenderMathMLScripts* toRenderMathMLScripts(RenderMathMLBlock* block)
 130{
 131 ASSERT_WITH_SECURITY_IMPLICATION(!block || block->isRenderMathMLScripts());
 132 return static_cast<RenderMathMLScripts*>(block);
 133}
 134
 135inline const RenderMathMLScripts* toRenderMathMLScripts(const RenderMathMLBlock* block)
 136{
 137 ASSERT_WITH_SECURITY_IMPLICATION(!block || block->isRenderMathMLScripts());
 138 return static_cast<const RenderMathMLScripts*>(block);
 139}
 140
 141inline RenderMathMLScripts* toRenderMathMLScripts(RenderObject* object)
 142{
 143 return toRenderMathMLScripts(toRenderMathMLBlock(object));
 144}
 145
 146inline const RenderMathMLScripts* toRenderMathMLScripts(const RenderObject* object)
 147{
 148 return toRenderMathMLScripts(toRenderMathMLBlock(object));
 149}
 150
 151// This will catch anyone doing an unnecessary cast.
 152void toRenderMathMLScripts(const RenderMathMLScripts*);
 153
 154}
 155
 156#endif // ENABLE(MATHML)
 157
 158#endif // RenderMathMLScripts_h

Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp

1 /*
2  * Copyright (C) 2010 Alex Milowski (alex@milowski.com). All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
17  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
19  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25 
26 #include "config.h"
27 
28 #if ENABLE(MATHML)
29 
30 #include "RenderMathMLSubSup.h"
31 
32 #include "MathMLNames.h"
33 
34 namespace WebCore {
35 
36 using namespace MathMLNames;
37 
38 RenderMathMLSubSup::RenderMathMLSubSup(Element* element)
39  : RenderMathMLBlock(element)
40  , m_scripts(0)
41 {
42  // Determine what kind of sub/sup expression we have by element name
43  if (element->hasLocalName(MathMLNames::msubTag))
44  m_kind = Sub;
45  else if (element->hasLocalName(MathMLNames::msupTag))
46  m_kind = Super;
47  else {
48  ASSERT(element->hasLocalName(MathMLNames::msubsupTag));
49  m_kind = SubSup;
50  }
51 }
52 
53 RenderBoxModelObject* RenderMathMLSubSup::base() const
54 {
55  RenderObject* baseWrapper = firstChild();
56  if (!baseWrapper)
57  return 0;
58  RenderObject* base = baseWrapper->firstChild();
59  if (!base || !base->isBoxModelObject())
60  return 0;
61  return toRenderBoxModelObject(base);
62 }
63 
64 void RenderMathMLSubSup::fixAnonymousStyles()
65 {
66  // Set the base wrapper's style so that baseHeight in layout() will be an unstretched height.
67  ASSERT(firstChild() && firstChild()->style()->refCount() == 1);
68  firstChild()->style()->setAlignSelf(AlignFlexStart);
69 
70  ASSERT(m_scripts && m_scripts->style()->refCount() == 1);
71  RenderStyle* scriptsStyle = m_scripts->style();
72  scriptsStyle->setFlexDirection(FlowColumn);
73  scriptsStyle->setJustifyContent(m_kind == Sub ? JustifyFlexEnd : m_kind == Super ? JustifyFlexStart : JustifySpaceBetween);
74  // Set this wrapper's font-size for its line-height & baseline position, for its children.
75  scriptsStyle->setFontSize(static_cast<int>(0.75 * style()->fontSize()));
76 }
77 
78 // FIXME: Handle arbitrary addChild/removeChild correctly throughout MathML.
79 void RenderMathMLSubSup::addChild(RenderObject* child, RenderObject* beforeChild)
80 {
81  if (isEmpty()) {
82  RenderMathMLBlock* baseWrapper = createAnonymousMathMLBlock();
83  RenderMathMLBlock::addChild(baseWrapper);
84 
85  m_scripts = createAnonymousMathMLBlock();
86  RenderMathMLBlock::addChild(m_scripts);
87 
88  fixAnonymousStyles();
89  }
90 
91  if (firstChild()->isEmpty())
92  firstChild()->addChild(child);
93  else
94  m_scripts->addChild(child, beforeChild && beforeChild->parent() == m_scripts ? beforeChild : 0);
95 }
96 
97 void RenderMathMLSubSup::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
98 {
99  RenderMathMLBlock::styleDidChange(diff, oldStyle);
100 
101  if (!isEmpty())
102  fixAnonymousStyles();
103 }
104 
105 RenderMathMLOperator* RenderMathMLSubSup::unembellishedOperator()
106 {
107  RenderBoxModelObject* base = this->base();
108  if (!base || !base->isRenderMathMLBlock())
109  return 0;
110  return toRenderMathMLBlock(base)->unembellishedOperator();
111 }
112 
113 void RenderMathMLSubSup::layout()
114 {
115  RenderMathMLBlock::layout();
116 
117  RenderMathMLBlock* baseWrapper = toRenderMathMLBlock(firstChild());
118  if (!baseWrapper || !m_scripts)
119  return;
120  RenderBox* base = baseWrapper->firstChildBox();
121  if (!base)
122  return;
123 
124  // Our layout rules include: Don't let the superscript go below the "axis" (half x-height above the
125  // baseline), or the subscript above the axis. Also, don't let the superscript's top edge be
126  // below the base's top edge, or the subscript's bottom edge above the base's bottom edge.
127  //
128  // FIXME: Check any subscriptshift or superscriptshift attributes, and maybe use more sophisticated
129  // heuristics from TeX or elsewhere. See https://bugs.webkit.org/show_bug.cgi?id=79274#c5.
130 
131  LayoutUnit baseHeight = base->logicalHeight();
132  LayoutUnit baseBaseline = base->firstLineBoxBaseline();
133  if (baseBaseline == -1)
134  baseBaseline = baseHeight;
135  LayoutUnit axis = style()->fontMetrics().xHeight() / 2;
136  int fontSize = style()->fontSize();
137 
138  ASSERT(baseWrapper->style()->hasOneRef());
139  bool needsSecondLayout = false;
140 
141  if (RenderBox* superscript = m_kind == Sub ? 0 : m_scripts->lastChildBox()) {
142  LayoutUnit superscriptHeight = superscript->logicalHeight();
143  LayoutUnit superscriptBaseline = superscript->firstLineBoxBaseline();
144  if (superscriptBaseline == -1)
145  superscriptBaseline = superscriptHeight;
146  LayoutUnit minBaseline = max<LayoutUnit>(fontSize / 3 + 1 + superscriptBaseline, superscriptHeight + axis);
147 
148  Length newPadding = Length(max<LayoutUnit>(minBaseline - baseBaseline, 0), Fixed);
149  if (newPadding != baseWrapper->style()->paddingTop()) {
150  baseWrapper->style()->setPaddingTop(newPadding);
151  needsSecondLayout = true;
152  }
153  }
154 
155  if (RenderBox* subscript = m_kind == Super ? 0 : m_scripts->firstChildBox()) {
156  LayoutUnit subscriptHeight = subscript->logicalHeight();
157  LayoutUnit subscriptBaseline = subscript->firstLineBoxBaseline();
158  if (subscriptBaseline == -1)
159  subscriptBaseline = subscriptHeight;
160  LayoutUnit baseExtendUnderBaseline = baseHeight - baseBaseline;
161  LayoutUnit subscriptUnderItsBaseline = subscriptHeight - subscriptBaseline;
162  LayoutUnit minExtendUnderBaseline = max<LayoutUnit>(fontSize / 5 + 1 + subscriptUnderItsBaseline, subscriptHeight - axis);
163 
164  Length newPadding = Length(max<LayoutUnit>(minExtendUnderBaseline - baseExtendUnderBaseline, 0), Fixed);
165  if (newPadding != baseWrapper->style()->paddingBottom()) {
166  baseWrapper->style()->setPaddingBottom(newPadding);
167  needsSecondLayout = true;
168  }
169  }
170 
171  if (!needsSecondLayout)
172  return;
173 
174  setNeedsLayout(true, MarkOnlyThis);
175  baseWrapper->setChildNeedsLayout(true, MarkOnlyThis);
176 
177  RenderMathMLBlock::layout();
178 }
179 
180 }
181 
182 #endif // ENABLE(MATHML)

Source/WebCore/rendering/mathml/RenderMathMLSubSup.h

1 /*
2  * Copyright (C) 2010 Alex Milowski (alex@milowski.com). All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
17  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
19  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25 
26 #ifndef RenderMathMLSubSup_h
27 #define RenderMathMLSubSup_h
28 
29 #if ENABLE(MATHML)
30 
31 #include "RenderMathMLBlock.h"
32 
33 namespace WebCore {
34 
35 // Render a base with a subscript and/or a superscript.
36 class RenderMathMLSubSup : public RenderMathMLBlock {
37 public:
38  RenderMathMLSubSup(Element*);
39  virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0);
40 
41  virtual RenderMathMLOperator* unembellishedOperator();
42 
43 protected:
44  virtual void layout();
45 
46 private:
47  virtual bool isRenderMathMLSubSup() const { return true; }
48  void fixAnonymousStyles();
49 
50  virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OVERRIDE;
51 
52  virtual const char* renderName() const { return "RenderMathMLSubSup"; }
53 
54  // Omit our subscript and/or superscript. This may return 0 for a non-MathML base (which
55  // won't occur in valid MathML).
56  RenderBoxModelObject* base() const;
57 
58  enum SubSupType { Sub, Super, SubSup };
59  SubSupType m_kind;
60  RenderMathMLBlock* m_scripts;
61 };
62 
63 }
64 
65 #endif // ENABLE(MATHML)
66 
67 #endif // RenderMathMLSubSup_h