Changeset 165436 in webkit
- Timestamp:
- Mar 11, 2014 12:51:27 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r165430 r165436 1 2014-03-10 Frédéric Wang <fred.wang@free.fr> 2 3 Improve renderer classes for MathML Token elements. 4 https://bugs.webkit.org/show_bug.cgi?id=124838 5 6 Reviewed by Chris Fleizach. 7 8 Two tests are added to fenced-mi in order to verify that the open/close 9 attributes of the mfenced element collapse whitespace and accept values 10 with multiple characters. 11 12 * mathml/presentation/fenced-mi-expected.html: 13 * mathml/presentation/fenced-mi.html: 14 * platform/mac/accessibility/mathml-elements.html: fix bad closing tag and disable the test for now. 15 * platform/mac/mathml/presentation/mo-stretch-expected.txt: update text reference. 16 1 17 2014-03-10 James Craig <jcraig@apple.com> 2 18 -
trunk/LayoutTests/mathml/presentation/fenced-mi-expected.html
r152923 r165436 69 69 </p> 70 70 71 <p> 72 <math> 73 <mrow> 74 <mo>ABC</mo> 75 <mrow> 76 <mi>x</mi> 77 </mrow> 78 <mo>DEF</mo> 79 </mrow> 80 </math> 81 </p> 82 83 <p> 84 <math> 85 <mfenced open="[" close="]" separators="12"><mi>x</mi><mi>y</mi><mi>z</mi></mfenced> 86 </math> 87 </p> 88 71 89 </body> 72 90 </html> -
trunk/LayoutTests/mathml/presentation/fenced-mi.html
r152923 r165436 34 34 </p> 35 35 36 <!-- Test for open/close operators with multiple characters --> 37 <p> 38 <math> 39 <mfenced open="ABC" close="DEF"> 40 <mi>x</mi> 41 </mfenced> 42 </math> 43 </p> 44 45 <!-- Test that whitespace is ignored. --> 46 <p> 47 <math> 48 <mfenced open=" 	
[ 	
" close=" 	
] 	
" separators=" 	
1 	
2 	
"><mi>x</mi><mi>y</mi><mi>z</mi></mfenced> 49 </math> 50 </p> 51 36 52 </body> 37 53 </html> -
trunk/LayoutTests/platform/mac/TestExpectations
r165360 r165436 1329 1329 1330 1330 webkit.org/b/129758 js/dom/create-lots-of-workers.html [ Skip ] 1331 1332 # This test fails because the structure of mfenced/mo operators was changed in bug 124838. 1333 webkit.org/b/124836 platform/mac/accessibility/mathml-elements.html [ Failure ] -
trunk/LayoutTests/platform/mac/accessibility/mathml-elements.html
r155282 r165436 21 21 22 22 <math id="fenced"> 23 <mfenced open="{" close="}" separators=",,"><mi>2</mi><mi>a</mi><mi>e</mi></m root>23 <mfenced open="{" close="}" separators=",,"><mi>2</mi><mi>a</mi><mi>e</mi></mfenced> 24 24 </math><br> 25 25 -
trunk/LayoutTests/platform/mac/mathml/presentation/mo-stretch-expected.txt
r164700 r165436 7 7 RenderMathMLRow {mrow} at (1,0) size 193x25 8 8 RenderMathMLOperator {mo} at (1,5) size 8x14 9 RenderMathMLBlock ( flex) {mo}at (0,0) size 7x149 RenderMathMLBlock (anonymous, flex) at (0,0) size 7x14 10 10 RenderBlock (anonymous) at (0,0) size 5x14 11 11 RenderText at (0,-6) size 5x24 12 12 text run at (0,-6) width 5: "(" 13 13 RenderMathMLOperator {mo} at (13,5) size 8x14 14 RenderMathMLBlock ( flex) {mo}at (0,0) size 7x1414 RenderMathMLBlock (anonymous, flex) at (0,0) size 7x14 15 15 RenderBlock (anonymous) at (0,0) size 5x14 16 16 RenderText at (0,-6) size 5x24 17 17 text run at (0,-6) width 5: ")" 18 18 RenderMathMLOperator {mo} at (26,5) size 11x14 19 RenderMathMLBlock ( flex) {mo}at (0,0) size 10x1419 RenderMathMLBlock (anonymous, flex) at (0,0) size 10x14 20 20 RenderBlock (anonymous) at (0,0) size 8x14 21 21 RenderText at (0,-6) size 8x24 22 22 text run at (0,-6) width 8: "{" 23 23 RenderMathMLOperator {mo} at (43,5) size 11x14 24 RenderMathMLBlock ( flex) {mo}at (0,0) size 10x1424 RenderMathMLBlock (anonymous, flex) at (0,0) size 10x14 25 25 RenderBlock (anonymous) at (0,0) size 8x14 26 26 RenderText at (0,-6) size 8x24 27 27 text run at (0,-6) width 8: "}" 28 28 RenderMathMLOperator {mo} at (59,5) size 8x14 29 RenderMathMLBlock ( flex) {mo}at (0,0) size 7x1429 RenderMathMLBlock (anonymous, flex) at (0,0) size 7x14 30 30 RenderBlock (anonymous) at (0,0) size 5x14 31 31 RenderText at (0,-6) size 5x24 32 32 text run at (0,-6) width 5: "[" 33 33 RenderMathMLOperator {mo} at (72,5) size 8x14 34 RenderMathMLBlock ( flex) {mo}at (0,0) size 7x1434 RenderMathMLBlock (anonymous, flex) at (0,0) size 7x14 35 35 RenderBlock (anonymous) at (0,0) size 5x14 36 36 RenderText at (0,-6) size 5x24 37 37 text run at (0,-6) width 5: "]" 38 38 RenderMathMLOperator {mo} at (86,4) size 9x16 39 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x1639 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 40 40 RenderBlock (anonymous) at (0,0) size 8x16 41 41 RenderText at (0,-5) size 8x24 42 42 text run at (0,-5) width 8: "\x{2308}" 43 43 RenderMathMLOperator {mo} at (100,4) size 9x16 44 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x1644 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 45 45 RenderBlock (anonymous) at (0,0) size 8x16 46 46 RenderText at (0,-5) size 8x24 47 47 text run at (0,-5) width 8: "\x{2309}" 48 48 RenderMathMLOperator {mo} at (115,4) size 8x16 49 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x1649 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 50 50 RenderBlock (anonymous) at (0,0) size 8x16 51 51 RenderText at (0,-5) size 8x24 52 52 text run at (0,-5) width 8: "\x{230A}" 53 53 RenderMathMLOperator {mo} at (129,4) size 9x16 54 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x1654 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 55 55 RenderBlock (anonymous) at (0,0) size 8x16 56 56 RenderText at (0,-5) size 8x24 57 57 text run at (0,-5) width 8: "\x{230B}" 58 58 RenderMathMLOperator {mo} at (143,2) size 12x20 59 RenderMathMLBlock ( flex) {mo}at (0,0) size 11x2059 RenderMathMLBlock (anonymous, flex) at (0,0) size 11x20 60 60 RenderBlock (anonymous) at (0,0) size 7x20 61 61 RenderText at (0,-3) size 7x24 62 62 text run at (0,-3) width 7: "\x{222B}" 63 63 RenderMathMLOperator {mo} at (161,0) size 4x25 64 RenderMathMLBlock ( flex) {mo}at (0,0) size 3x1264 RenderMathMLBlock (anonymous, flex) at (0,0) size 3x12 65 65 RenderBlock (anonymous) at (0,0) size 3x12 66 66 RenderText at (0,-6) size 3x24 67 67 text run at (0,-6) width 3: "|" 68 68 RenderMathMLOperator {mo} at (170,4) size 9x16 69 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x1669 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 70 70 RenderBlock (anonymous) at (0,0) size 8x16 71 71 RenderText at (0,-5) size 8x24 72 72 text run at (0,-5) width 8: "\x{2016}" 73 73 RenderMathMLOperator {mo} at (183,4) size 9x16 74 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x1674 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 75 75 RenderBlock (anonymous) at (0,0) size 8x16 76 76 RenderText at (0,-5) size 8x24 … … 82 82 RenderMathMLRow {mrow} at (1,0) size 197x143 83 83 RenderMathMLOperator {mo} at (1,0) size 8x143 84 RenderMathMLBlock ( flex) {mo}at (0,0) size 7x1484 RenderMathMLBlock (anonymous, flex) at (0,0) size 7x14 85 85 RenderBlock (anonymous) at (0,0) size 5x14 86 86 RenderText at (0,-6) size 5x24 87 87 text run at (0,-6) width 5: "(" 88 88 RenderMathMLOperator {mo} at (13,0) size 8x143 89 RenderMathMLBlock ( flex) {mo}at (0,0) size 7x1489 RenderMathMLBlock (anonymous, flex) at (0,0) size 7x14 90 90 RenderBlock (anonymous) at (0,0) size 5x14 91 91 RenderText at (0,-6) size 5x24 92 92 text run at (0,-6) width 5: ")" 93 93 RenderMathMLOperator {mo} at (26,0) size 11x143 94 RenderMathMLBlock ( flex) {mo}at (0,0) size 10x1494 RenderMathMLBlock (anonymous, flex) at (0,0) size 10x14 95 95 RenderBlock (anonymous) at (0,0) size 8x14 96 96 RenderText at (0,-6) size 8x24 97 97 text run at (0,-6) width 8: "{" 98 98 RenderMathMLOperator {mo} at (43,0) size 11x143 99 RenderMathMLBlock ( flex) {mo}at (0,0) size 10x1499 RenderMathMLBlock (anonymous, flex) at (0,0) size 10x14 100 100 RenderBlock (anonymous) at (0,0) size 8x14 101 101 RenderText at (0,-6) size 8x24 102 102 text run at (0,-6) width 8: "}" 103 103 RenderMathMLOperator {mo} at (59,0) size 8x143 104 RenderMathMLBlock ( flex) {mo}at (0,0) size 7x14104 RenderMathMLBlock (anonymous, flex) at (0,0) size 7x14 105 105 RenderBlock (anonymous) at (0,0) size 5x14 106 106 RenderText at (0,-6) size 5x24 107 107 text run at (0,-6) width 5: "[" 108 108 RenderMathMLOperator {mo} at (72,0) size 8x143 109 RenderMathMLBlock ( flex) {mo}at (0,0) size 7x14109 RenderMathMLBlock (anonymous, flex) at (0,0) size 7x14 110 110 RenderBlock (anonymous) at (0,0) size 5x14 111 111 RenderText at (0,-6) size 5x24 112 112 text run at (0,-6) width 5: "]" 113 113 RenderMathMLOperator {mo} at (86,0) size 9x143 114 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x16114 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 115 115 RenderBlock (anonymous) at (0,0) size 8x16 116 116 RenderText at (0,-5) size 8x24 117 117 text run at (0,-5) width 8: "\x{2308}" 118 118 RenderMathMLOperator {mo} at (100,0) size 9x143 119 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x16119 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 120 120 RenderBlock (anonymous) at (0,0) size 8x16 121 121 RenderText at (0,-5) size 8x24 122 122 text run at (0,-5) width 8: "\x{2309}" 123 123 RenderMathMLOperator {mo} at (115,0) size 8x143 124 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x16124 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 125 125 RenderBlock (anonymous) at (0,0) size 8x16 126 126 RenderText at (0,-5) size 8x24 127 127 text run at (0,-5) width 8: "\x{230A}" 128 128 RenderMathMLOperator {mo} at (129,0) size 9x143 129 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x16129 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 130 130 RenderBlock (anonymous) at (0,0) size 8x16 131 131 RenderText at (0,-5) size 8x24 132 132 text run at (0,-5) width 8: "\x{230B}" 133 133 RenderMathMLOperator {mo} at (143,0) size 12x143 134 RenderMathMLBlock ( flex) {mo}at (0,0) size 11x20134 RenderMathMLBlock (anonymous, flex) at (0,0) size 11x20 135 135 RenderBlock (anonymous) at (0,0) size 7x20 136 136 RenderText at (0,-3) size 7x24 137 137 text run at (0,-3) width 7: "\x{222B}" 138 138 RenderMathMLOperator {mo} at (161,0) size 4x143 139 RenderMathMLBlock ( flex) {mo}at (0,0) size 3x12139 RenderMathMLBlock (anonymous, flex) at (0,0) size 3x12 140 140 RenderBlock (anonymous) at (0,0) size 3x12 141 141 RenderText at (0,-6) size 3x24 142 142 text run at (0,-6) width 3: "|" 143 143 RenderMathMLOperator {mo} at (170,0) size 9x76 144 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x16144 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 145 145 RenderBlock (anonymous) at (0,0) size 8x16 146 146 RenderText at (0,-5) size 8x24 147 147 text run at (0,-5) width 8: "\x{2016}" 148 148 RenderMathMLOperator {mo} at (184,0) size 9x76 149 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x16149 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 150 150 RenderBlock (anonymous) at (0,0) size 8x16 151 151 RenderText at (0,-5) size 8x24 … … 157 157 RenderMathMLRow {mrow} at (1,0) size 197x93 158 158 RenderMathMLOperator {mo} at (1,0) size 8x93 159 RenderMathMLBlock ( flex) {mo}at (0,0) size 7x14159 RenderMathMLBlock (anonymous, flex) at (0,0) size 7x14 160 160 RenderBlock (anonymous) at (0,0) size 5x14 161 161 RenderText at (0,-6) size 5x24 162 162 text run at (0,-6) width 5: "(" 163 163 RenderMathMLOperator {mo} at (13,0) size 8x93 164 RenderMathMLBlock ( flex) {mo}at (0,0) size 7x14164 RenderMathMLBlock (anonymous, flex) at (0,0) size 7x14 165 165 RenderBlock (anonymous) at (0,0) size 5x14 166 166 RenderText at (0,-6) size 5x24 167 167 text run at (0,-6) width 5: ")" 168 168 RenderMathMLOperator {mo} at (26,0) size 11x93 169 RenderMathMLBlock ( flex) {mo}at (0,0) size 10x14169 RenderMathMLBlock (anonymous, flex) at (0,0) size 10x14 170 170 RenderBlock (anonymous) at (0,0) size 8x14 171 171 RenderText at (0,-6) size 8x24 172 172 text run at (0,-6) width 8: "{" 173 173 RenderMathMLOperator {mo} at (43,0) size 11x93 174 RenderMathMLBlock ( flex) {mo}at (0,0) size 10x14174 RenderMathMLBlock (anonymous, flex) at (0,0) size 10x14 175 175 RenderBlock (anonymous) at (0,0) size 8x14 176 176 RenderText at (0,-6) size 8x24 177 177 text run at (0,-6) width 8: "}" 178 178 RenderMathMLOperator {mo} at (59,0) size 8x93 179 RenderMathMLBlock ( flex) {mo}at (0,0) size 7x14179 RenderMathMLBlock (anonymous, flex) at (0,0) size 7x14 180 180 RenderBlock (anonymous) at (0,0) size 5x14 181 181 RenderText at (0,-6) size 5x24 182 182 text run at (0,-6) width 5: "[" 183 183 RenderMathMLOperator {mo} at (72,0) size 8x93 184 RenderMathMLBlock ( flex) {mo}at (0,0) size 7x14184 RenderMathMLBlock (anonymous, flex) at (0,0) size 7x14 185 185 RenderBlock (anonymous) at (0,0) size 5x14 186 186 RenderText at (0,-6) size 5x24 187 187 text run at (0,-6) width 5: "]" 188 188 RenderMathMLOperator {mo} at (86,0) size 9x93 189 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x16189 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 190 190 RenderBlock (anonymous) at (0,0) size 8x16 191 191 RenderText at (0,-5) size 8x24 192 192 text run at (0,-5) width 8: "\x{2308}" 193 193 RenderMathMLOperator {mo} at (100,0) size 9x93 194 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x16194 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 195 195 RenderBlock (anonymous) at (0,0) size 8x16 196 196 RenderText at (0,-5) size 8x24 197 197 text run at (0,-5) width 8: "\x{2309}" 198 198 RenderMathMLOperator {mo} at (115,0) size 8x93 199 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x16199 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 200 200 RenderBlock (anonymous) at (0,0) size 8x16 201 201 RenderText at (0,-5) size 8x24 202 202 text run at (0,-5) width 8: "\x{230A}" 203 203 RenderMathMLOperator {mo} at (129,0) size 9x93 204 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x16204 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 205 205 RenderBlock (anonymous) at (0,0) size 8x16 206 206 RenderText at (0,-5) size 8x24 207 207 text run at (0,-5) width 8: "\x{230B}" 208 208 RenderMathMLOperator {mo} at (143,0) size 12x93 209 RenderMathMLBlock ( flex) {mo}at (0,0) size 11x20209 RenderMathMLBlock (anonymous, flex) at (0,0) size 11x20 210 210 RenderBlock (anonymous) at (0,0) size 7x20 211 211 RenderText at (0,-3) size 7x24 212 212 text run at (0,-3) width 7: "\x{222B}" 213 213 RenderMathMLOperator {mo} at (161,0) size 4x93 214 RenderMathMLBlock ( flex) {mo}at (0,0) size 3x12214 RenderMathMLBlock (anonymous, flex) at (0,0) size 3x12 215 215 RenderBlock (anonymous) at (0,0) size 3x12 216 216 RenderText at (0,-6) size 3x24 217 217 text run at (0,-6) width 3: "|" 218 218 RenderMathMLOperator {mo} at (170,0) size 9x51 219 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x16219 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 220 220 RenderBlock (anonymous) at (0,0) size 8x16 221 221 RenderText at (0,-5) size 8x24 222 222 text run at (0,-5) width 8: "\x{2016}" 223 223 RenderMathMLOperator {mo} at (184,0) size 9x51 224 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x16224 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 225 225 RenderBlock (anonymous) at (0,0) size 8x16 226 226 RenderText at (0,-5) size 8x24 … … 232 232 RenderMathMLRow {mrow} at (1,0) size 197x33 233 233 RenderMathMLOperator {mo} at (1,0) size 8x33 234 RenderMathMLBlock ( flex) {mo}at (0,0) size 7x14234 RenderMathMLBlock (anonymous, flex) at (0,0) size 7x14 235 235 RenderBlock (anonymous) at (0,0) size 5x14 236 236 RenderText at (0,-6) size 5x24 237 237 text run at (0,-6) width 5: "(" 238 238 RenderMathMLOperator {mo} at (13,0) size 8x33 239 RenderMathMLBlock ( flex) {mo}at (0,0) size 7x14239 RenderMathMLBlock (anonymous, flex) at (0,0) size 7x14 240 240 RenderBlock (anonymous) at (0,0) size 5x14 241 241 RenderText at (0,-6) size 5x24 242 242 text run at (0,-6) width 5: ")" 243 243 RenderMathMLOperator {mo} at (26,9) size 11x14 244 RenderMathMLBlock ( flex) {mo}at (0,0) size 10x14244 RenderMathMLBlock (anonymous, flex) at (0,0) size 10x14 245 245 RenderBlock (anonymous) at (0,0) size 8x14 246 246 RenderText at (0,-6) size 8x24 247 247 text run at (0,-6) width 8: "{" 248 248 RenderMathMLOperator {mo} at (43,9) size 11x14 249 RenderMathMLBlock ( flex) {mo}at (0,0) size 10x14249 RenderMathMLBlock (anonymous, flex) at (0,0) size 10x14 250 250 RenderBlock (anonymous) at (0,0) size 8x14 251 251 RenderText at (0,-6) size 8x24 252 252 text run at (0,-6) width 8: "}" 253 253 RenderMathMLOperator {mo} at (59,0) size 8x33 254 RenderMathMLBlock ( flex) {mo}at (0,0) size 7x14254 RenderMathMLBlock (anonymous, flex) at (0,0) size 7x14 255 255 RenderBlock (anonymous) at (0,0) size 5x14 256 256 RenderText at (0,-6) size 5x24 257 257 text run at (0,-6) width 5: "[" 258 258 RenderMathMLOperator {mo} at (72,0) size 8x33 259 RenderMathMLBlock ( flex) {mo}at (0,0) size 7x14259 RenderMathMLBlock (anonymous, flex) at (0,0) size 7x14 260 260 RenderBlock (anonymous) at (0,0) size 5x14 261 261 RenderText at (0,-6) size 5x24 262 262 text run at (0,-6) width 5: "]" 263 263 RenderMathMLOperator {mo} at (86,0) size 9x33 264 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x16264 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 265 265 RenderBlock (anonymous) at (0,0) size 8x16 266 266 RenderText at (0,-5) size 8x24 267 267 text run at (0,-5) width 8: "\x{2308}" 268 268 RenderMathMLOperator {mo} at (100,0) size 9x33 269 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x16269 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 270 270 RenderBlock (anonymous) at (0,0) size 8x16 271 271 RenderText at (0,-5) size 8x24 272 272 text run at (0,-5) width 8: "\x{2309}" 273 273 RenderMathMLOperator {mo} at (115,0) size 8x33 274 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x16274 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 275 275 RenderBlock (anonymous) at (0,0) size 8x16 276 276 RenderText at (0,-5) size 8x24 277 277 text run at (0,-5) width 8: "\x{230A}" 278 278 RenderMathMLOperator {mo} at (129,0) size 9x33 279 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x16279 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 280 280 RenderBlock (anonymous) at (0,0) size 8x16 281 281 RenderText at (0,-5) size 8x24 282 282 text run at (0,-5) width 8: "\x{230B}" 283 283 RenderMathMLOperator {mo} at (143,6) size 12x20 284 RenderMathMLBlock ( flex) {mo}at (0,0) size 11x20284 RenderMathMLBlock (anonymous, flex) at (0,0) size 11x20 285 285 RenderBlock (anonymous) at (0,0) size 7x20 286 286 RenderText at (0,-3) size 7x24 287 287 text run at (0,-3) width 7: "\x{222B}" 288 288 RenderMathMLOperator {mo} at (161,0) size 4x33 289 RenderMathMLBlock ( flex) {mo}at (0,0) size 3x12289 RenderMathMLBlock (anonymous, flex) at (0,0) size 3x12 290 290 RenderBlock (anonymous) at (0,0) size 3x12 291 291 RenderText at (0,-6) size 3x24 292 292 text run at (0,-6) width 3: "|" 293 293 RenderMathMLOperator {mo} at (170,8) size 9x16 294 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x16294 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 295 295 RenderBlock (anonymous) at (0,0) size 8x16 296 296 RenderText at (0,-5) size 8x24 297 297 text run at (0,-5) width 8: "\x{2016}" 298 298 RenderMathMLOperator {mo} at (184,8) size 9x16 299 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x16299 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 300 300 RenderBlock (anonymous) at (0,0) size 8x16 301 301 RenderText at (0,-5) size 8x24 … … 309 309 RenderMathMLRow (anonymous) at (12,3) size 197x73 310 310 RenderMathMLOperator {mo} at (1,0) size 8x73 311 RenderMathMLBlock ( flex) {mo}at (0,0) size 7x14311 RenderMathMLBlock (anonymous, flex) at (0,0) size 7x14 312 312 RenderBlock (anonymous) at (0,0) size 5x14 313 313 RenderText at (0,-6) size 5x24 314 314 text run at (0,-6) width 5: "(" 315 315 RenderMathMLOperator {mo} at (13,0) size 8x73 316 RenderMathMLBlock ( flex) {mo}at (0,0) size 7x14316 RenderMathMLBlock (anonymous, flex) at (0,0) size 7x14 317 317 RenderBlock (anonymous) at (0,0) size 5x14 318 318 RenderText at (0,-6) size 5x24 319 319 text run at (0,-6) width 5: ")" 320 320 RenderMathMLOperator {mo} at (26,0) size 11x73 321 RenderMathMLBlock ( flex) {mo}at (0,0) size 10x14321 RenderMathMLBlock (anonymous, flex) at (0,0) size 10x14 322 322 RenderBlock (anonymous) at (0,0) size 8x14 323 323 RenderText at (0,-6) size 8x24 324 324 text run at (0,-6) width 8: "{" 325 325 RenderMathMLOperator {mo} at (43,0) size 11x73 326 RenderMathMLBlock ( flex) {mo}at (0,0) size 10x14326 RenderMathMLBlock (anonymous, flex) at (0,0) size 10x14 327 327 RenderBlock (anonymous) at (0,0) size 8x14 328 328 RenderText at (0,-6) size 8x24 329 329 text run at (0,-6) width 8: "}" 330 330 RenderMathMLOperator {mo} at (59,0) size 8x73 331 RenderMathMLBlock ( flex) {mo}at (0,0) size 7x14331 RenderMathMLBlock (anonymous, flex) at (0,0) size 7x14 332 332 RenderBlock (anonymous) at (0,0) size 5x14 333 333 RenderText at (0,-6) size 5x24 334 334 text run at (0,-6) width 5: "[" 335 335 RenderMathMLOperator {mo} at (72,0) size 8x73 336 RenderMathMLBlock ( flex) {mo}at (0,0) size 7x14336 RenderMathMLBlock (anonymous, flex) at (0,0) size 7x14 337 337 RenderBlock (anonymous) at (0,0) size 5x14 338 338 RenderText at (0,-6) size 5x24 339 339 text run at (0,-6) width 5: "]" 340 340 RenderMathMLOperator {mo} at (86,0) size 9x73 341 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x16341 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 342 342 RenderBlock (anonymous) at (0,0) size 8x16 343 343 RenderText at (0,-5) size 8x24 344 344 text run at (0,-5) width 8: "\x{2308}" 345 345 RenderMathMLOperator {mo} at (100,0) size 9x73 346 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x16346 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 347 347 RenderBlock (anonymous) at (0,0) size 8x16 348 348 RenderText at (0,-5) size 8x24 349 349 text run at (0,-5) width 8: "\x{2309}" 350 350 RenderMathMLOperator {mo} at (115,0) size 8x73 351 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x16351 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 352 352 RenderBlock (anonymous) at (0,0) size 8x16 353 353 RenderText at (0,-5) size 8x24 354 354 text run at (0,-5) width 8: "\x{230A}" 355 355 RenderMathMLOperator {mo} at (129,0) size 9x73 356 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x16356 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 357 357 RenderBlock (anonymous) at (0,0) size 8x16 358 358 RenderText at (0,-5) size 8x24 359 359 text run at (0,-5) width 8: "\x{230B}" 360 360 RenderMathMLOperator {mo} at (143,0) size 12x73 361 RenderMathMLBlock ( flex) {mo}at (0,0) size 11x20361 RenderMathMLBlock (anonymous, flex) at (0,0) size 11x20 362 362 RenderBlock (anonymous) at (0,0) size 7x20 363 363 RenderText at (0,-3) size 7x24 364 364 text run at (0,-3) width 7: "\x{222B}" 365 365 RenderMathMLOperator {mo} at (161,0) size 4x73 366 RenderMathMLBlock ( flex) {mo}at (0,0) size 3x12366 RenderMathMLBlock (anonymous, flex) at (0,0) size 3x12 367 367 RenderBlock (anonymous) at (0,0) size 3x12 368 368 RenderText at (0,-6) size 3x24 369 369 text run at (0,-6) width 3: "|" 370 370 RenderMathMLOperator {mo} at (170,0) size 9x41 371 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x16371 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 372 372 RenderBlock (anonymous) at (0,0) size 8x16 373 373 RenderText at (0,-5) size 8x24 374 374 text run at (0,-5) width 8: "\x{2016}" 375 375 RenderMathMLOperator {mo} at (184,0) size 9x41 376 RenderMathMLBlock ( flex) {mo}at (0,0) size 8x16376 RenderMathMLBlock (anonymous, flex) at (0,0) size 8x16 377 377 RenderBlock (anonymous) at (0,0) size 8x16 378 378 RenderText at (0,-5) size 8x24 -
trunk/Source/WebCore/ChangeLog
r165430 r165436 1 2014-03-10 Frédéric Wang <fred.wang@free.fr> 2 3 Improve renderer classes for MathML Token elements. 4 https://bugs.webkit.org/show_bug.cgi?id=124838 5 6 Reviewed by Chris Fleizach. 7 8 This patch continues the refactoring of token elements that has been 9 started in bug 44208. The <mo> element now derives from the 10 RenderMathMLToken class, which was already used for the <mi> element. 11 The behavior of anonymous <mo> elements created by the <mfenced> element 12 is now more consistent with the one of "standard" <mo> elements and the 13 spacing around them is now handled in RenderMathMLOperator. This is a 14 first step towards fixing bugs 115787 and 118843. The only visible 15 rendering change is how <mfenced> open/close attributes handle 16 whitespace and multiple characters and some tests are added for that. 17 Other features are already covered by other tests. Finally, this also 18 removes some code from AccessibilityRenderObject that was used to 19 workaround issues with <mo> elements. 20 21 * accessibility/AccessibilityRenderObject.cpp: 22 (WebCore::startOfContinuations): 23 (WebCore::AccessibilityRenderObject::textUnderElement): 24 (WebCore::AccessibilityRenderObject::isMathOperator): 25 (WebCore::AccessibilityRenderObject::isIgnoredElementWithinMathTree): 26 * mathml/MathMLTextElement.cpp: 27 (WebCore::MathMLTextElement::didAttachRenderers): 28 (WebCore::MathMLTextElement::childrenChanged): 29 * rendering/mathml/RenderMathMLBlock.cpp: 30 (WebCore::RenderMathMLBlock::RenderMathMLBlock): 31 * rendering/mathml/RenderMathMLBlock.h: 32 * rendering/mathml/RenderMathMLFenced.cpp: 33 (WebCore::RenderMathMLFenced::RenderMathMLFenced): 34 (WebCore::RenderMathMLFenced::updateFromElement): 35 (WebCore::RenderMathMLFenced::createMathMLOperator): 36 (WebCore::RenderMathMLFenced::makeFences): 37 (WebCore::RenderMathMLFenced::addChild): 38 * rendering/mathml/RenderMathMLFenced.h: 39 * rendering/mathml/RenderMathMLOperator.cpp: 40 (WebCore::RenderMathMLOperator::RenderMathMLOperator): 41 (WebCore::RenderMathMLOperator::setOperatorFlagFromAttribute): 42 (WebCore::RenderMathMLOperator::setOperatorPropertiesFromOpDictEntry): 43 (WebCore::RenderMathMLOperator::SetOperatorProperties): 44 (WebCore::RenderMathMLOperator::computePreferredLogicalWidths): 45 (WebCore::RenderMathMLOperator::rebuildTokenContent): 46 (WebCore::RenderMathMLOperator::updateTokenContent): 47 (WebCore::RenderMathMLOperator::updateStyle): 48 (WebCore::RenderMathMLOperator::firstLineBaseline): 49 (WebCore::RenderMathMLOperator::paint): 50 (WebCore::RenderMathMLOperator::paintChildren): 51 * rendering/mathml/RenderMathMLOperator.h: 52 * rendering/mathml/RenderMathMLToken.cpp: 53 (WebCore::RenderMathMLToken::createWrapperIfNeeded): 54 1 55 2014-03-10 James Craig <jcraig@apple.com> 2 56 -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
r164964 r165436 254 254 static inline RenderInline* startOfContinuations(RenderObject* r) 255 255 { 256 if (r->isInlineElementContinuation()) { 257 #if ENABLE(MATHML) 258 // MathML elements make anonymous RenderObjects, then set their node to the parent's node. 259 // This makes it so that the renderer() != renderer()->node()->renderer() 260 // (which is what isInlineElementContinuation() uses as a determinant). 261 if (r->node()->isMathMLElement()) 262 return nullptr; 263 #endif 264 256 if (r->isInlineElementContinuation()) 265 257 return toRenderInline(r->node()->renderer()); 266 }267 258 268 259 // Blocks with a previous continuation always have a next continuation … … 655 646 // Math operators create RenderText nodes on the fly that are not tied into the DOM in a reasonable way, 656 647 // so rangeOfContents does not work for them (nor does regular text selection). 657 if (m_renderer->isText() && isMathElement()) { 658 if (ancestorsOfType<RenderMathMLOperator>(*m_renderer).first()) 659 return toRenderText(*m_renderer).text(); 660 } 648 if (m_renderer->isText() && m_renderer->isAnonymous() && ancestorsOfType<RenderMathMLOperator>(*m_renderer).first()) 649 return toRenderText(*m_renderer).text(); 661 650 #endif 662 651 … … 3503 3492 return false; 3504 3493 3505 // Ensure that this is actually a render MathML operator because 3506 // MathML will create MathMLBlocks and use the original node as the node 3507 // of this new block that is not tied to the DOM. 3508 return isMathElement() && node()->hasTagName(MathMLNames::moTag); 3494 return true; 3509 3495 } 3510 3496 … … 3565 3551 return true; 3566 3552 3567 // Ignore items that were created for layout purposes only. 3568 if (m_renderer->isRenderMathMLBlock() && toRenderMathMLBlock(m_renderer)->ignoreInAccessibilityTree()) 3569 return true; 3570 3571 // Ignore anonymous renderers inside math blocks. 3553 // We ignore anonymous renderers inside math blocks. 3554 // However, we do not exclude anonymous RenderMathMLOperator nodes created by the mfenced element nor RenderText nodes created by math operators so that the text can be exposed by AccessibilityRenderObject::textUnderElement. 3572 3555 if (m_renderer->isAnonymous()) { 3556 if (m_renderer->isRenderMathMLOperator()) 3557 return false; 3573 3558 for (AccessibilityObject* parent = parentObject(); parent; parent = parent->parentObject()) { 3574 3559 if (parent->isMathElement()) 3575 return true;3560 return !(m_renderer->isText() && ancestorsOfType<RenderMathMLOperator>(*m_renderer).first()); 3576 3561 } 3577 3562 } -
trunk/Source/WebCore/mathml/MathMLTextElement.cpp
r163626 r165436 54 54 { 55 55 MathMLElement::didAttachRenderers(); 56 if (renderer()) { 57 if (renderer()->isRenderMathMLToken()) 58 toRenderMathMLToken(renderer())->updateTokenContent(); 59 else 60 renderer()->updateFromElement(); 61 } 56 if (renderer() && renderer()->isRenderMathMLToken()) 57 toRenderMathMLToken(renderer())->updateTokenContent(); 62 58 } 63 59 … … 65 61 { 66 62 MathMLElement::childrenChanged(change); 67 if (renderer()) { 68 if (renderer()->isRenderMathMLToken()) 69 toRenderMathMLToken(renderer())->updateTokenContent(); 70 else 71 renderer()->updateFromElement(); 72 } 63 if (renderer() && renderer()->isRenderMathMLToken()) 64 toRenderMathMLToken(renderer())->updateTokenContent(); 73 65 } 74 66 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp
r161482 r165436 46 46 RenderMathMLBlock::RenderMathMLBlock(Element& container, PassRef<RenderStyle> style) 47 47 : RenderFlexibleBox(container, std::move(style)) 48 , m_ignoreInAccessibilityTree(false)49 48 { 50 49 } … … 52 51 RenderMathMLBlock::RenderMathMLBlock(Document& document, PassRef<RenderStyle> style) 53 52 : RenderFlexibleBox(document, std::move(style)) 54 , m_ignoreInAccessibilityTree(false)55 53 { 56 54 } -
trunk/Source/WebCore/rendering/mathml/RenderMathMLBlock.h
r164536 r165436 65 65 RenderPtr<RenderMathMLBlock> createAnonymousMathMLBlock(); 66 66 67 void setIgnoreInAccessibilityTree(bool flag) { m_ignoreInAccessibilityTree = flag; }68 bool ignoreInAccessibilityTree() const { return m_ignoreInAccessibilityTree; }69 70 67 private: 71 68 virtual bool isRenderMathMLBlock() const override final { return true; } 72 69 virtual const char* renderName() const override; 73 74 bool m_ignoreInAccessibilityTree;75 70 }; 76 71 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.cpp
r164418 r165436 41 41 using namespace MathMLNames; 42 42 43 enum Braces { OpeningBraceChar = 0x28, ClosingBraceChar = 0x29 }; 44 45 static const float gSeparatorMarginEndEms = 0.25f; 46 static const float gFenceMarginEms = 0.1f; 43 static const char* gOpeningBraceChar = "("; 44 static const char* gClosingBraceChar = ")"; 47 45 48 46 RenderMathMLFenced::RenderMathMLFenced(MathMLInlineContainerElement& element, PassRef<RenderStyle> style) 49 47 : RenderMathMLRow(element, std::move(style)) 50 , m_open(OpeningBraceChar)51 , m_close(ClosingBraceChar)52 48 , m_closeFenceRenderer(nullptr) 53 49 { … … 58 54 const auto& fenced = element(); 59 55 60 // FIXME: Handle open/close values with more than one character (they should be treated like text).61 AtomicString open Value = fenced.getAttribute(MathMLNames::openAttr);62 if (openValue.length() > 0)63 m_open = openValue[0]; 64 AtomicString closeValue = fenced.getAttribute(MathMLNames::closeAttr);65 if (closeValue.length() > 0)66 m_close = closeValue[0];67 68 AtomicString separators = fenced. getAttribute(MathMLNames::separatorsAttr);56 // The open operator defaults to a left parenthesis. 57 AtomicString open = fenced.fastGetAttribute(MathMLNames::openAttr); 58 m_open = open.isNull() ? gOpeningBraceChar : open; 59 60 // The close operator defaults to a right parenthesis. 61 AtomicString close = fenced.fastGetAttribute(MathMLNames::closeAttr); 62 m_close = close.isNull() ? gClosingBraceChar : close; 63 64 AtomicString separators = fenced.fastGetAttribute(MathMLNames::separatorsAttr); 69 65 if (!separators.isNull()) { 70 66 StringBuilder characters; … … 81 77 if (isEmpty()) 82 78 makeFences(); 79 else { 80 // FIXME: The mfenced element fails to update dynamically when its open, close and separators attributes are changed (https://bugs.webkit.org/show_bug.cgi?id=57696). 81 toRenderMathMLOperator(firstChild())->updateTokenContent(m_open); 82 m_closeFenceRenderer->updateTokenContent(m_close); 83 } 83 84 } 84 85 85 RenderPtr<RenderMathMLOperator> RenderMathMLFenced::createMathMLOperator( UChar uChar, MathMLOperatorDictionary::Form form, MathMLOperatorDictionary::Flag flag)86 RenderPtr<RenderMathMLOperator> RenderMathMLFenced::createMathMLOperator(const String& operatorString, MathMLOperatorDictionary::Form form, MathMLOperatorDictionary::Flag flag) 86 87 { 87 auto newStyle = RenderStyle::createAnonymousStyleWithDisplay(&style(), FLEX); 88 newStyle.get().setFlexDirection(FlowColumn); 89 newStyle.get().setMarginEnd(Length((flag == MathMLOperatorDictionary::Fence ? gFenceMarginEms : gSeparatorMarginEndEms) * style().fontSize(), Fixed)); 90 if (flag == MathMLOperatorDictionary::Fence) 91 newStyle.get().setMarginStart(Length(gFenceMarginEms * style().fontSize(), Fixed)); 92 RenderPtr<RenderMathMLOperator> newOperator = createRenderer<RenderMathMLOperator>(element(), std::move(newStyle), uChar, form, flag); 88 RenderPtr<RenderMathMLOperator> newOperator = createRenderer<RenderMathMLOperator>(document(), RenderStyle::createAnonymousStyleWithDisplay(&style(), FLEX), operatorString, form, flag); 93 89 newOperator->initializeStyle(); 94 90 return newOperator; … … 98 94 { 99 95 RenderPtr<RenderMathMLOperator> openFence = createMathMLOperator(m_open, MathMLOperatorDictionary::Prefix, MathMLOperatorDictionary::Fence); 100 RenderMathMLOperator* openFencePtr = openFence.get();101 96 RenderMathMLRow::addChild(openFence.leakPtr(), firstChild()); 102 97 … … 104 99 m_closeFenceRenderer = closeFence.get(); 105 100 RenderMathMLRow::addChild(closeFence.leakPtr()); 106 107 openFencePtr->updateFromElement();108 m_closeFenceRenderer->updateFromElement();109 101 } 110 102 … … 115 107 updateFromElement(); 116 108 117 // FIXME: Adding or removing a child should possibly cause all later separators to shift places if they're different, 118 // as later child positions change by +1 or -1. 109 // FIXME: Adding or removing a child should possibly cause all later separators to shift places if they're different, as later child positions change by +1 or -1. This should also handle surrogate pairs. See https://bugs.webkit.org/show_bug.cgi?id=125938. 119 110 120 111 RenderPtr<RenderMathMLOperator> separatorRenderer; … … 140 131 separator = (*m_separators.get())[count - 1]; 141 132 142 separatorRenderer = createMathMLOperator(separator, MathMLOperatorDictionary::Infix, MathMLOperatorDictionary::Separator); 133 StringBuilder builder; 134 builder.append(separator); 135 separatorRenderer = createMathMLOperator(builder.toString(), MathMLOperatorDictionary::Infix, MathMLOperatorDictionary::Separator); 143 136 } 144 137 } … … 157 150 } 158 151 159 // FIXME: Change createMathMLOperator() above to create an isAnonymous() operator, and remove this styleDidChange() function.160 void RenderMathMLFenced::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)161 {162 RenderMathMLBlock::styleDidChange(diff, oldStyle);163 164 for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {165 if (child->node() == &element()) {166 ASSERT(child->style().refCount() == 1);167 child->style().inheritFrom(&style());168 bool isFence = child == firstChild() || child == lastChild();169 child->style().setMarginEnd(Length((isFence ? gFenceMarginEms : gSeparatorMarginEndEms) * style().fontSize(), Fixed));170 if (isFence) {171 RenderMathMLBlock* block = toRenderMathMLBlock(child);172 toRenderMathMLOperator(block)->updateFromElement();173 child->style().setMarginStart(Length(gFenceMarginEms * style().fontSize(), Fixed));174 }175 }176 }177 }178 179 152 } 180 153 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.h
r164418 r165436 44 44 virtual const char* renderName() const override { return "RenderMathMLFenced"; } 45 45 virtual void addChild(RenderObject* child, RenderObject* beforeChild) override; 46 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;47 48 46 virtual void updateFromElement() override; 49 47 50 RenderPtr<RenderMathMLOperator> createMathMLOperator( UChar, MathMLOperatorDictionary::Form, MathMLOperatorDictionary::Flag);48 RenderPtr<RenderMathMLOperator> createMathMLOperator(const String& operatorString, MathMLOperatorDictionary::Form, MathMLOperatorDictionary::Flag); 51 49 void makeFences(); 52 50 53 UCharm_open;54 UCharm_close;51 String m_open; 52 String m_close; 55 53 RefPtr<StringImpl> m_separators; 56 54 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp
r164700 r165436 1120 1120 1121 1121 RenderMathMLOperator::RenderMathMLOperator(MathMLElement& element, PassRef<RenderStyle> style) 1122 : RenderMathML Block(element, std::move(style))1122 : RenderMathMLToken(element, std::move(style)) 1123 1123 , m_stretchHeightAboveBaseline(0) 1124 1124 , m_stretchDepthBelowBaseline(0) 1125 1125 , m_operator(0) 1126 1126 , m_stretchyCharacter(nullptr) 1127 , m_isFencedOperator(false) 1128 { 1129 SetOperatorProperties(); 1130 } 1131 1132 RenderMathMLOperator::RenderMathMLOperator(MathMLElement& element, PassRef<RenderStyle> style, UChar operatorChar, MathMLOperatorDictionary::Form form, MathMLOperatorDictionary::Flag flag) 1133 : RenderMathMLBlock(element, std::move(style)) 1127 { 1128 updateTokenContent(); 1129 } 1130 1131 RenderMathMLOperator::RenderMathMLOperator(Document& document, PassRef<RenderStyle> style, const String& operatorString, MathMLOperatorDictionary::Form form, MathMLOperatorDictionary::Flag flag) 1132 : RenderMathMLToken(document, std::move(style)) 1134 1133 , m_stretchHeightAboveBaseline(0) 1135 1134 , m_stretchDepthBelowBaseline(0) 1136 , m_operator( operatorChar == hyphenMinus ? minusSign : operatorChar)1135 , m_operator(0) 1137 1136 , m_stretchyCharacter(nullptr) 1138 , m_isFencedOperator(true)1139 1137 , m_operatorForm(form) 1140 1138 , m_operatorFlags(flag) 1141 1139 { 1142 SetOperatorProperties();1140 updateTokenContent(operatorString); 1143 1141 } 1144 1142 1145 1143 void RenderMathMLOperator::setOperatorFlagFromAttribute(MathMLOperatorDictionary::Flag flag, const QualifiedName& name) 1146 1144 { 1145 ASSERT(!isFencedOperator()); 1147 1146 const AtomicString& attributeValue = element().fastGetAttribute(name); 1148 1147 if (attributeValue == "true") … … 1156 1155 { 1157 1156 // If this operator has been created by RenderMathMLFenced, we preserve the Fence and Separator properties. 1158 if ( m_isFencedOperator)1157 if (isFencedOperator()) 1159 1158 m_operatorFlags = (m_operatorFlags & (MathMLOperatorDictionary::Fence | MathMLOperatorDictionary::Separator)) | entry->flags; 1160 1159 else … … 1168 1167 void RenderMathMLOperator::SetOperatorProperties() 1169 1168 { 1170 // We verify whether the operator text can be represented by a single UChar.1171 if (!m_isFencedOperator) {1172 // FIXME: This does not handle surrogate pairs (https://bugs.webkit.org/show_bug.cgi?id=122296).1173 // FIXME: This does not handle <mo> operators with multiple characters (https://bugs.webkit.org/show_bug.cgi?id=124828).1174 String opText = element().textContent().stripWhiteSpace().simplifyWhiteSpace().replace(hyphenMinus, minusSign).impl();1175 if (opText.length() == 1)1176 m_operator = opText[0];1177 }1178 1179 1169 // We determine the form of the operator. 1180 1170 bool explicitForm = true; 1181 if (! m_isFencedOperator) {1171 if (!isFencedOperator()) { 1182 1172 const AtomicString& form = element().fastGetAttribute(MathMLNames::formAttr); 1183 1173 if (form == "prefix") … … 1202 1192 1203 1193 // First we initialize with the default values for unknown operators. 1204 m_operatorFlags = 0; // This sets all the properties to "false". 1194 if (isFencedOperator()) 1195 m_operatorFlags &= MathMLOperatorDictionary::Fence | MathMLOperatorDictionary::Separator; // This resets all but the Fence and Separator properties. 1196 else 1197 m_operatorFlags = 0; // This resets all the operator properties. 1205 1198 m_leadingSpace = 5 * style().fontSize() / 18; // This sets leading space to "thickmathspace". 1206 1199 m_trailingSpace = 5 * style().fontSize() / 18; // This sets trailing space to "thickmathspace". … … 1226 1219 #undef MATHML_OPDICT_SIZE 1227 1220 1228 if (! m_isFencedOperator) {1221 if (!isFencedOperator()) { 1229 1222 // Finally, we make the attribute values override the default. 1230 1223 … … 1244 1237 if (maxsize != "infinity") 1245 1238 parseMathMLLength(maxsize, m_maxSize, &style(), false); 1239 } 1240 1241 // FIXME: this should be removed when operator spacing is implemented (https://bugs.webkit.org/show_bug.cgi?id=115787). At the moment spacing for normal <mo> elements is handled in mathml.css and mfenced uses the arbitrary constants below. 1242 if (isFencedOperator()) { 1243 if (hasOperatorFlag(MathMLOperatorDictionary::Fence)) { 1244 m_leadingSpace = 0.1f * style().fontSize(); 1245 m_trailingSpace = 0.1f * style().fontSize(); 1246 } else if (hasOperatorFlag(MathMLOperatorDictionary::Separator)) { 1247 m_leadingSpace = 0; 1248 m_trailingSpace = 0.25f * style().fontSize(); 1249 } 1250 } else { 1251 m_leadingSpace = 0; 1252 m_trailingSpace = 0; 1246 1253 } 1247 1254 } … … 1284 1291 } 1285 1292 1286 void RenderMathMLOperator::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)1287 {1288 RenderMathMLBlock::styleDidChange(diff, oldStyle);1289 updateFromElement();1290 }1291 1292 1293 FloatRect RenderMathMLOperator::glyphBoundsForCharacter(UChar character) 1293 1294 { … … 1315 1316 bool allowStretching = shouldAllowStretching(stretchedCharacter); 1316 1317 if (!allowStretching) { 1317 RenderMathML Block::computePreferredLogicalWidths();1318 RenderMathMLToken::computePreferredLogicalWidths(); 1318 1319 return; 1319 1320 } … … 1333 1334 if (character.middleGlyph) 1334 1335 maximumGlyphWidth = std::max(maximumGlyphWidth, advanceForCharacter(character.middleGlyph)); 1335 m_maxPreferredLogicalWidth = m_minPreferredLogicalWidth = m aximumGlyphWidth;1336 m_maxPreferredLogicalWidth = m_minPreferredLogicalWidth = m_leadingSpace + maximumGlyphWidth + m_trailingSpace; 1336 1337 return; 1337 1338 } 1338 1339 1339 m_maxPreferredLogicalWidth = m_minPreferredLogicalWidth = maximumGlyphWidth; 1340 } 1341 1342 // FIXME: It's cleaner to only call updateFromElement when an attribute has changed. The body of 1343 // this method should probably be moved to a private stretchHeightChanged or checkStretchHeight 1344 // method. Probably at the same time, addChild/removeChild methods should be made to work for 1345 // dynamic DOM changes. 1346 void RenderMathMLOperator::updateFromElement() 1347 { 1348 RenderElement* savedRenderer = element().renderer(); 1349 1350 // Destroy our current children 1351 destroyLeftoverChildren(); 1352 1353 // Since we share a node with our children, destroying our children may set our node's 1354 // renderer to 0, so we need to restore it. 1355 element().setRenderer(savedRenderer); 1356 1357 RenderPtr<RenderMathMLBlock> container = createRenderer<RenderMathMLBlock>(element(), RenderStyle::createAnonymousStyleWithDisplay(&style(), FLEX)); 1358 // This container doesn't offer any useful information to accessibility. 1359 container->setIgnoreInAccessibilityTree(true); 1360 container->initializeStyle(); 1361 1362 RenderPtr<RenderText> text; 1363 if (m_isFencedOperator) 1364 text = createRenderer<RenderText>(document(), String(&m_operator, 1)); 1365 else 1366 text = createRenderer<RenderText>(document(), element().textContent().replace(hyphenMinus, minusSign).impl()); 1367 1368 container->addChild(text.leakPtr()); 1369 addChild(container.leakPtr()); 1370 1340 m_maxPreferredLogicalWidth = m_minPreferredLogicalWidth = m_leadingSpace + maximumGlyphWidth + m_trailingSpace; 1341 } 1342 1343 void RenderMathMLOperator::rebuildTokenContent(const String& operatorString) 1344 { 1345 // We collapse the whitespace and replace the hyphens by minus signs. 1346 AtomicString textContent = operatorString.stripWhiteSpace().simplifyWhiteSpace().replace(hyphenMinus, minusSign).impl(); 1347 1348 // We destroy the wrapper and rebuild it. 1349 // FIXME: Using this RenderText make the text inaccessible to the dumpAsText/selection code (https://bugs.webkit.org/show_bug.cgi?id=125597). 1350 if (firstChild()) 1351 toRenderElement(firstChild())->destroy(); 1352 createWrapperIfNeeded(); 1353 RenderPtr<RenderText> text = createRenderer<RenderText>(document(), textContent); 1354 toRenderElement(firstChild())->addChild(text.leakPtr()); 1355 1356 // We verify whether the operator text can be represented by a single UChar. 1357 // FIXME: This does not handle surrogate pairs (https://bugs.webkit.org/show_bug.cgi?id=122296). 1358 // FIXME: This does not handle <mo> operators with multiple characters (https://bugs.webkit.org/show_bug.cgi?id=124828). 1359 m_operator = textContent.length() == 1 ? textContent[0] : 0; 1371 1360 SetOperatorProperties(); 1372 1361 updateStyle(); 1373 1362 setNeedsLayoutAndPrefWidthsRecalc(); 1363 } 1364 1365 void RenderMathMLOperator::updateTokenContent(const String& operatorString) 1366 { 1367 ASSERT(isFencedOperator()); 1368 rebuildTokenContent(operatorString); 1369 } 1370 1371 void RenderMathMLOperator::updateTokenContent() 1372 { 1373 ASSERT(!isFencedOperator()); 1374 rebuildTokenContent(element().textContent()); 1374 1375 } 1375 1376 … … 1425 1426 if (!m_stretchyCharacter) 1426 1427 m_isStretched = false; 1428 1429 // We add spacing around the operator. 1430 const auto& wrapper = toRenderElement(firstChild()); 1431 auto newStyle = RenderStyle::createAnonymousStyleWithDisplay(&style(), FLEX); 1432 newStyle.get().setMarginStart(Length(m_leadingSpace, Fixed)); 1433 newStyle.get().setMarginEnd(Length(m_trailingSpace, Fixed)); 1434 wrapper->setStyle(std::move(newStyle)); 1435 wrapper->setNeedsLayoutAndPrefWidthsRecalc(); 1427 1436 } 1428 1437 … … 1431 1440 if (m_isStretched) 1432 1441 return m_stretchHeightAboveBaseline; 1433 return RenderMathML Block::firstLineBaseline();1442 return RenderMathMLToken::firstLineBaseline(); 1434 1443 } 1435 1444 … … 1519 1528 void RenderMathMLOperator::paint(PaintInfo& info, const LayoutPoint& paintOffset) 1520 1529 { 1521 RenderMathMLBlock::paint(info, paintOffset);1522 1523 1530 if (info.context->paintingDisabled() || info.phase != PaintPhaseForeground || style().visibility() != VISIBLE) 1524 1531 return; 1525 1532 1526 1533 if (!m_isStretched && !m_stretchyCharacter) { 1527 RenderMathML Block::paint(info, paintOffset);1534 RenderMathMLToken::paint(info, paintOffset); 1528 1535 return; 1529 1536 } 1530 1537 1538 // FIXME: This painting should work in RTL mode too (https://bugs.webkit.org/show_bug.cgi?id=123018). 1539 1531 1540 GraphicsContextStateSaver stateSaver(*info.context); 1532 1541 info.context->setFillColor(style().visitedDependentColor(CSSPropertyColor), style().colorSpace()); … … 1536 1545 1537 1546 // We are positioning the glyphs so that the edge of the tight glyph bounds line up exactly with the edges of our paint box. 1538 LayoutPoint operatorTopLeft = ceiledIntPoint(paintOffset + location()); 1547 LayoutPoint operatorTopLeft = paintOffset + location(); 1548 operatorTopLeft.move(m_leadingSpace, 0); 1549 operatorTopLeft = ceiledIntPoint(operatorTopLeft); 1539 1550 FloatRect topGlyphBounds = glyphBoundsForCharacter(m_stretchyCharacter->topGlyph); 1540 1551 LayoutPoint topGlyphOrigin(operatorTopLeft.x(), operatorTopLeft.y() - topGlyphBounds.y()); … … 1563 1574 if (m_isStretched) 1564 1575 return; 1565 RenderMathML Block::paintChildren(paintInfo, paintOffset, paintInfoForChild, usePrintRect);1576 RenderMathMLToken::paintChildren(paintInfo, paintOffset, paintInfoForChild, usePrintRect); 1566 1577 } 1567 1578 -
trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.h
r164700 r165436 30 30 31 31 #include "MathMLElement.h" 32 #include "RenderMathML Block.h"32 #include "RenderMathMLToken.h" 33 33 #include <wtf/unicode/CharacterNames.h> 34 34 … … 58 58 } 59 59 60 class RenderMathMLOperator final : public RenderMathML Block{60 class RenderMathMLOperator final : public RenderMathMLToken { 61 61 public: 62 62 RenderMathMLOperator(MathMLElement&, PassRef<RenderStyle>); 63 RenderMathMLOperator(MathMLElement&, PassRef<RenderStyle>, UChar operatorChar, MathMLOperatorDictionary::Form, MathMLOperatorDictionary::Flag); 64 65 MathMLElement& element() { return toMathMLElement(nodeForNonAnonymous()); } 63 RenderMathMLOperator(Document&, PassRef<RenderStyle>, const String& operatorString, MathMLOperatorDictionary::Form, MathMLOperatorDictionary::Flag); 66 64 67 65 void stretchTo(LayoutUnit heightAboveBaseline, LayoutUnit depthBelowBaseline); … … 70 68 bool hasOperatorFlag(MathMLOperatorDictionary::Flag flag) const { return m_operatorFlags & flag; } 71 69 72 void updateStyle() ;70 void updateStyle() override final; 73 71 74 72 void paint(PaintInfo&, const LayoutPoint&); … … 82 80 }; 83 81 84 virtual void updateFromElement() override; 82 void updateTokenContent(const String& operatorString); 83 void updateTokenContent() override final; 85 84 86 85 private: 87 86 virtual const char* renderName() const override { return isAnonymous() ? "RenderMathMLOperator (anonymous)" : "RenderMathMLOperator"; } 88 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;89 87 virtual void paintChildren(PaintInfo& forSelf, const LayoutPoint&, PaintInfo& forChild, bool usePrintRect) override; 90 88 virtual bool isRenderMathMLOperator() const override { return true; } 89 bool isFencedOperator() { return isAnonymous(); } 91 90 virtual bool isChildAllowed(const RenderObject&, const RenderStyle&) const override; 92 91 virtual void computePreferredLogicalWidths() override; … … 94 93 virtual int firstLineBaseline() const override; 95 94 virtual RenderMathMLOperator* unembellishedOperator() override { return this; } 95 void rebuildTokenContent(const String& operatorString); 96 96 97 97 bool shouldAllowStretching(UChar& characterForStretching); … … 117 117 UChar m_operator; 118 118 StretchyCharacter* m_stretchyCharacter; 119 bool m_isFencedOperator;120 119 MathMLOperatorDictionary::Form m_operatorForm; 121 120 unsigned short m_operatorFlags; -
trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.cpp
r163553 r165436 55 55 if (!firstChild()) { 56 56 RenderPtr<RenderMathMLBlock> wrapper = createAnonymousMathMLBlock(); 57 // This container doesn't offer any useful information to accessibility.58 wrapper->setIgnoreInAccessibilityTree(true);59 57 RenderMathMLBlock::addChild(wrapper.leakPtr()); 60 58 }
Note: See TracChangeset
for help on using the changeset viewer.